SELECT nrrangenr, nrlevel FROM znriv INTO TABLE number_ranges_from
WHERE object = 'EINKBELEG'.
SELECT h~ebeln, i~ebelp, h~bsart, i~knttp, m~spart, i~matnr, d~vgabe, d~belnr, d~gjahr, h~bukrs
FROM ekko AS h INNER JOIN t161 AS nr ON nr~bstyp = h~bstyp AND nr~bsart = h~bsart
INNER JOIN ekpo AS i ON h~ebeln = i~ebeln
LEFT OUTER JOIN mara AS m ON m~matnr = i~matnr
INNER JOIN ekbe AS d ON d~ebeln = i~ebeln AND d~ebelp = i~ebelp
FOR ALL ENTRIES IN @number_ranges_from
WHERE d~vgabe IN ('2', '3')
AND nr~numki = @number_ranges_from-nrrangenr AND h~ebeln > @number_ranges_from-nrlevel
INTO TABLE @DATA(actual_coverage).
SORT actual_coverage BY bsart knttp spart matnr ebeln ebelp vgabe.
cl_demo_output=>write( actual_coverage ).
reference_keys = VALUE #( FOR invoice IN actual_coverage
( awkey = |{ invoice-belnr }{ invoice-gjahr }| bukrs = invoice-bukrs ) ).
SELECT bukrs, belnr, gjahr, awkey FROM bkpf
FOR ALL ENTRIES IN @reference_keys
WHERE awtyp = 'RMRP' AND bukrs = @reference_keys-bukrs AND awkey = @reference_keys-awkey
INTO TABLE @DATA(booking_keys).
SELECT bukrs, belnr, gjahr, buzei, bschl, hkont, gsber, ebeln, ebelp FROM bseg
FOR ALL ENTRIES IN @booking_keys
WHERE bukrs = @booking_keys-bukrs AND belnr = @booking_keys-belnr AND gjahr = @booking_keys-gjahr
INTO TABLE @DATA(test_results).
cl_demo_output=>write( test_results ).
cl_demo_output=>display( ).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
5 | |
3 | |
2 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 |