Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member223133
Active Participant
3,926

This document explains how to update the Sales Order number to the logs created for FSCM credit management credit checks during SO Creation.

Requirement:

As a part of FSCM Credit Management, Logs will be registered in the database for the credit checking steps performed. These logs should be created for failed credit checks triggered for business partner and the sales order number should be added to these logs.

Prerequisites:

  1. FSCM Credit Management setup should be in place
  2. Credit Checking steps should be implemented
  3. Business Partner should be assigned to the Check Rule defined for credit checks to trigger during the SO creation under Credit Profile tab of transaction UKM_BP.

Functionality:

At the time of creation of Sales Order, basis the FSCM Credit Management setup and credit checking steps configurations, logs will be created for credit checks performed. (We can perform any number of credit checks based on the requirement).

Credit checks are displayed in the popup with the details of failed checks.

Sales Order will not be generated at this point of time, but logs will be posted to database. Once we continue, then only Sales Order will be created.

These logs can be viewed though transaction code “UKM_LOGS_DISPLAY”.

Challenge:

Since the Credit checking process is the intermediate step, it is not possible for the user to find the Sales Order for which credit checks are failed.

Solution:

For this we have implemented one implicit enhancements and one user exit to enhance the standard functionality.

  1. Implicit Enhancement in the method CHECK_ACCOUNT of class “CL_UKM_CREDIT_CHECKER”.

Pseudo Code:

DATA: lv_mem_id TYPE string.

                CONCATENATE is_item-partner      "Business Partner

                                                is_item-credit_sgmnt "Credit Segment

                                                is_item-iguid        "GUID

                                                l_log_handle         "Log Handle

                                                INTO lv_mem_id SEPARATED BY ','.

                EXPORT lv_mem_id = lv_mem_id TO MEMORY ID 'ZLOGID'.

  1. Implement User Exit “USEREXIT_SAVE_DOCUMENT” of Include MV45AFZZ with below Pseudo code.

DATA: lv_mem_id      TYPE string,

            lv_dummy       TYPE string,

            lv_partner     TYPE bu_partner,

            lv_credit_sgmt TYPE ukm_credit_sgmnt,

            lv_log_ref TYPE ukm_item_guid,

            lv_log_handle  TYPE balloghndl.

  CONSTANTS: c_va01  TYPE sytcode VALUE 'VA01',

                       c_va02  TYPE sytcode VALUE 'VA02'.

  IMPORT lv_mem_id FROM MEMORY ID 'ZLOGID'.

  FREE MEMORY ID 'ZLOGID'.

  IF ( sy-tcode = c_va01 OR sy-tcode = c_va02 ).

    IF lv_mem_id IS NOT INITIAL.

      SPLIT lv_mem_id at ','

         INTO lv_partner

                   lv_credit_sgmt

                   lv_log_ref

                   lv_log_handle.

      "Add SO# to the Credit Checking log

      MESSAGE S000(ukm_check) WITH 'Sales Order Number: ' VBAK-VBELN

                              INTO lv_dummy.

      "Update the log for partner, segment and log reference imported

      CALL METHOD cl_ukm_log_gate=>add_message_credit_check

        EXPORTING

          i_partner           = lv_partner

          i_credit_sgmnt  = lv_credit_sgmt

          i_log_reference = lv_log_ref

        CHANGING

          c_log_handle    = lv_log_handle.

      "Save the Logs

cl_ukm_log_gate=>save_logs( ).

    ENDIF. "IF lv_mem_id IS NOT INITIAL.

  ENDIF. "IF ( sy-tcode = 'VA01' OR sy-tcode = 'VA02' )


Result:

3 Comments
Labels in this area