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
5) How to rereive text elements in SF and script?
What are the basic components of dialog program?
What does nw 7.4 sp 05/nw 7.5 sp 02 offers in abap?
what is diff between idocs,bdc,rfc and bapi. give real time answer
Setting up a BDC program where you find information from?
What are the value tables?
What is the Process to transfer IDOC from Outbound System to Inbound system.
What is the significance of hide?
What is size category?
What is evaluation path, where do we do it and why? : sap abap hr
What are screen painter and menu painter? : abap hr
What are the different types of views and their definition?
While sorting field groups we cannot use more than one key field. State true or false. : abap modularization
What is a persistent class?
while implementing badi what are the tables u find??