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

help in abap code logic

Former Member
0 Likes
1,114

hallow

i have two tables that i wont to move the data(price) to third table itab

i wont to now how i can do that?

<b>i reward kindly</b>

i give the tabls.

INTAB_A132[]

resrc date knumh

0000123456 20070101 0000014834

0000123456 20070601 0000014835

2) intab_konp

knumh (key) kbetr(price)

0000014834 200000.00

0000014834 250000.00

this is what i have in table zempkostlprice_rec and i wont to add price colman

zempkostlprice_rec

rserc date

1 0000123456 012007

2 0000123456 022007

3 0000123456 032007

4 0000123456 042007

5 0000123456 052007

6 0000123456 062007

7 0000123456 072007

8 0000123456 082007

9 0000123456 092007

10 0000123456 102007

11 0000123456 112007

12 0000123456 122007

13 0000123456 012008

this is what i wont to add price colman to thired table from intab_konp

u can see that price have to be change after 01062007 to 250000

resrc date price

<b>1 0000123456 012007 20000.00</b>

2 0000123456 01022007 20000.00

3 0000123456 01032007 20000.00

4 0000123456 01042007 20000.00

5 0000123456 01052007 20000.00

<b>6 0000123456 01062007 250000.00</b>

7 0000123456 01072007 250000.00

8 0000123456 01082007 250000.00

9 0000123456 01092007 250000.00

10 0000123456 01102007 250000.00

11 0000123456 01112007 250000.00

12 0000123456 01122007 250000.00

13 0000123456 01 012008 250000.00

hi itry with that code but its not working i get in colman 2000000 in all rows

i thihk i have to take care in dates but i dont now how?

regards

LOOP AT zempkostlprice_rec INTO wa_zem.

READ TABLE intab_a132 INTO wa_intab_a132 WITH KEY resrc = wa_zem-resrc.

READ TABLE intab_konp INTO wa_intab_konp WITH KEY knumh = wa_intab_a132-knumh.

IF sy-subrc = 0.

wa_zem-kbetr = wa_intab_konp-kbetr.

MODIFY zempkostlprice_rec FROM wa_zem TRANSPORTING kbetr.

ENDIF.

ENDLOOP.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,077

see for adding price fields u need to pass first the price and quantity fields to string then use the 'write to' statement ..................

reward points if helpful

10 REPLIES 10
Read only

Former Member
0 Likes
1,078

see for adding price fields u need to pass first the price and quantity fields to string then use the 'write to' statement ..................

reward points if helpful

Read only

Former Member
0 Likes
1,077

plz experts

i need help im stuck

thankes

Read only

0 Likes
1,077

Thanks for ur points but i think still u havnt get ur answers correct.

Let me know proper requirements.

Regards,

Vimal

Read only

0 Likes
1,077

Create a new zprogram and put this code and check the values of internal tables in debugging mode

the price value chages according to knumh value becoz u have given intab_konp table which has common knumh so using this field only we can modify in ur zemp* table.

----


REPORT ZSHYTAL.

TYPES: BEGIN OF t_a132,

resrc LIKE a132-resrc,

kostl LIKE a132-kostl,

datbi LIKE a132-datbi,

datab LIKE a132-datab,

knumh LIKE a132-knumh,

END OF t_a132.

TYPES: BEGIN OF t_konp,

knumh LIKE konp-knumh,

kstbm LIKE konp-kstbm,

kbetr LIKE konp-kbetr,

konwa TYPE konp-konwa,

END OF t_konp.

types: begin of t_zemp,

RESRC like a132-resrc,

KOSTL LIKE a132-kostl,

kstbm LIKE konp-kstbm,

konwa TYPE konp-konwa,

kbetr LIKE konp-kbetr,

knumh LIKE konp-knumh,

END OF t_zemp.

DATA: intab_konp TYPE TABLE OF t_konp WITH HEADER LINE .

DATA : intab_a132 TYPE TABLE OF t_a132 WITH HEADER LINE .

data: it_zemp type TABLE OF t_zemp WITH HEADER LINE.

it_zemp-resrc = '0000123456'.

it_zemp-knumh = '0000014834'.

APPEND it_zemp.

it_zemp-resrc = '0000123456'.

it_zemp-knumh = '0000014834'.

APPEND it_zemp.

it_zemp-resrc = '0000123456'.

it_zemp-knumh = '0000014835'.

APPEND it_zemp.

intab_a132-resrc = '0000123456'.

intab_a132-knumh = '0000014834'.

intab_a132-datbi = '20070531'.

intab_a132-datab = '20070101'.

APPEND intab_a132.

intab_a132-resrc = '0000123456'.

intab_a132-knumh = '0000014835'.

intab_a132-datbi = '200701231'.

intab_a132-datab = '20070601'.

APPEND intab_a132.

intab_konp-knumh = '0000014834'.

intab_konp-kbetr = '20000'.

APPEND intab_konp.

intab_konp-knumh = '0000014835'.

intab_konp-kbetr = '25000'.

APPEND intab_konp.

clear: intab_konp, intab_a132, it_zemp.

LOOP at it_zemp. "into wa_zemp.

READ TABLE intab_a132 WITH KEY resrc = it_zemp-resrc.

READ TABLE intab_konp WITH key knumh = it_zemp-knumh.

if sy-subrc eq 0.

move intab_konp-kbetr to it_zemp-kbetr.

modify it_zemp." from wa_zemp.

ENDIF.

endloop.

Read only

0 Likes
1,077

ho vimal

as u see i ahve in table zempkostlprice_rec fields date maybe i can use it becouse

the price is change in 01062007 and from this date the price is 2500000

i do some abap program but i never have problem like that

i look simple that is the problem

thankes for your time.

regards

Read only

0 Likes
1,077

hi vimal

there is more detail that u wont?

Regards

Read only

0 Likes
1,077

You are saying tht the values changes with response to date right.

can we hard code the value

LOOP at it_zemp. "into wa_zemp.

READ TABLE intab_a132 WITH KEY resrc = it_zemp-resrc.

READ TABLE intab_konp WITH key knumh = it_zemp-knumh.

if sy-subrc eq 0.

<b> if it_zemp-date <= '01062007'. " this is hard code as per date.

it_zemp-kbetr = '2000000'.

modify it_zemp.

else

it_zemp-kbetr = '25000000'.

modify it_zemp.

endif.</b> ENDIF.

endloop.

<b>but i think this hardcode should not be done.</b>

give ur spec i will go through it. let u know.

Regards,

Vimal

Read only

0 Likes
1,077

hi vimal

hard code is not helping becouse the tables all time change

there is no way to solve it in abap?

Regards

Read only

Former Member
0 Likes
1,077

try out this



LOOP AT zempkostlprice_rec INTO wa_zem.

READ TABLE intab_a132 INTO wa_intab_a132 WITH KEY resrc = wa_zem-resrc.
READ TABLE intab_konp INTO wa_intab_konp WITH KEY knumh = wa_intab_a132-knumh.


IF sy-subrc = 0.

wa_zem-kbetr = wa_intab_konp-kbetr.

MODIFY zempkostlprice_rec FROM wa_zem TRANSPORTING kbetr where zempkostlprice_rec = wa_zem-resrc .

ENDIF.

ENDLOOP. 

regards.

Vijaykumar reddy. S

Read only

Former Member
0 Likes
1,077

plz any one

i have big problem with that to much hours plz

can some one help to me or give idea

thankes