Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Program to view tables in single view

former_member844813
Participant
0 Kudos

hi experts,

can u guys helping with something, i have a task about abap. i told to make something like se16n, like a simple one i just wanted the program to search a table and display it. thank you in advance

8 REPLIES 8

moshenaveh
Community Manager
Community Manager
0 Kudos

Welcome to the SAP Community. Thank you for visiting us to get answers to your questions.

Since you're asking a question here for the first time, I'd like to offer some friendly advice on how to get the most out of your community membership and experience.

First, please see https://community.sap.com/resources/questions-and-answers, as this resource page provides tips for preparing questions that draw responses from our members. Second, feel free to take our Q&A tutorial at https://developers.sap.com/tutorials/community-qa.html, as that will help you when submitting questions to the community.

I also recommend that you include a profile picture. By personalizing your profile, you encourage readers to respond: https://developers.sap.com/tutorials/community-profile.html.

Now for some specific suggestions on how you might improve your question:

* Outline what steps you took to find answers (and why they weren't helpful) -- so members don't make suggestions that you've already tried.

* Share screenshots of what you've seen/done (if possible), as images always helps our members better understand your problem.

* Make sure you've applied the appropriate tags -- because if you don't apply the correct tags, the right experts won't see your question to answer it.

Should you wish, you can revise your question by selecting Actions, then Edit.

The more details you provide (in questions tagged correctly), the more likely it is that members will be able to respond. As it stands, I don't know if there is enough information here for members to understand your issue. So please consider revising your question because I'd really like to see you get a solution to your problem!

I hope you find this advice useful, and we're happy to have you as part of SAP Community!

jmodaal
Active Contributor

Hello,

here is a rather simple base for doing this:

program Z_SHOW_TABLE.
data: f4Table like dd02l-tabname.
parameters: pTable like f4Table obligatory.
at selection-screen.
call function 'VIEW_AUTHORITY_CHECK'
exporting
view_action = 'S'
view_name = pTable
no_warning_for_clientindep = 'X'
EXCEPTIONS
invalid_action = 1
no_authority = 2
no_clientindependent_authority = 3
table_not_found = 4
no_linedependent_authority = 5
OTHERS = 6.
case sy-subrc.
" Implement dealing with possible returncodes here.
when 2.
message e316(AQ) with pTable.
" ...
endcase.
start-of-selection.
cl_salv_gui_table_ida=>create( iv_table_name = pTable )->fullscreen( )->display( ).

Kind regards

Jan

0 Kudos

there's an error Type "CL_SALV_GUI_TABLE_IDA" is unknown

im new to sap abap so being honest, i really dont know what to do. appriciate ur help

jmodaal
Active Contributor
0 Kudos

Hello,

which version / release is your SAP system?

Kind regards

Jan

jmodaal
Active Contributor
0 Kudos

Hello,

instead of the CL_SALV_GUI_TABLE_IDA you can give this a try:

" ... same as in source code above
start-of-selection.
" Create internal table of the right type.
data: structDesc type ref to cl_abap_typedescr,
salvTable type ref to cl_salv_table,
recordsTable type ref to data.
cl_abap_structdescr=>describe_by_name(
exporting p_name = pTable
receiving p_descr_ref = structDesc
exceptions type_not_found = 1 others = 2 ).
if sy-subrc <> 0.
message |Table { pTable } not found| type 'I'.
exit.
endif.
create data recordsTable type standard table of (pTable).
field-symbols <table> type any table.
assign recordsTable->* to <table>.
" Get the data from the table.
select * from (pTable) into table <table>.
try.
cl_salv_table=>factory(
importing r_salv_table = salvTable
changing t_table = <table> ).
salvTable->get_functions( )->set_all( abap_true ).
salvTable->get_display_settings( )->set_striped_pattern( cl_salv_display_settings=>true ).
salvTable->display( ).
catch cx_salv_msg into data(salvExcMsg).
message salvExcMsg->get_text( ) type 'E'.
endtry.

Kind regards

Jan

raymond_giuseppi
Active Contributor

Use any search-help such as VIEWMAINT (as SM30) to search for table/view

0 Kudos

i could use a complete sample program if that's okay.

0 Kudos

Look at online documentation for code samples, example Creating Tabular Data Objects