Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

use of READ REPORT and INSERT REPORT

Former Member
0 Kudos

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.:-)

5 REPLIES 5

former_member404244
Active Contributor
0 Kudos

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

0 Kudos

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.

0 Kudos

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

Former Member
0 Kudos

yes it is possiable.

refer table structure. itab and wa .

Former Member
0 Kudos

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..