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

Problem in processing internal table

Former Member
0 Likes
698

Hi All,

Im facing some problem with an internal table with header.

This is Xvbkd with heaer line.

Header	100	0000000049	000010					EXW	China
1	100	0000000049	000000					CIF	HK
2	100	0000000049	000010					CIF	HK
3	100	0000000049	000020					CIF	HK

Now I want modify the internal table of 2nd record. The data above has modified in the header.but not reflected in the body.

Here is my code:

SELECT SINGLE inco1 inco2
                        INTO (knvv-inco1, knvv-inco2)
                        FROM knvv
                        WHERE kunnr EQ w_shipto
                          AND vkorg EQ vbak-vkorg
                          AND vtweg EQ vbak-vtweg
                          AND spart EQ vbak-spart.

                    IF sy-subrc EQ 0 AND
                        knvv-inco1 NE space or
                        knvv-inco2 NE space.

                      MOVE: knvv-inco1 TO wa_xvbkd-inco1,
                            knvv-inco2 TO wa_xvbkd-inco2.
                     READ table xvbkd with key vbeln = xvbap-vbeln
                                                posnr = xvbap-posnr.
                      IF sy-subrc = 0.
                      xvbkd-inco1 = wa_xvbkd-inco1.
                      xvbkd-inco2 = wa_xvbkd-inco2.
                      modify table xvbkd from wa_xvbkd transporting  inco1 inco2.
                     endif.
                    ENDIF.

Requirement: is the 2nd record(item 10) in above internal table has to reflect the change with EXW and China.

Pls help me with ur valuable suggestions.

Regards,

Priya

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
654

Hello


 READ table xvbkd with key vbeln = xvbap-vbeln
                            posnr = xvbap-posnr.
  IF sy-subrc = 0.
  xvbkd-inco1 = wa_xvbkd-inco1.
  xvbkd-inco2 = wa_xvbkd-inco2.
  modify xvbkd from wa_xvbkd index sy-tabix transporting  inco1 inco2. " <- must be so
 endif.

5 REPLIES 5
Read only

anup_deshmukh4
Active Contributor
0 Likes
654

Hello priya,

READ table xvbkd with key vbeln = xvbap-vbeln
                                                posnr = xvbap-posnr 

above statement will set your index save it in some variable . ( Assumed that you are reading the record which you have to modify....!)

When you use modify use it to modify the table,

hope it helps

Read only

0 Likes
654

Hi,

Read statement is working fine.

sy-subrc also = 0, but the problem is only with the modify statement.

Any body pls help.

Rgs,

Priya

Read only

Former Member
0 Likes
655

Hello


 READ table xvbkd with key vbeln = xvbap-vbeln
                            posnr = xvbap-posnr.
  IF sy-subrc = 0.
  xvbkd-inco1 = wa_xvbkd-inco1.
  xvbkd-inco2 = wa_xvbkd-inco2.
  modify xvbkd from wa_xvbkd index sy-tabix transporting  inco1 inco2. " <- must be so
 endif.

Read only

Former Member
0 Likes
654

try,


SELECT SINGLE inco1 inco2
                        INTO (knvv-inco1, knvv-inco2)
                        FROM knvv
                        WHERE kunnr EQ w_shipto
                          AND vkorg EQ vbak-vkorg
                          AND vtweg EQ vbak-vtweg
                          AND spart EQ vbak-spart.
 
                    IF sy-subrc EQ 0 AND
                        knvv-inco1 NE space or
                        knvv-inco2 NE space.
 
                      MOVE: knvv-inco1 TO xvbkd-inco1,
                            knvv-inco2 TO xvbkd-inco2.
                     READ table xvbkd with key vbeln = xvbap-vbeln
                                                posnr = xvbap-posnr.
                      IF sy-subrc = 0.
                      modify xvbkd index sy-tabix.
                     endif.
                    ENDIF.

Regards,

John

Edited by: jvanpelt on Jul 16, 2010 9:36 AM

Read only

Former Member
0 Likes
654

Hi,

use

modify table xvbkd transporting  inco1 inco2.

instead of

modify table xvbkd from wa_xvbkd transporting  inco1 inco2.

If you are modifying a table content without INDEX addition, a line to be modified is determined by values of key fields. In wa_xvbkd are these values not set, they are set in a header line of xvbkd.

Regards,

Adrian