Can you create an internal table dynamically?(at run time)
Answer Posted / ganesh sawant
REPORT Dynmic Table .
PARAMETERS: table(20),
rows TYPE i DEFAULT 100.
* Declare the variable for holding your internal table
DATA: itab TYPE REF TO data.
* Three field symbols requried 1. for acessing table data..second work area and third individual fields.
FIELD-SYMBOLS: <fs_table> TYPE ANY TABLE,
<fs_wa> TYPE ANY,
<field> TYPE ANY.
TRY.
* Create internal table
CREATE DATA itab TYPE STANDARD TABLE OF (table).
* Let our Field Symbol point to it so we can acess its data afterwords.
ASSIGN itab->* TO <fs_table>.
* put data into internal table
SELECT * FROM (table) UP TO rows ROWS INTO TABLE <fs_table>.
* Loop over internal tabel with the help of field symbol pointing to its data
LOOP AT <fs_table> ASSIGNING <fs_wa>.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE <fs_wa> TO <field>.
IF sy-subrc EQ 0.
WRITE: <field>.
ELSE.
EXIT.
ENDIF.
ENDDO.
ULINE.
ENDLOOP.
CATCH cx_sy_create_data_error.
WRITE 'Wrong Database!'.
ENDTRY.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
how to Create reports in SD module such as sales order report, which covers all organization levels, delivery status, invoice status, shipping details and partner function details. The data will be extracted from VBAP, VBPA, VBAK, VBUP, VBFA, KNA1, LIPS, VBRP, MARA, VBEP and KONV tables. plz mention the detail coding Tahnks, Rahul
In sap scripts, how will you link form with the event driven?
What is delivery class? : abap data dictionary
How do you get the number of lines in an internal table? How to use a specific number occurs statement?
What is retro active accounting
What are the three components of a work process?
Explain how many types of tables exist and what are they in data dictionary?
Does sap handle multiple currencies?
What are the fields in a bdc_tab table? : abap bdc
What is a batch input session? : abap hr
How to find the return code of an stmt in abap programs?
What are the function of the transport system and workbench organiser? : abap data dictionary
how to create view in bdc..??
How do you differentiate tax for different countries? : sap abap hr
Can there be more than 1 main window in sap script?