As much as I liked the Loop and Select-tip it still has the potential for major runtime problems especially in...
By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.
versions before 4.x. So here is an alternative that will run on all systems from 3.0D on. It would probably even work before, but you might run into some problems trying it on a 2.x system.
Report zzatip. Data: begin of data_package occurs 0, Matnr like mara-matnr, end of data_package. types: begin of ty_mara, matnr like mara-matnr, matkl like mara-matkl, end of ty_mara. data: wa_mara type ty_mara. data: ta_mara type sorted table of ty_mara with non-unique key matnr. * First, data must be available in the table DATA_PACKAGE * Then the corresponding materialdata from MARA must be read SELECT MATNR MATKL INTO TABLE TA_MARA FROM MARA FOR ALL ENTRIES IN DATA_PACKAGE WHERE MATNR = DATA_PACKAGE-MATNR. * With the following loop you can combine the records. *Let's complicate things and assume *dupplicates on ta_mara *(Could come from mard or marc) Data idx like syst-tabix. Sort Ta_mara by matnr. LOOP AT DATA_PACKAGE. read table ta_mara with key matnr = DATA_PACKAGE-MATNR. check syst-subrc = 0. idx = syst-tabix. Loop at ta_mara from syst-tabix. if ta_mara-matnr ne data_package-matnr. exit. endif. ..... ENDLOOP. ENDLOOP.