Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

modify itab.

Former Member
0 Likes
611

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.

1 ACCEPTED SOLUTION
Read only

former_member156446
Active Contributor
0 Likes
583

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...

4 REPLIES 4
Read only

former_member156446
Active Contributor
0 Likes
584

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...

Read only

Former Member
0 Likes
583

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 .

Read only

Former Member
0 Likes
583

Hi,

You can do as below :


sort itab by BIllingNumber descending.

Read the first item.

You will get last document number.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
583

thanks jay.

point given