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

ABAP program .......

Former Member
0 Likes
554

Hi all,

I have problem, but don't know how to do, pls give me any solution.

My problem : I have internal table have data, EX:

Ass Code   Asset Name   Cost center  Amount  CO1    CO2       CO3 .......
211200000   A machine       CO3       100                               
211200010   B machine       CO2       200
......

Now, I want to assign Amount value to CO1,CO2,CO3 ........ as:

Asset Code    Asset Name   Cost center  Amount  CO1    CO2       CO3 .......
2112000        A machine       CO3       100                    100
2112001        B machine       CO2       200          200
......

Pls tell me how to do it

4 REPLIES 4
Read only

Former Member
0 Likes
496

loop at itab.

v_tabix = sy-tabix.

*If itab_co has all the co data ...

read table itab_co with key Ass_Code = itab-Ass_Code.

if sy-subrc = 0.

move-corresponding itab_co to itab.

modify itab index v_tabix.

endif.

endloop.

Read only

Former Member
0 Likes
496

hi,

do this way ..

loop at itab.

if <conditions>.

itab-c01 = itab-amount.

elseif <conditions>.

itab-c02 = itab-amount.

..............

endif.

modify itab index sy-tabix transporting c01 c02 c03.

endloop.

Read only

Former Member
0 Likes
496

read table itab

into ls_itab

with key ass_code = 211200000.

ls_itab-co3 = 100.

modify itab from ls_itab.

and so on...

Read only

0 Likes
496

Thanks for all, but may be my question not clear,

I will exam again:

itab have data :

AssCode    AssName    CoCenter    Amount   Col_01   Col_02   Col_03 .......
2120000     Name 1     CO4         1000
2120001     Name 2     CO3         2000
2120002     Name 3     CO4         3000
2120003     Name 4     CO3         4000
2120004     Name 5     CO1         5000
.........

and itab_co have data:

CoCenter
CO1
CO3
CO4
CO6
CO7
....

Now, I want to have itab with filling data as this ( with CoCenter CO4 in itab_co at index 3, I will assign amount value to col_03 ...) :

AssCode    AssName    CoCenter    Amount   Col_01   Col_02   Col_03 .......
2120000     Name 1     CO4         1000                       1000
2120001     Name 2     CO3         2000              2000
2120002     Name 3     CO4         3000                       3000
2120003     Name 4     CO3         4000              4000
2120004     Name 5     CO1         5000     5000
.........

Edited by: Snow Cold on May 14, 2008 10:21 AM

Edited by: Snow Cold on May 14, 2008 10:56 AM