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 will you define posting procedures?
how to see the table output?
What is the difference between retroactive accounting period, earliest retroactive accounting period? : sap abap hr
What is occurs in internal table?
what is the process of creating quotation using BAPIs.
How can we decide weather we can enhance the standard infotype or not ? : abap hr
What is roll area?
What is web dynpro for abap?
What are the different software packets available in the market? : sap abap hr
What is sequence of event triggered in report?
What happens if a function module runs in an update task?
How memory management happens for internal tables and work areas in abap?
What will exactly the hide statement do?
Power is interrupted while transferring data from internal table to application server. How will you determine many records are transferred in session method and call transaction method? : abap bdc
What are the events in classical reports?