‎2007 Sep 05 6:23 AM
Hi Experts ,
The requirement Is like this ??
Im Having N of Items In Sales order ?
wats my questions is ? if i do any changes for the items in sales order . it has to give Error Log issue.
For this i had written code like this ?
SELECT vbeln posnr
FROM vbap
INTO TABLE t_vbap
WHERE vbeln = com_kbv1-vbeln.
DESCRIBE TABLE t_vbap LINES n.
CHECK sy-subrc EQ 0.
CLEAR tp_vbap.
SELECT matnr
kwmeng
werks
lgort
FROM vbap
INTO tp_vbap
UP TO n ROWS
WHERE vbeln = com_kbv1-vbeln.
IF sy-subrc EQ 0.
EXIT.
ENDIF.
ENDSELECT
First it Initial checks the how many items are der for that Sales oder ?
Then it wil checks any changes have been done for the Items are not ?
Here my logic is working for Only for First Item Only ??
if i try 2 do any changes for the second item its not giving any error ?
How 2 solve this ????
Regs
Murthy
‎2007 Sep 05 6:28 AM
SELECT vbeln posnr
FROM vbap
INTO TABLE t_vbap
WHERE vbeln = com_kbv1-vbeln.
DESCRIBE TABLE t_vbap LINES n.
CHECK sy-subrc EQ 0.
<b>LOOP AT t_VBAP.</b>
CLEAR tp_vbap.
SELECT matnr
kwmeng
werks
lgort
FROM vbap
INTO table tp_vbap
UP TO n ROWS
<b>For ALL ENTRIES IN t_VBAP</b>
<b>WHERE vbeln = t_VBAP-vbeln.</b>
IF sy-subrc EQ 0.
EXIT.
ENDIF.
<b>ENDLOOP.</b>
‎2007 Sep 05 7:03 AM
Dear Narayna ,
Use this :
SELECT vbeln posnr
FROM vbap
INTO TABLE t_vbap
WHERE vbeln = com_kbv1-vbeln.
clear tp_vbap.
if t_vbap[] is not initial.
SELECT matnr
kwmeng
werks
lgort
FROM vbap
INTO tp_vbap
for ALL ENTRIES of t_vbap
WHERE vbeln = t-vbap-vbeln .
IF sy-subrc EQ 0.
EXIT.
ENDIF.
endif.
clear t_vbap.
ENDSELECT
reward if useful.
regards
Amit singla
‎2007 Sep 05 7:06 AM
Dear Narayna ,
Use this :
SELECT vbeln posnr
FROM vbap
INTO TABLE t_vbap
WHERE vbeln = com_kbv1-vbeln.
clear tp_vbap.
if t_vbap[] is not initial.
SELECT matnr
kwmeng
werks
lgort
FROM vbap
INTO tp_vbap
for ALL ENTRIES of t_vbap
WHERE vbeln = t-vbap-vbeln and
posnr = t-vbap-posnr.
IF sy-subrc EQ 0.
EXIT.
ENDIF.
endif.
clear t_vbap.
ENDSELECT
reward if useful.
regards
Amit singla