cancel
Showing results for 
Search instead for 
Did you mean: 

Need error/warning message if there is no stock available

former_member150831
Participant
0 Kudos

Hello Expertise,

In our project we need error/warning message at the time of Sales order/outbound delivery on Material deficit or no stock available.

Sales order for Quantity 10 but confirmed only 4 quantity since stock is only available for 4 quantity.

Please provide possible solution and step to be configure.

This is completely S4hana Public cloud edition.

Thanks and Regards

Prabhat Kumar

View Entire Topic
CE6
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Prabhat,
I think you can fulfill your requirement with Key User Extensibility.

If you like to do that check before the sales document is saved, you can do it in the following Cloud BAdI:
Check of Sales Documents Before Saving (SD_SLS_CHECK_BEFORE_SAVE)

You can simply check the confirmed quantities of the schedule lines to validate if all items are completely confirmed. The implementation could look like this:

if salesdocument-salesdocumenttype = 'TA'.
    loop at salesdocumentitems into data(ls_item).
        data(lv_requestedquantity) = ls_item-requestedquantity.
        data(lv_confirmedquantity) = 0.
        loop at salesdocumentschedulelines into data(ls_scheduleline).
            if ls_scheduleline-salesdocumentitem = ls_item-salesdocumentitem and ls_scheduleline-confirmeddeliverydate is not initial.
                lv_confirmedquantity = lv_confirmedquantity + ls_scheduleline-ConfdOrderQtyByMatlAvailCheck.
            endif.
        endloop.
        if lv_requestedquantity <> lv_confirmedquantity.
            append value #(  messagetype = 'E' messagetext = |Item { ls_item-salesdocumentitem } could not be completely confirmed. Requested Quantity: { lv_requestedquantity } Confirmed Quantity: { lv_confirmedquantity } | ) to messages.
        endif.
    endloop.
endif.

If you want to get a warning already during the sales order processing, you can do some similar implementation in Cloud BAdI 'Check of Header Data in Sales Documents' (SD_SLS_CHECK_HEAD) or 'Check of Item Data in Sales Documents' (SD_SLS_CHECK_ITEM).

You can find further documentation about Cloud BAdIs in Sales here.

For Delivery you could probably use Cloud BAdI 'Last Checks Before Saving the Delivery' (LE_SHP_DELIVERY_FINAL_CHECK) for such kind of checks.

best regards,
Christian

ltzerovska
Explorer
0 Kudos
Hi there, what would the code be for the exact same thing if activated for Delivery with the BAdi For Delivery you could probably use Cloud BAdI 'Last Checks Before Saving the Delivery' (LE_SHP_DELIVERY_FINAL_CHECK)
liam_hong
Explorer
0 Kudos
How to judge when it comes to sales and outbound delivery
liam_hong
Explorer
0 Kudos
How to judge when it comes to sales and outbound delivery.
liam_hong
Explorer
0 Kudos
How to judge when it comes to sales and outbound delivery. Thanks and Regards deng.