Skip to Content
0
Former Member
Aug 27, 2007 at 05:59 AM

abap fgs report

21 Views

hi guru's,

i have a problem with my code can anyone help me out with this,actually i am fetching invoice quantity from vbrp based on sales order (vbeln and posnr).actually i have 3 line items in sales order. but they invoce for this particular sales order is done seperately by dividing it into two. say in first invoice they have taken 3 quantity each from each line item and in second invoice they haive taken rest of it.so i need to get the invoice quantity updated each time the invoice is done for that particular sales order. i have written a code for it but the problem is i am getting all they invoce quantity in internal table it_vbrp but its moving only the first invoice item to final internal table it_final.please can anyone help me out with this code what statement i should write in this code to update my invoice quantity at end while moving it into final irrespective of invoice generated.my code is as follows, please help me out,

IF NOT IT_FINAL[] IS INITIAL.

SORT IT_FINAL BY VBELN.

SELECT FKIMG VBELN AUBEL POSNR FROM VBRP INTO CORRESPONDING FIELDS OF TABLE IT_VBRP

FOR ALL ENTRIES IN IT_FINAL WHERE AUBEL = IT_FINAL-VBELN.

ENDIF.

IF NOT IT_VBRP[] IS INITIAL.

SORT IT_VBRP BY AUBEL POSNR.

LOOP AT IT_FINAL.

WA_TABIX = SY-TABIX.

READ TABLE IT_VBRP WITH KEY AUBEL = IT_FINAL-VBELN POSNR = IT_FINAL-POSNR BINARY SEARCH.

IF SY-SUBRC = 0.

IT_FINAL-FKIMG = IT_VBRP-FKIMG.

MODIFY IT_FINAL INDEX WA_TABIX TRANSPORTING FKIMG.

ENDIF.

ENDLOOP.

ENDIF.