Application Development 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: 

Updating internal table

Former Member
0 Kudos
150

Hi Experts,

Please help me,

Here i have final internal table with all my fields except one description field.

I need to fetch that from another table and i have to update correspondingly.

Can any one tell me how to do that.

Right now my data as below:

Materialno description deptno section

101 1 xyz

102 2 pqr

Now i don't have description field in my final internal table. now i have to pick up from another table and i have to update correspondingly,

Thanks and regards,

9 REPLIES 9

Former Member
0 Kudos
120

hi,

use modify internal table transporting statement.

eg:

PARAMETERS: p_carrid TYPE sflight-carrid,

p_connid TYPE sflight-connid,

p_plane1 TYPE sflight-planetype,

p_plane2 TYPE sflight-planetype.

DATA sflight_tab TYPE SORTED TABLE OF sflight

WITH UNIQUE KEY carrid connid fldate.

DATA sflight_wa TYPE sflight.

SELECT *

FROM sflight

INTO TABLE sflight_tab

WHERE carrid = p_carrid AND

connid = p_connid.

sflight_wa-planetype = p_plane2.

MODIFY sflight_tab FROM sflight_wa

TRANSPORTING planetype WHERE planetype = p_plane1.

Edited by: guest on Jan 27, 2009 10:00 AM

Former Member
0 Kudos
120

Try like this.

Loop at final table.

Read table with key matertial no. ( another table which contain description )

Move value into final table field.

Modify final table

Endloop.

Hope this helps...

Former Member
0 Kudos
120

Hi Amit,

Use this code:

Let us suppose u have the initial data in ITAB.

data: l_maktx type maktx.

Loop at ITAB.

select maktx into l_maktx

from mara

where matnr = ITAB-MATNR.

if sy-subrc = 0.

ITAB-MAKTX = l_MAKTX.

MODIFY ITAB.

endif.

clear l_maktx.

endloop.

Hope this will help you.

Regards,

Vinod.

Former Member
0 Kudos
120

Hi,

Use MODIFY statement to append the description to the final itab.

This is link for sample code,

http://help.sap.com/saphelp_40b/helpdata/en/fc/eb37b2358411d1829f0000e829fbfe/content.htm

Hope this helps you.

Former Member
0 Kudos
120

Loop at your final internal table int_final into

work area wa_final.

Read other table into int_other into work area

wa_other with key field = key field of your wa_final.

If sy-subrc = 0.

Take the description field in wa_final-desc = wa_other u2013desc.

Then modify int_final with wa_final transporting desc.

Endif.

Endloop.

Hopefully it helps you.

Thanks,

Sanjeet

former_member222860
Active Contributor
0 Kudos
120

Hi,

write ur query using inner-join.

data: begin of itab occurs 0,
        matnr like mara-matnr,
        maktx like makt-maktx,
      end of itab.

select * into corresponding fields of table itab
from ( mara as a
  inner join makt as b on a~matnr = b~matnr ).


loop at itab.
 write:/ itab-matnr, itab-maktx.
endloop.

thanks\

Mahesh

Former Member
0 Kudos
120

Hi

Check out Modify Statements at: [Modify|http://help.sap.com/abapdocu/en/ABAPMODIFY_ITAB.htm]

Loop at itab2 into wa2.                                               " Loop at your final itab

modify itab1 from wa2 transporting description.            " Change your first itab according to final wa

Endloop.

Hope this helps

Regards,

Jayanthi.K

Former Member
0 Kudos
120

Hi,

LOOP AT it_desc INTO wa_desc.
  wa_final-description = wa_desc-description.
  MODIFY it_final FROM wa_final
  TRANSPORTING description
  WHERE material_no = wa_desc-material_no. "If you have other keys use those also
ENDLOOP.

Regards,

Manoj Kumar P

Former Member
0 Kudos
120

hi,u can do like this

1.loop on first table

2.inside loop using key(the one ur using to fetch the decription should b in the first table),get the values inser into the first table.modify it.