cancel
Showing results for 
Search instead for 
Did you mean: 

How to swap between to sets of item categories in sales order

Former Member
0 Kudos

Hi,

We receive Idocs from a different system that creates sales order in the R/3 system. For some of these, we want to be able to use an alternative sourcing mode - basically switch between standard POs and 3rd Party POs. The orders has many items, and we find it impractical to manually update all items - also because the order might contain different materials with maybe 5-10 different item categories, that needs to be changed to 5-10 others. This will be very difficult for our business users, since we do not have a simple naming convention of item categories to ease this.

So we are looking for alternative ways, where we can change all items by changing on header level.

We have thought of these alternatives :

1. Change distribution channel. Requires all materials and customers to be set up in 2 DCs - not realistically.

2. Change sales order types using VOV8 alternatives. This seems not to be allowed for materials in BOMs and with E consumption. See other thread named "Can not change SO order type - disallowed by item settings" for more details.

3. What we we really need is changes on schedule line level, and I suppose we could have a logic in MV45AFZZ change this dependent on some user field. But I don't think this will work, as other settings controlled by requirement class etc. will be inconsistent.

Proposals for this are welcome - it should be a common issue.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

We ended up designing a solution where item category was swapped by shipping condition. For shipping condition 11, we simulated that a specific 'usage' was active. It required a few tricks to get the Source determination to run, and a further trick to avoid a re-pricing B to nuke the pricing conditions. This is still draft code, but it seems to work :

Enhancement points ES_SAPFV45P / VBAP_FUELLEN_10 : Ensure ‘usage’ is set according to shipping condition

data : ld_active type c.

data : ld_no_pricing_vwpos type c.

constants : lc_vwpos_no_pricing(20) type c value 'VWPOS_NO_PRICING'.

  • Fake change to ensure new item cat determination

( conditions when this is active, setting ld_active )

if sy-subrc is initial

and ld_active = 'X' "Action enabled for company

and t180-trtyp ca 'HV'. " Create/change mode

case vbak-vsbed.

when '11'. " Special logic

t184_vwpos = 'Z001'. " Special T184 usage for direct

clear *vbap-mandt. " simulate change of *vbap

matnr_changed = 'X'." simulate change

ld_no_pricing_vwpos = 'X'. " Flag for suppress B repricing

when '12'. " standard logic

clear t184_vwpos. " Standard T184 usage for indirect

clear *vbap-mandt. " simulate change of *vbap

matnr_changed = 'X'." simulate change

ld_no_pricing_vwpos = 'X'. " Flag for suppress B repricing

when others.

clear ld_no_pricing_vwpos.

endcase.

  • Memory ID read in MV45AFZB, form USEREXIT_NEW_PRICING_VBAP

export ld_no_pricing_vwpos to memory id lc_vwpos_no_pricing.

endif.

MV45AFZB, form USEREXIT_SOURCE_DETERMINATION : Ensure item category determinations takes ‘usage’ into consideration

( conditions when this is active, setting ld_active )

if sy-subrc is initial

and w_active = 'X' "Action enabled for company

and t180-trtyp ca 'HV'. " Create/change mode

  • Get higher-level item category

clear lv_uepos. clear gv_spp_pstyv.

lv_uepos = vbap-uepos.

do 10 times. " to eliminate phantom levels

read table xvbap with key posnr = lv_uepos.

if sy-subrc = 0 and xvbap-pstyv ne lv_zvco.

gv_spp_pstyv = xvbap-pstyv.

exit.

elseif sy-subrc eq 0 and xvbap-pstyv eq lv_zvco.

lv_uepos = xvbap-uepos.

elseif sy-subrc ne 0.

exit.

endif.

enddo.

  • t184_vwpos set in FV45PFAP_VBAP_FUELLEN

call function 'RV_VBAP_PSTYV_DETERMINE' "Determine using T184

exporting

t184_auart = tvak-auart " Order type

t184_mtpos = maapv-mtpos "Item category group

t184_uepst = gv_spp_pstyv "Higher level-SPP item category

t184_vwpos = t184_vwpos " Usage from FV45PFAP_VBAP_FUELLEN

vbap_pstyv_i = ''

importing

vbap_pstyv = vbap-pstyv.

endif.

MV45AFZB, form USEREXIT_NEW_PRICING_VBAP : Ensure dynamic change of item categories does not trigger repricing type B.

data : ld_no_pricing_vwpos type c.

constants : lc_vwpos_no_pricing(20) type c value 'VWPOS_NO_PRICING'.

  • Memory ID set in FV45PFAP_VBAP_FUELLENP, FORM VBAP_FUELLEN

import ld_no_pricing_vwpos from memory id lc_vwpos_no_pricing.

if sy-subrc is initial

and ld_no_pricing_vwpos = 'X'.

  • Skip repricing when mass change item cat

clear new_pricing.

endif.

******************************

I hope someone will find it useful. Please notice that Enhancement points was required, so it will not work in older R/3 versions.

Former Member
0 Kudos

Hi,

Another alternative is to modify the item categories directly. Like described in other threads here this can be don in MV45AFZB FORM USEREXIT_SOURCE_DETERMINATION with a call to FM RV_VBAP_PSTYV_DETERMINE. We would when change the usage (VWPOS) to a new value to ensure new item category determination. This works OK when e.g. addition items, but the user exit is not called when changing relevant header fields - e.g. shipping condition. When this happens, a number of other user exits e.g. MOVE_TO_VBKD etc. is called, but it doesn't seem like the work correctly to put the logic here.

Has anyone done similar logic outside USEREXIT_SOURCE_DETERMINATION ?