I have a problem concerning joining vbak and konv. I want the contents to be in the same table at the output, but it does not seem to work. I cannot use the easy way of using JOIN, as KONV is a special table.
Any help ?
TYPES: BEGIN OF ty_vbak,
vkorg TYPE vbak–vkorg,
vbeln TYPE vbak–vbeln,
erdat TYPE vbak–erdat,
knumv TYPE vbak–knumv,
vtweg TYPE vbak–vtweg,
kalsm TYPE vbak–kalsm,
END OF ty_vbak.
TYPES: BEGIN OF ty_konv,
knumv TYPE konv–knumv,
kposn TYPE konv–kposn,
stunr TYPE konv–stunr,
kschl TYPE konv–kschl,
kdatu TYPE konv–kdatu,
kherk TYPE konv–kherk,
kinak TYPE konv–kinak,
END OF ty_konv.
TYPES: BEGIN OF ty_tab,
vkorg TYPE vbak–vkorg,
vbeln TYPE vbak–vbeln,
erdat TYPE vbak–erdat,
vtweg TYPE vbak–vtweg,
kalsm TYPE vbak–kalsm,
knumv TYPE vbak–knumv,
kposn TYPE konv–kposn,
stunr TYPE konv–stunr,
kschl TYPE konv–kschl,
kdatu TYPE konv–kdatu,
kherk TYPE konv–kherk,
kinak TYPE konv–kinak,
END OF ty_tab.
DATA: it_vbak TYPE TABLE OF ty_vbak,
it_vbak2 TYPE TABLE OF ty_vbak,
it_konv TYPE TABLE OF ty_konv,
it_tab TYPE TABLE OF ty_tab,
wa_tab TYPE ty_tab,
wa_konv TYPE ty_konv.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT–001.
SELECT-OPTIONS: s_date FOR vbak–erdat,
s_vkorg FOR vbak–vkorg NO INTERVALS,
s_vtweg FOR vbak–vtweg NO INTERVALS,
s_vbeln FOR vbak–vbeln NO INTERVALS.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE TEXT–002.
SELECT-OPTIONS:
s_kposn FOR konv–kposn NO INTERVALS,
s_stunr FOR konv–stunr NO INTERVALS,
s_kschl FOR konv–kschl NO INTERVALS,
s_kherk FOR konv–kherk NO INTERVALS,
s_kinak FOR konv–kinak NO INTERVALS,
s_kdatu FOR konv–kdatu.
SELECTION-SCREEN END OF BLOCK b2.
START-OF-SELECTION.
SELECT knumv
FROM vbak
INTO TABLE @DATA(it_knumv)
WHERE erdat IN @s_date AND
vkorg IN @s_vkorg AND
vtweg IN @s_vtweg AND
vbeln IN @s_vbeln
ORDER BY kalsm ASCENDING.
SELECT knumv, kposn, stunr, kschl, kdatu, kherk, kinak
FROM konv
FOR ALL ENTRIES IN @IT_knumv
WHERE knumv = @IT_knumv–knumv AND
kdatu IN @s_kdatu AND
kposn IN @s_kposn AND
stunr IN @s_stunr AND
kschl IN @s_kschl AND
kherk IN @s_kherk AND
kinak IN @s_kinak
INTO CORRESPONDING FIELDS OF TABLE @IT_tab.
SELECT vkorg, vbeln, erdat, vtweg, kalsm
FROM vbak
FOR ALL ENTRIES IN @IT_knumv
WHERE knumv = @IT_knumv–knumv
INTO CORRESPONDING FIELDS OF TABLE @IT_vbak.
MOVE-CORRESPONDING it_vbak TO it_tab.