Hi gurus,
The client needs to add in the PO a few lines with new data.
Although this has been achieved with the help of this post (Re: VA01 / VA02 - Copy sales order line abap ?), I have a problem with the price determination.
ls_xvbap-mandt = '300'.
ls_xvbap-pstyv = 'TAN'.
ls_xvbap-updkz = 'I'.
ls_xvbap-werks = '4100'.
ls_xvbap-lgort = '4101'.
LOOP AT gt_stanga INTO ls_list WHERE cant <> 0.
ls_xvbap-posnr = ls_xvbap-posnr + 10.
ls_xvbap-matnr = ls_list-cod_material.
ls_xvbap-matwa = ls_list-cod_material.
ls_xvbap-kwmeng = ls_list-cant.
SELECT SINGLE charg
FROM mseg
INNER JOIN mbew ON mbew~matnr = mseg~matnr
AND mbew~bwkey = mseg~werks
AND mbew~bwtar = mseg~charg
INTO ls_xvbap-charg
WHERE mbew~matnr = ls_xvbap-matnr
AND mbew~lbkum <> 0.
svbap-tabix = 0.
PERFORM vbap_bearbeiten_vorbereiten(sapfv45p).
svbep-tabix = 0.
PERFORM vbep_bearbeiten_vorbereiten(sapfv45e).
MOVE-CORRESPONDING ls_xvbap TO vbap.
MOVE-CORRESPONDING ls_xvbap TO rv45a.
PERFORM vbap_fuellen(sapfv45p).
PERFORM vbap_bearbeiten(sapfv45p).
PERFORM vbep_fuellen(sapfv45e).
PERFORM vbep_bearbeiten(sapfv45e).
PERFORM vbap_bearbeiten_ende(sapfv45p).
PERFORM koein_ermitteln_n46(sapfv45p).
PERFORM komv_bearbeiten_n46(sapfv45p).
ENDLOOP.
PERFORM preisfindung_nachbereiten_pos(sapfv45p) USING t185f t185 t185v.
fcode = 'ENT1'.
SET SCREEN syst-dynnr.
LEAVE SCREEN.
It works only for the last line (in case I add more than one) using this method (VA02: Carry out new pricing by changing item category), but it needs to work for every line.
FORM USEREXIT_NEW_PRICING_VBAP CHANGING NEW_PRICING.
* Example: new pricing, when field 'Route' is changed
* if vbap-route ne *vbap-route.
new_pricing = 'B'.
* endif.
ENDFORM.
I'm curious if there is something similar with the first issue (the determination for much of the data is done for each line due to the 2 variables set to
"0"), different forms called for each line but I didn't manage to find some.
Anyone can share some pointers to solve this issue?
Thank you in advance,
Marius