‎2009 Mar 14 6:44 AM
Hi expert,
I want to display an internal table on screen. I had developed the program and got all the values in internal table. now i want to display this internal table on screen.
how can i do this?
Thanks in advance.
Abhishek
‎2009 Mar 14 6:46 AM
Hi,
Use the loop statement.
loop at itab into fs_itab.
write: / fs_itab-carrid,fs_itab-connid.
endloop.
Regards,
jaya
‎2009 Mar 14 7:09 AM
Thanks for reply.
but i want to display the internal table on customize screen which i developed by using screen painter.
‎2009 Mar 14 7:10 AM
I think you can make use of ALV which will be developed by using OO ALV
‎2009 Mar 14 6:52 AM
HI,
Test the Sample Code Bellow.
TYPES: BEGIN OF ty_it,
mm(10),
amount TYPE i,
END OF ty_it.
DATA: it_mm1 TYPE STANDARD TABLE OF ty_it WITH HEADER LINE.
it_mm1-mm = 'AAA'.
it_mm1-amount = 10.
APPEND it_mm1 TO it_mm1.
it_mm1-mm = 'BBB'.
it_mm1-amount = 10.
APPEND it_mm1 TO it_mm1.
it_mm1-mm = 'AAA'.
it_mm1-amount = 10.
APPEND it_mm1 TO it_mm1.
SORT it_mm1 BY mm DESCENDING.
WRITE: 'Heading1', 20 'Heading2'.
LOOP AT it_mm1.
WRITE: / it_mm1-mm, it_mm1-amount.
ENDLOOP.Kind Regards,
Faisal
‎2009 Mar 14 7:09 AM
Thanks for reply.
but i want to display the internal table on customize screen which i developed by using screen painter.
‎2009 Mar 14 7:05 AM
Hi,
Use this loop statement
LOOP AT <tablename> INTO <workarea>.
WRITE <workarea-fieldname>.
ENDLOOP>.
Thanks.
‎2009 Mar 14 7:11 AM
‎2009 Mar 14 7:18 AM
Hi Faisal Altaf ,
I tried it by using table control but not able to call selection screen. do you have any code for reference.
‎2009 Mar 14 7:35 AM
Hi,
PROCESS BEFORE OUTPUT.
MODULE set_cursor_field.
MODULE zfsl_stinfo_tc_init.
MODULE zfsl_stinfo_disable_key.
LOOP AT it_zfsl_stinfo INTO it_zfsl_stinfo "Use This Loop
WITH CONTROL tc_for_zfsl_stinfo " here tc_for_zfsl_stinfo is table Control name.
CURSOR tc_for_zfsl_stinfo-current_line.
ENDLOOP.your table Control Fields name must be IT_ZFSL_STINFO-F1, IT_ZFSL_STINFO-f2 so on.
in your driver program also write the following.
CONTROLS: tc_for_zfsl_stinfo TYPE TABLEVIEW USING SCREEN 1. " here tc_for_zfsl_stinfo is Table Control name and 1 is Screen number of screen painterPlease Reply if any Issue,
Best Regards,
Faisal
Edited by: Faisal Altaf on Mar 14, 2009 1:22 PM
‎2009 Mar 14 7:33 AM
Hi,
Try with this.
First create the container on your screen.
In your program,
data: w_container TYPE REF TO cl_gui_custom_container,
it_fieldcat TYPE TABLE OF lvc_s_fcat,
wa_fieldcat TYPE lvc_s_fcat,
is_layout TYPE lvc_s_layo,
w_grid TYPE REF TO cl_gui_alv_grid.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'F!'.
wa_fieldcat-coltext = 'F!.'.
wa_fieldcat-outputlen = 10.
APPEND wa_fieldcat TO it_fieldcat.
CLEAR wa_fieldcat.
wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'F2'.
wa_fieldcat-coltext = 'F2.'.
wa_fieldcat-outputlen = 10.
APPEND wa_fieldcat TO it_fieldcat.
CREATE OBJECT w_container
EXPORTING
parent =
container_name = 'CONTAINER'
style =
lifetime = lifetime_default
repid =
dynnr =
no_autodef_progid_dynnr =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
lifetime_dynpro_dynpro_link = 5
OTHERS = 6
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CREATE OBJECT w_grid
EXPORTING
i_shellstyle = 0
i_lifetime =
i_parent = w_container
i_appl_events = space
i_parentdbg =
i_applogparent =
i_graphicsparent =
i_name =
i_fcat_complete = space
EXCEPTIONS
error_cntl_create = 1
error_cntl_init = 2
error_cntl_link = 3
error_dp_create = 4
OTHERS = 5
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
w_grid->set_table_for_first_display(
EXPORTING
i_buffer_active =
i_bypassing_buffer =
i_consistency_check =
i_structure_name =
is_variant = w_variant
i_save = 'A'
i_default = 'X'
is_layout = is_layout
is_print =
it_special_groups =
it_toolbar_excluding =
it_hyperlink =
it_alv_graphics =
it_except_qinfo =
ir_salv_adapter =
CHANGING
it_outtab = it_output
it_fieldcatalog = it_fieldcat
it_sort =
it_filter =
EXCEPTIONS
invalid_parameter_combination = 1
program_error = 2
too_many_lines = 3
OTHERS = 4
).
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CALL SCREEN 200.
Hope this will resolve your problem.
Thanks & Regards,
Anagha Deshmukh
Edited by: Anagha Deshmukh on Mar 14, 2009 8:36 AM
‎2009 Mar 14 9:09 AM
hi look at this beautiful code.....
REPORT ztest line-size 1023.
data itab type standard table of mara.
parameters: p_matnr type matnr.
SELECTION-SCREEN: BEGIN OF BLOCK blk3 WITH FRAME TITLE blk3.
select * from mara into table itab.
CALL FUNCTION 'SRTT_TABLE_DISPLAY'
EXPORTING
table = 'MARA'
IV_TITLE = 'User List'
tables
table_content = itab.
SELECTION-SCREEN: END OF BLOCK blk3.
regards,
venkat
‎2014 May 30 1:51 PM
Thank you Venkateswararao Appikonda for the function module!! Worked wonders for me after lot of struggle to attain the required output
BR,
Debugger
‎2023 Mar 06 8:32 AM
what if i wanted to make the program able to search a table and display it, what should i do ?
‎2023 Mar 06 8:35 AM
demaauliansyah
While we're happy that you've come to SAP Community to get an answer to your question, you posted your question as a comment in an old thread.
If you're looking for help, you should ask a new question: https://answers.sap.com/questions/ask.html.
Here are some tips to help you craft an effective question for our community: https://community.sap.com/resources/questions-and-answers, https://developers.sap.com/tutorials/community-qa.html, https://groups.community.sap.com/t5/welcome-corner-discussions/advice-from-sap-champions-questions-a....
I encourage you to follow this guidance, as I'd really like to see you get a solution to your problem.
I hope you find this advice useful!
‎2009 Mar 14 11:05 AM
Hi
To Display an internal Table in the Screen use Write Statement
For more than one record in the internal table use Loop At Internal Name .
Sample Code
tables : ekko.
data : begin of struc,
EBELN like ekko-ebeln,
lifnr like ekko-lifnr,
end of struc.
data : itab like struc occurs 0 with header line.
select ebeln lifnr from ekko
into corresponding fields of itab up to 80 rows.
append itab.
endselect.
write :/5 'purchase document',
30 'vendor no'.
loop at itab.
write : /5 itab-ebeln,
30 itab-lifnr.
endloop.
‎2009 Mar 14 12:48 PM
@ Venkat,
Man that was an awesome info. thanks for that function module
Yeah you are right it was a awesome piece of code indeed.
GS
‎2009 Mar 16 4:25 AM
‎2021 Sep 17 3:21 PM
IMHO the easiest way is to use an ALV grid:
REPORT z_test.
...
DATA: lo_alv TYPE REF TO cl_salv_table.
cl_salv_table=>factory(
IMPORTING
r_salv_table = lo_alv
CHANGING
t_table = itab
).
lo_alv->display( ).