‎2008 Jan 31 2:06 PM
hi,
i am fetching data from vbfa successfully now problem is that
in vbrk invoice date and invoice number is there .
but i need last invoice numbe. i.e VL02n if i cancel IB intercompany Billing Number 90003843 then last Billing number is 90003844 so in that condition i want that data should come.
its comming in internal table but i am gettin problem how to modify my internal table .
see my code.
CLEAR : wa_vbrk, sy-subrc.
READ TABLE it_vbrk INTO wa_vbrk WITH KEY vbeln = wa_vbfa-vbeln.
IF sy-subrc = 0.
MOVE : wa_vbrk-fkdat TO wa_final-fkdat_bill, " invoice date
wa_vbrk-vbeln TO wa_final-vbeln_inv. " invoice date
ENDIF.
this is working fine but not picking last billing number i.e 90003844
so i have take loop.
LOOP AT it_vbfa INTO wa_vbfa.
*
READ TABLE it_vbrk INTO wa_vbrk WITH KEY vbeln = wa_vbfa-vbeln.
IF sy-subrc <> 0.
MOVE : wa_vbrk-fkdat TO wa_final-fkdat_bill,
wa_vbrk-vbeln TO wa_final-vbeln_inv.
IF it_final IS NOT INITIAL.
MODIFY it_final FROM wa_final index sy-tabix TRANSPORTING fkdat_bill vbeln_inv.
ENDIF.
*
ENDIF.
ENDLOOP.
it showing dump.
‎2008 Jan 31 2:15 PM
Hi Monica
Looks like you are having trouble to get he bigger value...
why don't you use SORT by billnumber descending ? and capture the number you wanted..
and for modify satement..
it_final does this table have values before..? if not it will dump...
if it don nnot have any values... u need to use append...
‎2008 Jan 31 2:15 PM
Hi Monica
Looks like you are having trouble to get he bigger value...
why don't you use SORT by billnumber descending ? and capture the number you wanted..
and for modify satement..
it_final does this table have values before..? if not it will dump...
if it don nnot have any values... u need to use append...
‎2008 Jan 31 2:15 PM
Not sure if all of your code is pasted in here.. but this is a problem:
MODIFY it_final FROM wa_final index sy-tabix
The INDEX SY-TABIX refers to the line counter of the table in your LOOP. In this case, it is using SY-TABIX from LOOP AT IT_VBFA.
Not sure what the surrounding code contains - but I would try removing the INDEX SY-TABIX from the MODIFY verb.
If that does not fix it, you must first read IT_FINAL to the current record that you wish to update. Then use MODIFY .
‎2008 Jan 31 2:16 PM
Hi,
You can do as below :
sort itab by BIllingNumber descending.
Read the first item.
You will get last document number.
Thanks,
Sriram Ponna.
‎2008 Feb 01 2:31 PM