cancel
Showing results for 
Search instead for 
Did you mean: 

Sales Order with Product Costing error must not be saved

former_member1091983
Active Contributor
0 Kudos

Hello Experts,

We have make to order scenario with variant configuration.

Requirement: When we create sales order the product costing is running in the background and if it ends up in error, user must not be allowed to save the sales order.

At present, users are able to save the sales order even with error, although it blocks creating delivery, user is able to by-pass the error by doing Extras->post-processing in sales order.

Hence now we want to restrict the users from saving sales order with costing error.

P.S: We tried using user exit MV45AFZZ with the logic of using table KEKO by checking the Costing status but not fruitful as it requires sales order number as an input to retrieve this data.

Appreciate if anyone can show some light in this requirement.

Thanks in advance,

Jagan.

Accepted Solutions (1)

Accepted Solutions (1)

former_member1091983
Active Contributor
0 Kudos

Hello Everyone,

Thanks for your help. I have managed to resolve it by disabling the option of Post-processing through ABAP. Hence it stops subsequent processing of delivery creation until the costing error is corrected in sales order for the respective items.

Reg,

Jagan.

sez41
Active Contributor
0 Kudos

Hi Jagan,

How did you disable this action - was it an enhancement implementation, a user exit, or what? Can you share the program name you've touched. Thanks,

Answers (2)

Answers (2)

Jelena
Active Contributor
0 Kudos

Not sure if it makes sense to make it a "hard error" (if the order entry is complex the users won't be happy to lose all their work because of the costs they likely can't even control). But we had a similar requirement, only for a warning message. I searched high and low for how to identify the costing error and the only thing I found was that it sets certain status. Not sure if this would work in your scenario and if it's the same status (I believe it's standard one), but here is a code sample for USEREXIT_SAVE_DOCUMENT:


  LOOP AT xvbap into ls_xvbap WHERE ABGRU = SPACE AND

               UPDKZ <> 'D'.

    CALL FUNCTION 'STATUS_CHECK'

      EXPORTING

        objnr                   = ls_xvbap-objnr

        status                  = 'I0164'

     EXCEPTIONS

       OBJECT_NOT_FOUND        = 1

       STATUS_NOT_ACTIVE       = 2

       OTHERS                  = 3.

    IF sy-subrc = 0.

      <warning message here>

    ENDIF.

  ENDLOOP.

Note: normally the validations are in the ...PREPARE user exit but I was not able to make it work there. Don't remember the details.

sez41
Active Contributor
0 Kudos

Hi Jagan,

A few scenarios that came to my mind (Sales order saving is not prevented in either scenario)

1- How about assigning status profiles to your items, and assigning business transaction Create delivery as Forbidden in initial status. An authorized user should change the status if product costing is OK.

2- Check in delivery save user exit if any of the sales order item's product costing is missing (I liked this one better).

former_member1091983
Active Contributor
0 Kudos

Hi Kivanc,

Considering your 2nd point, already we have the std.SAP system control during delivery as I mentioned earlier. But users are able to overcome this error using Post-processing option.

Now I am trying to disable this option of Post processing in sales order costing screen.

Is there a way to disable it thru' std. SAP configuration OR should I use the basis authorization/ ABAP?

Appreciate your suggestions.

Thanks,

Jagan.

sez41
Active Contributor
0 Kudos

Hi,

Can you share the screenshot of this screen you've mentioned? I couldn't find it here in my system.

About the 2nd point: Do you control on delivery save user exit to check if product costing is missing for sales order item or not?

former_member1091983
Active Contributor
0 Kudos

Hello,

Take a look below once you click Sales Order costing button in sales order,

In sales order costing screen,

Secondly, No, we don't use any user exit at delivery level as it's a std functionality for having control on sales order costing with error.

Thanks,

Jagan.

sez41
Active Contributor
0 Kudos

I got you now. Can you check if this authorization object works for you which is called after pressing this button?

Maybe ACTVT can be differentiated while creating the first estimate and then after for post-processing, but it doesn't look likely.

Or maybe an authorization functionality or even a parameter setting to disable Post-processing button (that one I don't know)

sez41
Active Contributor
0 Kudos

I'm not sure if those will help, but you can try by adding/removing those parameters to a business user to check if they help or not: