‎2007 Sep 17 4:05 PM
hallow
i have 2 table and i wont to modify table ZEMPKOSTLPRICE_REC with fields from intab_a132 how i do that?
<b>i reward kindly</b>
table INTAB_A132
resrc kostel datbi datab knumh kbetr
1302161XZ 1000-162 <b>20071231 20070201</b> 0000014848 1000.00
1302161XZ 1000-163 <b>20071231 20070401</b> 0000014849 2000.00
table ZEMPKOSTLPRICE_REC <b>what i have</b>
resrc kostl kbetr date
1302161XZ 20070201
1302161XZ 20070301
1302161XZ 20070401
1302161XZ 20070501
1302161XZ 20070601
1302161XZ 20070701
1302161XZ 20070801
1302161XZ 20070901
1302161XZ 20071001
1302161XZ 20071101
1302161XZ 20071201
1302161XZ 20070401
1302161XZ 20070501
1302161XZ 20070601
1302161XZ 20070701
1302161XZ 20070801
1302161XZ 20070901
1302161XZ 20071001
1302161XZ 20071101
1302161XZ 20071201
table
ZEMPKOSTLPRICE_REC <b>after what i wont</b>
resrc kostl kbetr date
1302161XZ 1000-162 1000.00 20070201
1302161XZ 1000-162 1000.00 20070301
1302161XZ 1000-162 1000.00 20070401
1302161XZ 1000-162 1000.00 20070501
1302161XZ 1000-162 1000.00 20070601
1302161XZ 1000-162 1000.00 20070701
1302161XZ 1000-162 1000.00 20070801
1302161XZ 1000-162 1000.00 20070901
1302161XZ 1000-162 1000.00 20071001
1302161XZ 1000-162 1000.00 20071101
1302161XZ 1000-162 1000.00 20071201
1302161XZ 1000-163 2000.00 20070401
1302161XZ 1000-163 2000.00 20070501
1302161XZ 1000-163 2000.00 20070601
1302161XZ 1000-163 2000.00 20070701
1302161XZ 1000-163 2000.00 20070801
1302161XZ 1000-163 2000.00 20070901
1302161XZ 1000-163 2000.00 20071001
1302161XZ 1000-163 2000.00 20071101
1302161XZ 1000-163 2000.00 20071201
Regards
‎2007 Sep 17 4:10 PM
You can write simple logic :
loop at ZEMPKOSTLPRICE_REC .
read table INTAB_A132 with key resrc = ZEMPKOSTLPRICE_REC-resrc
kostel = ZEMPKOSTLPRICE_REC -kostel
datab = ZEMPKOSTLPRICE_REC-date.
if sy-subrc eq 0.
move values INTAB_A132 to ZEMPKOSTLPRICE_REC .
modify table ZEMPKOSTLPRICE_REC .
endif.
endloop.
Thanks
Seshu
‎2007 Sep 17 4:10 PM
You can write simple logic :
loop at ZEMPKOSTLPRICE_REC .
read table INTAB_A132 with key resrc = ZEMPKOSTLPRICE_REC-resrc
kostel = ZEMPKOSTLPRICE_REC -kostel
datab = ZEMPKOSTLPRICE_REC-date.
if sy-subrc eq 0.
move values INTAB_A132 to ZEMPKOSTLPRICE_REC .
modify table ZEMPKOSTLPRICE_REC .
endif.
endloop.
Thanks
Seshu
‎2007 Sep 17 4:17 PM
hi seshu
thankes for your answer
i try your logic like below but every time subrc = 4.
what is wrong?
LOOP AT zempkostlprice_rec INTO wa_zem.
READ TABLE intab_a132 WITH KEY resrc = wa_zem-resrc
kostl = wa_zem-kostl
datab = wa_zem-date.
IF sy-subrc EQ 0.
MOVE: wa_intab_a132-kostl TO wa_zem-kostl,
wa_intab_a132-kbetr TO wa_zem-kbetr,
wa_intab_a132-konwa TO wa_zem-konwa.
MODIFY zempkostlprice_rec FROM wa_zem TRANSPORTING kbetr konwa kostl.
ENDIF.
ENDLOOP.
‎2007 Sep 17 4:16 PM
Hi,
Please try this.
data: wa_ZEMPKOSTLPRICE_REC type ZEMPKOSTLPRICE_REC .
loop at INTAB_A132.
wa_ZEMPKOSTLPRICE_REC-resrc = INTAB_A132-resrc.
wa_ZEMPKOSTLPRICE_REC-kostl = INTAB_A132-kostl.
wa_ZEMPKOSTLPRICE_REC-kbetr = INTAB_A132-kbetr.
wa_ZEMPKOSTLPRICE_REC-date = INTAB_A132-datab.
modify ZEMPKOSTLPRICE_REC from wa_ZEMPKOSTLPRICE_REC.
endloop.
Regards,
Ferry Lianto
‎2007 Sep 17 4:29 PM
hi ferry
thankes for your replay
i try your code but i have <b>dump</b> in modify
regards
‎2007 Sep 17 4:18 PM
Hi tal,
1. like this :
2.
data : tabix type sy-tabix.
*----
Loop at table
Loop at ZEMPKOSTLPRICE_REC .
<b>tabix = sy-tabix.</b>
*---- Find the record
Read table INTAB_A132 with key <b>field1 = ZEMPKOSTLPRICE_REC-field1</b>.
If sy-subrc = 0.
ZEMPKOSTLPRICE_REC-field3 = INTAB_A132-field3.
ZEMPKOSTLPRICE_REC-field4 = INTAB_A132-field4.
<b>modify ZEMPKOSTLPRICE_REC index tabix.</b>
endloop.
Endloop.
regards,
amit m.
‎2007 Sep 17 4:27 PM
hi amit
thankes for your replay
what do u mean with field 1 field 2 field 3?
regards
‎2007 Sep 17 4:36 PM
Hi,
Please try to use UPDATE statement instead.
data: wa_ZEMPKOSTLPRICE_REC type ZEMPKOSTLPRICE_REC .
loop at INTAB_A132.
wa_ZEMPKOSTLPRICE_REC-resrc = INTAB_A132-resrc.
wa_ZEMPKOSTLPRICE_REC-kostl = INTAB_A132-kostl.
wa_ZEMPKOSTLPRICE_REC-kbetr = INTAB_A132-kbetr.
wa_ZEMPKOSTLPRICE_REC-date = INTAB_A132-datab.
update ZEMPKOSTLPRICE_REC from wa_ZEMPKOSTLPRICE_REC.
endloop.
What are the key fields in table ZEMPKOSTLPRICE_REC?
Regards,
Ferry Lianto
‎2007 Sep 17 4:45 PM
hi ferry
thankes for your replay
the key fields is resrc(1302161XZ) and datab(20070201,20070401).
as u see i just wont to modify table ZEMPKOSTLPRICE_REC
with field kbetr(price) and kostl ,and take care of dates <b>from 01.02.2007 until 31.12.2007</b>price was 1000.00 kostl 1000-162
and from date<b> 01.04.2007 until 31.12.2007</b> kbetr 2000.00 1000-163
regards
‎2007 Sep 17 4:54 PM
Hi,
Please try this.
loop at INTAB_A132.
UPDATE ZEMPKOSTLPRICE_REC
SET: KOSTL = INTAB_A132-KOSTL,
KBETR = INTAB_A132-KBETR
WHERE RESRC = INTAB_A132-RESRC
AND DATE = INTAB_A132-DATAB.
endloop.
Regards,
Ferry Lianto
‎2007 Sep 17 5:05 PM
hi ferry
thankes for your time
i try your code but when i try with update i have erorr
"ZEMPKOSTLPRICE_REC" is not defined in the ABAP Dictionary as a table, projection view, or database view.
and when i change it to modify i have erorr in set
"PROPERTY OF ... parameter" expected, not "KOSTL".
best regards
‎2007 Sep 17 5:09 PM
Hi,
How did you create custom table ZEMPKOSTLPRICE_REC in SE11?
Was it as transparent table?
Regards,
Ferry Lianto
‎2007 Sep 17 5:16 PM
hi ferry
i buield structre in se 11 .
when i put modify i dont have erorr .
i have problem with set to .
thankes for your answers i dont now what to do i stuck
‎2007 Sep 17 5:28 PM
hi ferry
i try like that
DATA : tabix TYPE sy-tabix.
LOOP AT zempkostlprice_rec INTO wa_zem .
tabix = sy-tabix.
READ TABLE intab_a132 INTO wa_intab_a132 WITH KEY datab = wa_zem-date.
IF wa_intab_a132-datab LE wa_zem-date.
MOVE: wa_intab_a132-kostl TO wa_zem-kostl,
wa_intab_a132-kbetr TO wa_zem-kbetr,
wa_intab_a132-konwa TO wa_zem-konwa.
MODIFY zempkostlprice_rec FROM wa_zem INDEX tabix TRANSPORTING kbetr konwa kostl .
ENDIF.
ENDLOOP.
and what i get
1,000.00 1000-162 07.0220 1302161XZ
1,000.00 1000-162 07.0320 1302161XZ
2,000.00 1000-163 07.0420 1302161XZ
2,000.00 1000-163 07.0520 1302161XZ
2,000.00 1000-163 07.0620 1302161XZ
2,000.00 1000-163 07.0720 1302161XZ
2,000.00 1000-163 07.0820 1302161XZ
2,000.00 1000-163 07.0920 1302161XZ
2,000.00 1000-163 07.1020 1302161XZ
2,000.00 1000-163 07.1120 1302161XZ
2,000.00 1000-163 07.1220 1302161XZ
1,000.00 1000-162 07.0220 1302161XZ
1,000.00 1000-162 07.0320 1302161XZ
2,000.00 1000-163 07.0420 1302161XZ
2,000.00 1000-163 07.0520 1302161XZ
2,000.00 1000-163 07.0620 1302161XZ
2,000.00 1000-163 07.0720 1302161XZ
2,000.00 1000-163 07.0820 1302161XZ
2,000.00 1000-163 07.0920 1302161XZ
2,000.00 1000-163 07.1020 1302161XZ
2,000.00 1000-163 07.1120 1302161XZ
2,000.00 1000-163 07.1220 1302161XZ
‎2007 Sep 17 5:19 PM
Hi,
Are you sure table ZEMPKOSTLPRICE_REC is a structure?
If it is then you can not save any data into table structure.
Please try to create a transparent table instead.
Regards,
Ferry Lianto
‎2007 Sep 17 5:33 PM
hi ferry
sorry here its what i get organized better
1302161XZ 1000-162 1000.00 20070201
1302161XZ 1000-162 1000.00 20070301
1302161XZ 1000-163 2000.00 20070401
1302161XZ 1000-163 2000.00 20070501
1302161XZ 1000-163 2000.00 20070601
1302161XZ 1000-163 2000.00 20070701
1302161XZ 1000-163 2000.00 20070801
1302161XZ 1000-163 2000.00 20070901
1302161XZ 1000-163 2000.00 20071001
1302161XZ 1000-163 2000.00 20071101
1302161XZ 1000-163 2000.00 20071201
1302161XZ 1000-162 1000.00 20070201
1302161XZ 1000-162 1000.00 20070301
1302161XZ 1000-163 2000.00 20070401
1302161XZ 1000-163 2000.00 20070501
1302161XZ 1000-163 2000.00 20070601
1302161XZ 1000-163 2000.00 20070701
1302161XZ 1000-163 2000.00 20070801
1302161XZ 1000-163 2000.00 20070901
1302161XZ 1000-163 2000.00 20071001
1302161XZ 1000-163 2000.00 20071101
1302161XZ 1000-163 2000.00 20071201
regards
‎2007 Sep 17 5:50 PM
Hi,
It seems you want to modify an internal table ZEMPKOSTLPRICE_REC instead of database table ZEMPKOSTLPRICE_REC (I misunderstood).
Do you still have a problem with modification content of an internal table ZEMPKOSTLPRICE_REC?
Regards,
Ferry Lianto
‎2007 Sep 17 6:00 PM
hi ferry
when i try to modify with code i use below its o.k. i dont have erorr
and i get part of the salotion. i wont for two period i get the same data
like my first post maybe u can help with that?
the problem is that it not simple as it look.
Best regards
‎2007 Sep 17 6:10 PM
Hi,
I don't think you can do that since there will be an overlap on dates.
Also there are no unique key fields other than both fields RESRC and DATE.
Regards,
Ferry Lianto
‎2007 Sep 17 6:21 PM