2021 Jul 05 12:47 PM
Hello experts,
I am stuck at a place where I am able to pull out the data from 5 different tables but not able to put all the data into one final internal table without a header line for the creation of the ALV report? Those five tables are- KNA1, VBRK, VBRP, MARA & MAKT.
KNA1- Customer no(kunnr), Name1(name1), City(Ort01), Company code(Bukrs), Date of record(Erdat), Name of person(Ernam).
VBRK- Customer no(Kunag), Billing document(Vbeln), Billing type(Fkart), Customer group(Kdgrp).
VBRP- Billing document(Vbeln), Material Number(Matnr), Billing item(Posnr).
MARA- Material Number(Matnr), Material group(Matkl), Material type(Mtart).
MAKT- Material Number(Matnr), Material description(Maktx).
On the basis of customer no I have to find a billing document, based on the billing document I need its material number, based on material number need its material group, and based on the material number the material description.
I am able to pull out the data, the only help I want is to put all these internal tables data into one final internal table which is.
BEGIN OF TP_FINAL,
KUNNR TYPE KUNNR,
NAME1 TYPE NAME1,
ORT01 TYPE ORT01,
BUKRS TYPE BUKRS,
ERDAT TYPE ERDAT,
ERNAM TYPE ERNAM,
VBELN TYPE VBELN,
FKART TYPE FKART,
FKTYP TYPE FKTYP,
KDGRP TYPE KDGRP,
POSNR TYPE POSNR,
MATNR TYPE MATNR,
MATKL TYPE MATKL,
MTART TYPE MTART,
MAKTX TYPE MAKTX,
MAKTG TYPE MAKTG,
END OF TP_FINAL.
Please help me out with this?
2021 Jul 05 1:07 PM
Can you share more about the table from which you are fetching the data, also Do all the 5 tables have some kind of relationship? and how exactly you want to have the data in the internal table
2021 Jul 05 4:25 PM
Use Fields symbols, so no header line required (sample)
LOOP AT itab1 ASSIGNING <fs1>. " use the table with the more records.
APPEND INITIAL LINE TO itab2 ASSIGNING <fs2>.
MOVE-CORRESPONDING <fs1> TO <fs2>.
READ TABLE itab3 WITH KEY field2 = <fs2>-field2 ASSIGNING <fs3>. " sorted type table so binary search explicit of course...
<fs2>-field3 = <fs3>-field3.
" ...
ENDLOOP.<br>
Of course, fell free to use 7.40+ syntax for internal table.
What did you already code?
2021 Jul 06 7:27 AM
2021 Jul 06 12:26 PM
Hello, yes I tried with join and it's working but I have to try it in another way which is by loops, read tables, and multiple select queries, and then populating the final internal table.
2021 Jul 07 7:37 AM
I'm sorry, but I cannot understand why you cannot use JOINs. This is weird.
2021 Jul 07 8:06 AM
2021 Jul 07 10:27 AM
It's what I thought, matthew.billingham . Sadly, that's the worst way to "learn" anything. And I cannot waste more time training someone now.