cancel
Showing results for 
Search instead for 
Did you mean: 

Simulate order routing like tcode CU50

Former Member
0 Kudos

Hi Gurus

I have a requirement very special.

I need to simulate que order routing of a comercial document that has no yet created an production order. This simulation is perfectly recrated on transaction CU50, because it gives me the resulting routing based on the sales document configuration.

Now what I need, is a way to replicate/use the CU50 transaction on an abap program that retrieves the resulting simulation routing of several sales documents.

I don't know if this is posible via LSMW o FM o BAPIs

hope someone have a useful idea.

Accepted Solutions (1)

Accepted Solutions (1)

Flavio
Active Contributor
0 Kudos

Hi Manuel,

please try with 'CP_EX_PLAN_READ':


  CALL FUNCTION 'CP_EX_PLAN_READ'

    EXPORTING

      PLNNR_IMP    = l_plnnr

      PLNAL_IMP    = l_plnal

      STTAG_IMP    = p_date

      CUOBJ_IMP    = i_vbap-cuobj

    TABLES

      PLAS_EXP     = i_plas

      PLFH_EXP     = i_plfh

      PLFL_EXP     = i_plfl

      PLPO_EXP     = i_plpo

    EXCEPTIONS

      NOT_FOUND    = 1

      PLNAL_INITIAL = 2

      OTHERS       = 3.

I had a similar need in the past, and I was successful in reading the routing (mainly, tha data in the  PLPO_EXP structure, with the above FM.

The trick is to enter the routing group and group counter (l_plnnr and l_plnal) that are the ones of the configurable material, while the configuration object is the one of the material used in the sales document item (inthe example above, it's coming from VBAP-CUOBJ).

I do hope this will help.

Thanks and bye,

Flavio

Former Member
0 Kudos

Hello Flavio, this FM was exactly what I was looking for. tank you a lot, this will help us to complete our requirement  very easily.

Flavio
Active Contributor
0 Kudos

Hi Manuel,

You are welcome!

I'm happy that it's working!

Thanks and bye,

Flavio

Answers (2)

Answers (2)

Former Member
0 Kudos

you can try BAPI  - BAPI_SALESORDER_SIMULATE

ameya_beri
Active Contributor
0 Kudos