I'm working on a web service. I have a select statement like this (it has much more fields and 2 more joins than this but to keep it simple):
SELECT acdoca~augbl,
open_amount, "I need to add value to this field based on the IF statement below
acdoca~koart
FROM acdoca
LEFT JOIN bseg ON acdoca~belnr EQ bseg~belnr
AND acdoca~gjahr EQ bseg~gjahr
AND acdoca~buzei EQ bseg~buzei
AND acdoca~rbukrs EQ bseg~bukrs
INTO table @it_acdoca.
I need to add this IF statement:
IF bseg-KOART = 'D' or bseg-KOART = 'K'
IF acdoca-AUGBL is INITIAL THEN open_amount = DMBTR
ELSE open_amount = 0
ENDIF.
ELSE open_amount = 0
ENDIF.
I need an answer that won't trash the performance of the service. Since ACDOCA and BSEG are some of the biggest database tables in SAP. I tried using LOOP after SELECT and then adding this IF inside that LOOP but that destroyed the performance totally.
This Is What IT_ACDOCA table should look like after
Hoping for a quick reply. Best regards.
Aucun commentaire:
Enregistrer un commentaire