11-23-2007 10:05 AM
Hi Guys,
i need a small help from u guys.......
i want to know the use of READ REPORT and INSERT REPORT with Example
the requirement is...
i want to declare an internal table with fields from custom table.
if any field is aded in the custum table then that field also should get populated in the program.
Ex: custom table fields are
MANDT
BUKRS
MATNR
LIFNR
field1
field2
field3
now suppose if a new field field4 is added in the Table
then the Program should automatically pick-up the fields from FIELD1...FIELD4.
i heard by using READ and INSERT report we can do it
plz help me ...
Thanks
Sunil.:-)
11-23-2007 10:13 AM
Hi,
Just declre the internla table like the data base table
data : itab type table of ztable.
Now the structure of ztable if changed the itab also will change...
Regards,
Nagaraj
11-23-2007 10:30 AM
i agree with ur answer ...
but i need only fields from FIELD1....FIELD4.
i dont want remaining fields.
because in my program iam using COLLECT Statement which is not happeningdue to the rest of the fields.
11-23-2007 10:33 AM
If you're on 46C or above, you can use the following to generate tables dynamically.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = GT_FIELDCAT
IMPORTING
EP_TABLE = GS_DATA_HEAD
EXCEPTIONS
GENERATE_SUBPOOL_DIR_FULL = 1
OTHERS = 2.
But you are restricted to 32 calls, if I remember correctly. If you are in a later release, you can use the RTTS classes to create internal tables dynamically, without the restriction on subroutine pools.
These classes are CL_ABAP_TYPEDESCR and subclasses.
There are a few blogs on SDN that give examples of their use.
Matt
11-23-2007 10:22 AM
11-23-2007 10:24 AM
Hi..
Declare ur internal table structure in the table structure itself..
For Eg.
data : begin of itab occurs 0.
include strucuture zxxx.
data end of itab.
Regards
Bala..