2010 Mar 26 10:17 AM
Hi Experts,
I have a small query, modify statment is not working properly, Maybe my syntax wrong. Kindly suggest me.
DESCRIBE TABLE it_marc1 LINES count.
IF count = 1.
LOOP AT it_marc INTO wa_marc where sernp ne space.
READ TABLE it_stpo INTO wa_stpo WITH KEY idnrk = wa_marc-matnr.
IF sy-subrc = 0.
wa_stpo-potx2 = c_primary.
MODIFY table it_stpo FROM wa_stpo TRANSPORTING potx2.
ENDIF.
ENDLOOP.
ENDIF.
Mohana
2010 Mar 26 10:21 AM
Hi Mohana,
Try this.
Specify a "WHERE" clause in the MODIFY statement and it will work.
The MODIFY statement without "WHERE" clause will work only within a LOOP statement. For "READ" statements it works correctly with the "WHERE" clause.
Hope this may be helpful.
Regards,
Sharin.
Hi,
You need to mention which row of the table to modify as shown below using the key word index. i is the row number.
READ TABLE it_stpo INTO wa_stpo WITH KEY idnrk = wa_marc-matnr.
IF sy-subrc = 0.
i = sy-tabix.
MODIFY table it_stpo Index i FROM wa_stpo TRANSPORTING potx2.
Thanks
Mani
2010 Mar 26 10:20 AM
Hello,
Add the index addition and check
DESCRIBE TABLE it_marc1 LINES count.
IF count = 1.
LOOP AT it_marc INTO wa_marc where sernp ne space.
READ TABLE it_stpo INTO wa_stpo WITH KEY idnrk = wa_marc-matnr.
IF sy-subrc = 0.
wa_stpo-potx2 = c_primary.
MODIFY table it_stpo FROM wa_stpo TRANSPORTING potx2 INDEX sy-index. " here
ENDIF.
ENDLOOP.
ENDIF.
Vikranth
2010 Mar 26 10:21 AM
Hi Mohana,
Try this.
Specify a "WHERE" clause in the MODIFY statement and it will work.
The MODIFY statement without "WHERE" clause will work only within a LOOP statement. For "READ" statements it works correctly with the "WHERE" clause.
Hope this may be helpful.
Regards,
Sharin.
2010 Mar 26 10:26 AM
Hi,
You need to mention which row of the table to modify as shown below using the key word index. i is the row number.
READ TABLE it_stpo INTO wa_stpo WITH KEY idnrk = wa_marc-matnr.
IF sy-subrc = 0.
i = sy-tabix.
MODIFY table it_stpo Index i FROM wa_stpo TRANSPORTING potx2.
Thanks
Mani
2010 Mar 26 10:44 AM
Do like following it will work
DATA : l_index TYPE SY-TABIX.
DESCRIBE TABLE it_marc1 LINES count.
IF count = 1.
CLEAR l_index .
LOOP AT it_marc INTO wa_marc where sernp ne space.
l_index = l_index + 1.
CLEAR wa_stpo.
READ TABLE it_stpo INTO wa_stpo WITH KEY idnrk = wa_marc-matnr.
IF sy-subrc = 0.
wa_stpo-potx2 = c_primary.
MODIFYit_stpo INDEX l_index FROM wa_stpo TRANSPORTING potx2.
ENDIF.
ENDLOOP.
ENDIF.
2010 Mar 26 10:50 AM
Problem solved,
MODIFY it_stpo FROM wa_stpo TRANSPORTING potx2 where idnrk = wa_marc-matnr.
Thanks for you all inputs.
2010 Mar 26 10:51 AM
Hi mohana......
you just change your modify
MODIFY table it_stpo FROM wa_stpo TRANSPORTING potx2.
with this
MODIFY it_stpo FROM wa_stpo TRANSPORTING potx2.
delete table....only MODIFY
Regards
Marco
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |