6

Need error/warning message if there is no stock av... - SAP Community

 1 week ago
source link: https://community.sap.com/t5/enterprise-resource-planning-q-a/need-error-warning-message-if-there-is-no-stock-available/qaq-p/12796114
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Need error/warning message if there is no stock available

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

Accepted Solutions (0)

Answers (2)

CE6

Advisor

‎10-02-2023

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


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK