2006 Dec 20 11:43 AM
HI,
please help me out with this code.
3.Select Single SPART from MARA into V_SPART where MATNR = ZMATNR.
4. IF BSART = 'ZSTO' and V_SPART = '30'.(bsart should be taken from vbep table)
Select VBELN and POSNR from VBRP into V_VBELN,V_POSNR where matnr= ZMATNR and WERKS = ZWERKS and ERDAT = SY-DATUM.(If there is no record, search for one day earlier(SY-DATUM -1). Repeat this until a record is found for the above combination excluding date)
5. If multiple VBELNs are found for date, Check the prices for each of them as follows:
Select KNUMV from KONV where KNUMV = V_KNUMV and KPOSN = V_POSNR and KSCHL = 'ZSTP'.(Latest Price)
6 . Select the highest KWERT and Copy to XKWERT.(zmatnr ,zwerks,zreswk are select options)
regards,
deepthi
2006 Dec 20 1:14 PM
see example bellow.
note that to make it work the way your spec. is asking, the select in VBRP should be done to an internal table, so you can check if there are multiple entries.
Select Single SPART from MARA into V_SPART where MATNR = ZMATNR.
data:
l_date type dats.
l_date = sy-datum + 1.
do while sy-subrc ne 0.
l_date = l_date - 1.
IF BSART = 'ZSTO' and V_SPART = '30'.
Select single VBELN, POSNR
from VBRP
into V_VBELN,V_POSNR
where matnr= ZMATNR
and WERKS = ZWERKS
and ERDAT = l_date.
endif.
enddo.
Message was edited by:
Hermes Felipe Alves
HI,
please help me out with this code.
3.Select Single SPART from MARA into V_SPART where MATNR = ZMATNR.
4. IF BSART = 'ZSTO' and V_SPART = '30'.(bsart should be taken from vbep table)
Select VBELN and POSNR from VBRP into V_VBELN,V_POSNR where matnr= ZMATNR and WERKS = ZWERKS and ERDAT = SY-DATUM.(If there is no record, search for one day earlier(SY-DATUM -1). Repeat this until a record is found for the above combination excluding date)
5. If multiple VBELNs are found for date, Check the prices for each of them as follows:
Select KNUMV from KONV where KNUMV = V_KNUMV and KPOSN = V_POSNR and KSCHL = 'ZSTP'.(Latest Price)
6 . Select the highest KWERT and Copy to XKWERT.(zmatnr ,zwerks,zreswk are select options)
regards,
deepthi
2006 Dec 20 11:58 AM
Hi,
What exactly r u looking for? the explanation of the logic or the code for the logic
Regards
KD
2006 Dec 20 12:05 PM
2006 Dec 20 1:14 PM
see example bellow.
note that to make it work the way your spec. is asking, the select in VBRP should be done to an internal table, so you can check if there are multiple entries.
Select Single SPART from MARA into V_SPART where MATNR = ZMATNR.
data:
l_date type dats.
l_date = sy-datum + 1.
do while sy-subrc ne 0.
l_date = l_date - 1.
IF BSART = 'ZSTO' and V_SPART = '30'.
Select single VBELN, POSNR
from VBRP
into V_VBELN,V_POSNR
where matnr= ZMATNR
and WERKS = ZWERKS
and ERDAT = l_date.
endif.
enddo.
Message was edited by:
Hermes Felipe Alves
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |