‎2010 Mar 17 8:24 AM
Hi,
Thank you for helping. ive got a prob whiele assinging the value to itab.
DATA: itab TYPE TABLE OF zworksorder.
DATA: lt_pmco TYPE TABLE OF pmco,
lt_pmco1 TYPE TABLE OF pmco.
DATA: wa_pmco TYPE pmco.
Data: lv_GKSTP type RIHAUFK_LIST-GKSTP.
SELECT objnr wrttp wrt00
wrt01
wrt02
wrt03
wrt04
wrt05
wrt06
wrt07
wrt08
wrt09
wrt10
wrt11
wrt12
wrt13
wrt14
wrt15
wrt16 FROM pmco INTO CORRESPONDING FIELDS OF TABLE lt_pmco
FOR ALL ENTRIES IN itab WHERE objnr = itab-objnr.
LOOP AT lt_pmco INTO wa_pmco WHERE wrttp = '01'.
COLLECT wa_pmco INTO lt_pmco1.
CLEAR:wa_pmco.
ENDLOOP.
lOOP AT LT_PMCO1 into wa_pmco.
lv_gkstp = wa_pmco-WRT00 + wa_pmco-WRT01 + wa_pmco-WRT02 + wa_pmco-WRT03 + wa_pmco-WRT04 + wa_pmco-WRT05 + wa_pmco-WRT06 + wa_pmco-WRT07 + wa_pmco-WRT08
+ wa_pmco-WRT10 + wa_pmco-WRT11 + wa_pmco-WRT12 + wa_pmco-WRT13 + wa_pmco-WRT14 + wa_pmco-wrt15 + wa_pmco-WRT16.
itab-gkstp = lv_gkstp. "problem is here i need to assing the lv_gkstp to itab-gkstp
Endloop.
Plz let me know. how to assing the total value[lv_gkstp to itab-gkstp]
Regards
‎2010 Mar 17 8:27 AM
hi,
try this
itab-gkstp = lv_gkstp.
append it_itab.
in place of..
itab-gkstp = lv_gkstp.
hope this helps
regards
Ritesh
‎2010 Mar 17 8:27 AM
hi,
try this
itab-gkstp = lv_gkstp.
append it_itab.
in place of..
itab-gkstp = lv_gkstp.
hope this helps
regards
Ritesh
‎2010 Mar 17 8:37 AM
hi,
Thank you for reply.
Ive got a total value in lv_gkstp. Now i need to assing this lv_gkstp to Itab-gkstp.
then every order number will get the total planned cost one which is lv_gkstp.
Data: itab table type of zworksorder.
Data: lv_GKSTP type RIHAUFK_LIST-GKSTP.
lOOP AT LT_PMCO1 into wa_pmco.
lv_gkstp = wa_pmco-WRT00 + wa_pmco-WRT01 + wa_pmco-WRT02 + wa_pmco-WRT03 + wa_pmco-WRT04 + wa_pmco-WRT05 + wa_pmco-WRT06 + wa_pmco-WRT07 + wa_pmco-WRT08
+ wa_pmco-WRT10 + wa_pmco-WRT11 + wa_pmco-WRT12 + wa_pmco-WRT13 + wa_pmco-WRT14 + wa_pmco-WRT15 + wa_pmco-WRT16.
itab-gkstp = lv_gkstp.
Endloop.
while appending the value to itab. its gives the error. bcoz ive declare the itab like Data: itab table type of zworksorder.
plz let me know how to assing the value to itab. while looping.
Regards
‎2010 Mar 17 8:43 AM
Hi,
Do this
LOOP AT LT_PMCO1 into wa_pmco.
"Calculation of lv_gkstp
read table itab into wa_itab index sy-tabix where key <field> = wa_pmco-<key_field>. "If itab is gonna have unique entries, then read the row based on the key field
move lv_gkstp to wa_itab-gkstp.
lv_tabix = sy-tabix.
modify itab from wa_itab index lv_tabix transporting gkstp.
ENDLOOP.
‎2010 Mar 17 8:45 AM
You are modifying itab in loop of another internal table without any modify statement
and also the declaration for lv_gkstp is different .
So how do you expect that to work ?
‎2010 Mar 17 9:10 AM
Hi,
Thank you. As u told. ive did. but iam getting the error unable to interpret where .possible causes: incorrecting spelling or comma error.
lOOP AT LT_PMCO1 into wa_pmco.
lv_gkstp = wa_pmco-WRT00 + wa_pmco-WRT01 + wa_pmco-WRT02 + wa_pmco-WRT03 + wa_pmco-WRT04 + wa_pmco-WRT05 + wa_pmco-WRT06 + wa_pmco-WRT07 + wa_pmco-WRT08
+ wa_pmco-WRT10 + wa_pmco-WRT11 + wa_pmco-WRT12 + wa_pmco-WRT13 + wa_pmco-WRT14 + wa_pmco-WRT15 + wa_pmco-WRT16.
Read table itab into wa index sy-tabix where key objnr = wa_pmco-objnr. " problem is where condition.
move lv_gkstp to wa-gkstp.
lv_tabix = sy-tabix.
modify itab from wa index lv_tabix transporting gkstp.
Endloop.
Thank you for quick respoce.
‎2010 Mar 17 9:14 AM
‎2010 Mar 17 9:15 AM
hi,
read statement dosen't work with where condition so u have 2 use "with key" in place of where .
rgds/
shivraj
‎2010 Mar 17 9:16 AM
Hi,
I made a typo in the read statement.
Sorry for that !!! You could have easily corrected the error if you had checked the documentation of READ
Read table itab into wa index sy-tabix WITH key objnr = wa_pmco-objnr. "WITH
‎2010 Mar 17 9:17 AM
Even ive used with key also
Read table itab into wa index sy-tabix with key objnr = wa_pmco-objnr.
but still gives the error.
Regards
‎2010 Mar 17 9:22 AM
Read table itab into wa index sy-tabix with key objnr = wa_pmco-objnr.Can we use both INDEX & WITH KEY addition together in the READ TABLE statement ?
‎2010 Mar 17 9:23 AM
hi,
read table itab into wa index sy-tabix.
if sy-subrc = 0 and wa-objnr = wa_pmco-objnr.
ur code.
else.
ur code
endif.
since both index and with key cannot be used together
rgds/
shivraj
Edited by: ShivrajSinha on Mar 17, 2010 10:24 AM
‎2010 Mar 17 9:24 AM
Hi,
Thank you..
Read Table itab index sy-index into wa comparing objnr.
is it right?
‎2010 Mar 17 9:42 AM
hi
Thank U
lOOP AT LT_PMCO1 into wa_pmco.
lv_gkstp = wa_pmco-WRT00 + wa_pmco-WRT01 + wa_pmco-WRT02 + wa_pmco-WRT03 + wa_pmco-WRT04 + wa_pmco-WRT05 + wa_pmco-WRT06 + wa_pmco-WRT07 + wa_pmco-WRT08
+ wa_pmco-WRT10 + wa_pmco-WRT11 + wa_pmco-WRT12 + wa_pmco-WRT13 + wa_pmco-WRT14 + wa_pmco-WRT15 + wa_pmco-WRT16.
* Read table itab into wa index sy-tabix with key objnr = wa_pmco-objnr.
Read Table itab index sy-index into wa.
if sy-subrc = 0 and wa-objnr = wa_pmco-objnr.
move lv_gkstp to wa-gkstp.
lv_tabix = sy-tabix.
modify itab from wa index lv_tabix transporting gkstp.
else.
move lv_gkstp to wa-gkstp.
lv_tabix = sy-tabix.
modify itab from wa index lv_tabix transporting gkstp.
endif.
Endloop.
but its goes to short dump.
Error analysis
When changing or deleting one or more lines of the internal table
"\PROGRAM=Z_WORK_ORDER_AGEING_REPORT\DATA=ITAB" or when inserting in the table
"\PROGRAM=Z_WORK_ORDER_AGEING_REPORT\DATA=ITAB", 0 was used as
the line index. An index less than or equal to zero is not
allowed.
‎2010 Mar 17 9:51 AM
Hello Balaji,
Read Table itab index sy-index into wa.
if sy-subrc = 0 and wa-objnr = wa_pmco-objnr.
"Your Code
else.
move lv_gkstp to wa-gkstp.
lv_tabix = sy-tabix. " Since the READ statement fails, the value of SY-TABIX = 0
modify itab from wa index lv_tabix transporting gkstp.
endif.but its goes to short dump.
Error analysis
When changing or deleting one or more lines of the internal table
"\PROGRAM=Z_WORK_ORDER_AGEING_REPORT\DATA=ITAB" or when inserting in the table
"\PROGRAM=Z_WORK_ORDER_AGEING_REPORT\DATA=ITAB", 0 was used as
the line index. An index less than or equal to zero is not
allowed.
Please try to analyze the error before blindly posting it in the forum. The error analysis clearly states why the dump has occurred.
BR,
Suhas
‎2010 Mar 17 8:44 AM
How comes you´ve posted over 100 posts and did not get a single point? Keep asking, not answering? Is that ok for you? Otto
‎2010 Mar 17 8:45 AM
Hi
In your case, it seems the both data objects type is not same.
Please try to create your itab as
data: begin of itab occurs 0.
include structure zworksorder.
data: GKSTP type RIHAUFK_LIST-GKSTP,
end of itab.
**in the loop you can assign as usual
itab-gsktp = lv_GKSTP.
append itab. Check this
Thanks
Praveen
‎2010 Mar 17 8:47 AM
DATA: itab TYPE TABLE OF zworksorder occurs 0 with header line.
DATA: lt_pmco TYPE TABLE OF pmco,
lt_pmco1 TYPE TABLE OF pmco.
DATA: wa_pmco TYPE pmco.
Data: lv_GKSTP type RIHAUFK_LIST-GKSTP.
SELECT objnr wrttp wrt00
wrt01
wrt02
wrt03
wrt04
wrt05
wrt06
wrt07
wrt08
wrt09
wrt10
wrt11
wrt12
wrt13
wrt14
wrt15
wrt16 FROM pmco INTO CORRESPONDING FIELDS OF TABLE lt_pmco
FOR ALL ENTRIES IN itab WHERE objnr = itab-objnr.
LOOP AT lt_pmco INTO wa_pmco WHERE wrttp = '01'.
COLLECT wa_pmco INTO lt_pmco1.
CLEAR:wa_pmco.
ENDLOOP.
READ TABLE it_pmco1 into wa_pmco with sy-index.
lv_gkstp = wa_pmco-WRT00 + wa_pmco-WRT01 + wa_pmco-WRT02 + wa_pmco-WRT03 + wa_pmco-WRT04 + wa_pmco-WRT05 + wa_pmco-WRT06 + wa_pmco-WRT07 + wa_pmco-WRT08
+ wa_pmco-WRT10 + wa_pmco-WRT11 + wa_pmco-WRT12 + wa_pmco-WRT13 + wa_pmco-WRT14 + wa_pmco-wrt15 + wa_pmco-WRT16.
itab-gkstp = lv_gkstp. "problem is here i need to assing the lv_gkstp to itab-gkstp
append itab.
clear: itab,lv_gkstp.
‎2010 Mar 17 10:40 AM
A lot of people tried to help you, but it seems you're not doing any local effort to resolve the problem, instead coming back with every little error you encounter. Try to help yourself first.
Thread locked for this reason.
Thomas