‎2013 Jun 18 7:20 AM
Hi ABAP Guru,
I'm currently working on a requirement in which i have extract data from the table CDHDR for a given timestamp. Based on the object id and tcode in the table CDHDR i have to extract the data from the corresponding tables, eg. if the tcode is ME21N then i have to extract based on the object id i.e, EBELN in the case of ME21N to an internal table. And the extraction changes based on the t.code. So my doubts are.
1. Can i extract all the data of different tcodes with their corresponding fields in the same internal table?
2. How can i differentiate the data from different tables in the internal table?
3. How to print them ?
‎2013 Jun 18 7:32 AM
Yes you can extract all of them.
See the table TSTCT with "T-Code" of CDHDR to get the description of the T-Code use the T-Code to differentiate.
Prepare an ALV to display the record it will print automatically
I hope it helps
‎2013 Jun 18 8:00 AM
Hi Enoch,
1) Yes you can extract data of diff. tables using same structure provided your structure is generic and has the maximum number of fields which can be present in any table you intend to hit.
Eg :
begin of ty_data,
field1 type string,
field2 type string,
field3 type string,
........
.......
fieldN type string,
end of ty_data.
-> here any table which you intend to hit should not have more than 'fieldN' fields.
2) differentiate on basis of T-code i.es what your question also says.
3) Display as ALV_GRID or ALV_LIST.
(Last two are same as Yakub .)
BR.
‎2013 Jun 18 8:21 AM
Hi Ankit,
I'm maintaing some t.codes such as eg. ME21N, MIGO, MIR7, in a ztable. based on that ztable i'm extracting objectid and tcodes from CDHDR table for a certain timestamp into an internal table. so for the t.code ME21N i have to extract based on the objectid which in this case EBELN , EKGRP, LIFNR , RLWRT from ekko and the extraction changes for different tcode. i'm asking how to maintain all the data in the same internal table. how to print the data based on the tcode from the internal table. Hope you understand.