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


Please Help Members By Posting Answers For Below Questions

What is the functionality of BIZTALK and how it handles the IDOC’s and how u will transfer the IDOCS to the BIZTALK ?

2488


Is it possible to pass data to and from include programs explicitly? : abap modularization

1023


How you attach search help to data element? : sap abap data dictionary

938


How many default tab strips are there?

808


what comes in Timkein written test I hope some body can tell me at this id plz tell it before 9 pm 19 march

1927


What is occurs in internal table?

852


How can we set the tablespaces and extent sizes ?

773


What does an exec sql statement do in abap? What is the disadvantage of using it?

966


Explain what is a logical database?

820


Give examples of transparent table?

929


What are local objects? : abap data dictionary

827


Why do we declare a method of a class final? What can be the purpose? Give a scenario.

1113


the problem is that , while i am undergoing with my practice session, i am creating too many new programs.they are occupying much space in my hard-disk. how to delete un-necessary programs completely from my data- base........... plz help me with this .....

1795


What are the system fields? Explain?

884


What is meant by payscale structure? How did you configure pay scale structure? : sap abap hr

765