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
What is the table & field to identify the no of items (bottles) stored in one case?
Explain the Types of Select statements?
What is the difference between collect and append statements?
What is gui status? How to create /edit gui status?
What is the abap program name to process the batch input session automatically? : abap bdc
Differentiate between transparent tables, cluster tables and pooled tables
SM35 transaction, How to automate BDC ?
What are differences between at selection-screen and at selection-screen output?
Explain the difference between free and refresh?
Difference between Read and Get cursor?
Difference between sy-tabix and sy-index? Can you check sy-subrc after perform?
What is abap?
What is meant by a schema? : sap abap hr
What are the page windows?
What are field symbols?