‎2008 Aug 22 3:19 PM
Hi,
I have to find a VBELN which have unless TWO 'Sales Document Item' (for example: POSNR=10,POSNR=20,POSNR=30) then i have to find the POSNR which have the same PS_PSP_PNR.
i did this:
SELECT PS_PSP_PNR POSNR vbeln FROM vbap
into CORRESPONDING FIELDS OF TABLE l_vbap.
LOOP AT l_vbap INTO l_vbap-vbeln.
indice = indice + 1.
AT END OF vbeln.
CLEAR indice.
ENDAT.
if indice GT 1.
???????????????????????????????????????
WRITE ' two OTP'.
ELSEIF.
ENDIF.
ENDLOOP.
can you help me to find the missing '???????'
thanks
‎2008 Aug 22 3:34 PM
Hi try this logic:
SELECT PS_PSP_PNR POSNR vbeln FROM vbap
into CORRESPONDING FIELDS OF TABLE l_vbap.
sort l_vbap by vbeln.
LOOP AT l_vbap INTO w_vbap. "<< workarea for l_vbap
indice = indice + 1.
if w_vbap-posnr = w_vbap-PS_PSP_PNR.
append w_vbap-posnr to i_posnr. "<< Table to store similar posnr
endif.
AT END OF vbeln.
if indice GT 1 and i_posnr[] is not initial.
WRITE ' two OTP'.
ENDIF.
clear indice.
refresh i_posnr.
ENDAT.
ENDLOOP.
‎2008 Aug 22 3:34 PM
Hi try this logic:
SELECT PS_PSP_PNR POSNR vbeln FROM vbap
into CORRESPONDING FIELDS OF TABLE l_vbap.
sort l_vbap by vbeln.
LOOP AT l_vbap INTO w_vbap. "<< workarea for l_vbap
indice = indice + 1.
if w_vbap-posnr = w_vbap-PS_PSP_PNR.
append w_vbap-posnr to i_posnr. "<< Table to store similar posnr
endif.
AT END OF vbeln.
if indice GT 1 and i_posnr[] is not initial.
WRITE ' two OTP'.
ENDIF.
clear indice.
refresh i_posnr.
ENDAT.
ENDLOOP.
‎2008 Aug 22 4:43 PM
thanks for having seen my pb.
but i cannot execut the prog:
sort l_vbap by vbeln.
data :w_vbap LIKE LINE OF l_vbap.
DATA: begin of i_posnr OCCURS 0,
posnr TYPE posnr,
END OF i_posnr.
LOOP AT l_vbap INTO w_vbap. "<< workarea for l_vbap
indice = indice + 1.
if w_vbap-posnr = w_vbap-PS_PSP_PNR.
append w_vbap-posnr to i_posnr. "<< Table to store similar posnr
endif.
AT END OF vbeln.
if indice GT 1 and i_posnr[] is not initial.
WRITE ' two OTP'.
ENDIF.
clear indice.
clear i_posnr.
ENDAT.
ENDLOOP.
any idea why it does not work?
‎2008 Aug 23 10:06 AM