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 Statement

Former Member
0 Likes
652

Hey folks,

I have a requirement where i have to modify the table

SELECT kunnr

hkunnr

FROM knvh INTO CORRESPONDING FIELDS OF TABLE gt_knvh FOR ALL ENTRIES IN gt_vbrk

WHERE kunnr = gt_vbrk-kunag.

SELECT kunnr

name1

FROM kna1 INTO CORRESPONDING FIELDS OF TABLE gt_kna11 FOR ALL ENTRIES IN gt_knvh

WHERE kunnr = gt_knvh-hkunnr.

LOOP AT gt_kna11 INTO gs_kna11.

gs_final1-hkunnr = gs_kna11-kunnr.

gs_final1-txt5 = gs_kna11-name1.

ENDLOOP.

And i want to modify GT_final1 how would i do it.

If i am using MODIFY statement its giving me a dump.

Thanks in advance.

Regards

Rock

6 REPLIES 6
Read only

Former Member
0 Likes
619

if you want to append gs_finla1 new line to gt_final1, then use append gs_final1 to gt_final1.

if you want to modify an existing record in gs_final1 then you have to use

modify gt_final1 from gs_final1.

Please go through the Help for modify statement for other options that you can use with modify.

Thanks.

Read only

Former Member
0 Likes
619

Try this:

LOOP AT gt_kna11 INTO gs_kna11.

gs_final1-hkunnr = gs_kna11-kunnr.

gs_final1-txt5 = gs_kna11-name1.

MODIFY GT_FINAL1 FROM GS_FINAL1 TRANSPORTING HKUNNR TXT5.

ENDLOOP.

Read only

0 Likes
619

Hey,

Its giving me a short dump saying table illegal statement.

Regards

Rock

Read only

0 Likes
619

Doesn't this work:

LOOP AT gt_kna11 INTO gs_kna11.
  gs_final1-hkunnr = gs_kna11-kunnr.
  gs_final1-txt5 = gs_kna11-name1.
  MODIFY TABLE gt_kna11 FROM gs_kna11 TRANSPORTING hkunnr txt5.
ENDLOOP.

Rob

Read only

Former Member
0 Likes
619

HI,

You can use code below :


LOOP AT gt_kna11 INTO gs_kna11.
  gs_final1-hkunnr = gs_kna11-kunnr.
  gs_final1-txt5 = gs_kna11-name1.
  MODIFY TABLE gt_kna11 FROM gs_kna11 TRANSPORTING hkunnr txt5.
ENDLOOP.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
619

Hello Rock,

Could you please give more details like, the structure of gt_final1, what data does this consist while your modifying etc...

To modify an internal table which already has a data, first get that particular record to be modified into a workarea or get the index of the record you wish to modify.

Then you can use the modify statement using the additions like 'FROM', 'INDEX', 'TRANSPOSRTING' etc...

The F1 help is much more useful in this context.

Please verify the same.

Regards,

Pavan