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: 

HELP IN CODE FOR EXPERTS

Former Member
0 Kudos

HALLOW

hallow

i have two tables that i wont to move the data(price) from first table INTAB_A132

to table zempkostlprice_rec. in table zempkostlprice_rec i have 2 colman one is date and resrc and i wont to add from table INTAB_A132 the price to zempkostlprice_rec .

i give example.

<b>REMOVED BY MODERATOR</b>

i give the tables.

INTAB_A132

resrc date kbetr(price)

0000123456 20070101 20.0000

0000123456 20070601 25.0000

the date mean that from 01012007 until 01062007 the price where 20.0000

this is what i have in table right now zempkostlprice_rec and i wont to add price colman from INTAB_A132

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

1 0000123456 012007 20000.00

2 0000123456 01022007 20000.00

3 0000123456 01032007 20000.00

4 0000123456 01042007 20000.00

5 0000123456 01052007 20000.00

6 0000123456 01062007 250000.00

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

I TRY WIT THAT CODE BUT I GET JUST PRICE WHERE DATE > 01062007

I WONT ALSO WHEN DATE LESS THEN 01062007 WHERE PRICE 20.00000

(i use the function to cahnge the format of day to be the same format in both table)

LOOP AT zempkostlprice_rec INTO wa_zem.

READ TABLE intab_a132 INTO wa_intab_a132.

CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'

EXPORTING

date_external = wa_zem-date

IMPORTING

date_internal = tmp_date.

IF wa_intab_a132-datab LE tmp_date.

MOVE: wa_intab_a132-kbetr TO wa_zem-kbetr.

MODIFY zempkostlprice_rec FROM wa_zem TRANSPORTING kbetr .

CLEAR:wa_zem,wa_intab_a132.

ENDIF.

ENDLOOP.

0000123456 012007 0.00

0000123456 022007 0.00

0000123456 032007 0.00

0000123456 042007 0.00

0000123456 052007 0.00

0000123456 062007 250000.00

0000123456 072007 250000.00

0000123456 082007 250000.00

0000123456 092007 250000.00

0000123456 102007 250000.00

0000123456 112007 250000.

regards

Message was edited by:

Alvaro Tejada Galindo

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hi snaya

if u do else if the date GE modify with next data from intab_a132.

Regards

11 REPLIES 11

Former Member
0 Kudos

hi frinds

plz some one can give me any sugsstion i am stuck?

Regards

0 Kudos

hi

u try what i post in your first message?

Rodrigo-Giner
Active Contributor
0 Kudos

If u want to pass the value of the column price without any condition to one table to another this is how.

LOOP AT zempkostlprice_rec INTO wa_zem.

READ TABLE intab_a132 WITH KEY rserc = zempkostlprice_rec-rserc INTO wa_intab_a132.

IF sy-subrc = 0.

CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'

EXPORTING

date_external = wa_zem-date

IMPORTING

date_internal = tmp_date.

wa_zem-kbetr = wa_intab_a132-kbetr.

MODIFY zempkostlprice_rec FROM wa_zem.

ENDIF.

CLEAR: wa_zem, wa_intab_a132.

ENDLOOP.

Greetings ^^

0 Kudos

hi rodrigo

thankes for your replay!!!

if u can see i have in tables all time the same rserc

do u think that is solved my problem?(i think it bring the same results)

Best Regards

0 Kudos

sorry, now I notice that u even dont care the date. copy my code, i mistype the field resrc bc u wrote it wrong the first time.

Check the "coment I put example of the first line

LOOP AT zempkostlprice_rec INTO wa_zem. " zempkostlprice_rec-resrc = 0000123456

READ TABLE intab_a132 WITH KEY resrc = zempkostlprice_rec-rserc INTO wa_intab_a132. "if it find any rserc = 0000123456 in the table itab_a132 -> sy-subrc = 0.

IF sy-subrc = 0. " wa_intab_a132-kbetr = 20.0000

wa_zem-kbetr = wa_intab_a132-kbetr. "pass the value -> wa_zem-kbetr = 20.0000

MODIFY zempkostlprice_rec FROM wa_zem. " Modify the table.

ENDIF.

CLEAR: wa_zem, wa_intab_a132.

ENDLOOP.

0 Kudos

hi rodrigo

thankes again

i think it have problem becouse u dont refer to date like i do in my code and rserc

its always the same in 2 tables i think that the field that can help is the date as u can see from 010107 until 010607 the price is 200000 and from 010607 the price is 250000 in my code i refer to date but i do it partly .

maybe u can give me idea .

here if i do like u tell it delete the record after 010607and put thier 200000 insted 250000.

Best Regards

0 Kudos

What do you need ?

I tought that you only need moving one field (price) from a internal table to another, this is ok ? or there is a date condition about moving a value or not ?

Former Member
0 Kudos

hi expert

plz if u think i cant solve it let me now i try to find soltion in forum from morning and i cant

plz help

<b><REMOVED BY MODERATOR></b>

Message was edited by:

Alvaro Tejada Galindo

Former Member
0 Kudos

hi snaya

if u do else if the date GE modify with next data from intab_a132.

Regards

0 Kudos

hi antonio

thankes 4 your replay!

i try it but it delete all price that i have and put 200000 in all price?

that is my problem.

Regards

Former Member
0 Kudos

hi

any idea plz ?

thankes