Skip to main content

Requirement to restrict business user from releasing sales document more than once after credit block

Business Requirement:

If the customer is blocked due to credit then credit release should happen only for the first time.
When the second order is created for the customer and is blocked for credit then the system should through error message with below info

Solution approach:

Userexit_SAVE_DOCUMENT

Logic

If SY-TCODE EQ ‘VKM4’

Pass KUNNR into Table VBAK and fetch all entries where VBAK – CMGST = ‘D’ and VBAK-GBSTK and VBAK-LFSTK = ‘C’

If SY-SUBRC is INITIAL
Pass VBELN into table VBFA-VBELV and fetch VBELN with VBTYP_N = ‘M’

If SY-SUBRC is INITIAL
Pass VBELN into Table BSID – ZUONR and fetch BELNR

If SY-SUBRC is INITIAL

Message ‘Payment pending for Order exist. Hence cannot release this Sales Order’ type ‘E’.

Comments

  1. I really like your blog.. very nice colors & theme. Did you design this website yourself or did you hire someone to do it for you? Plz answer back as I'm looking to create my own blog and would like to know where u got this from. thank you. reefer for sale

    ReplyDelete

Post a Comment

Popular posts from this blog

M7021 : Deficit of stock relevant error message during Material Document Cancellation

Issue : When posting a Cancellation for a Material Document in transaction MIGO, you see error 'M7021 Deficit of not stock relevant' although the Purchase Order is setup with an Account assignment. Material / Batch is not managed on Stock Level even though material is valuated. Resolution : The issue is due to program bug and require to implement note - 2502183 - Slog: correction for quantity check. This note is applicable for S/4 HANA 1610 (S4CORE 101) and 1709 (S4CORE 102).

Add Custom fields to sales order screen in Additional Tab B - Header

SAP has provided Additional data Tab A and Tab B for the addition of custom fields to the Standard sales order screen. Screens 8309, 8310 are used for header level and 8459,8460 for item level. Prior to this, we are required to append the custom fields of the Sales order sub screen in VBAK or VBAP. Pass Custom field values in PAI of screen 8309 within Chain statement CHAIN. FIELD: VBAK-<Custom Field 1>         VBAK-<Custom Field 2>         VBAK-<Custom Field 3> ENDCHAIN. Thank you.

User Exits in Delivery

FORM routine USEREXIT_REFRESH_DOCUMENT (include MV50AFZ1) Purpose The FORM routine USEREXIT_REFRESH_DOCUMENT is used for the initialization of your own data areas before the processing of a new delivery document. Call The routine is called from within the standard routine BELEG_DATEN_INIT (SAPMV50A). Basically, the data initialization is called on the following occasions: FORM routine USEREXIT_DELETE_DOCUMENT (include MV50AFZ1) Purpose If a delivery is deleted, you can delete your own dependent data using this FORM routine. Call The FORM routine is called from the FORM routine BELEG_LOESCHEN (SAPMV50A) if the document can be deleted completely. Immediately after the FORM routine  USEREXIT_DELETE_DOCUMENT is called, the document backup is called for which the logically deleted delivery is removed from the database. FORM routine USEREXIT_READ_DOCUMENT (include MV50AFZ1) Purpose The exit is used to make your own data availabl...