I am carrying this report out in SQ01.
All the joins have been achieved with the standard infoset functionality.
Within a custom field 'SHORTS' I have the following code (I know it's not right but can't figure out how to write the correct code in to achieve desired results):
DATA:
begin of WA_FINAL,
VBELV like VBFA-VBELV,
POSNV like VBFA-POSNV,
VBELN like VBFA-VBELN,
POSNN like VBFA-POSNN,
KWMENG like VBAP-KWMENG,
LFIMG like LIPS-LFIMG,
end of WA_FINAL,
I_FINAL like standard table of WA_FINAL with header line,
l_sum like LIPS-LFIMG,
wa_del_sent like LIPS-LFIMG.
SELECT
VBELV POSNV VBELV POSNV
INTO
I_FINAL
FROM
VBFA.
ENDSELECT.
SELECT
KWMENG
FROM
VBAP
INTO
I_FINAL for all entries in I_FINAL
WHERE
VBELN = I_FINAL-VBELV AND POSNR = I_FINAL-POSNV.
ENDSELECT.
SELECT
LFIMG
FROM
LIPS
INTO
I_FINAL for all entries in I_FINAL
WHERE
VBELN = I_FINAL-VBELN AND POSNR = I_FINAL-POSNN.
ENDSELECT.
loop at I_FINAL into WA_FINAL.
if sy-tabix = 1.
l_sum = WA_FINAL-LFIMG.
WA_FINAL-LFIMG = WA_FINAL-LFIMG.
SHORTS = WA_FINAL-KWMENG - WA_FINAL-LFIMG.
wa_del_sent = WA_FINAL-LFIMG.
else .
l_sum = wa_del_sent + l_sum.
SHORTS = WA_FINAL-KWMENG - l_sum.
endif.
endloop.