Skip to Content
Technical Articles
Author's profile photo Jigang Zhang 张吉刚

Customized fields at Case management of FSCM

It’s very common to add customized fields to more closely align with your own business needs. In this article, you will find the method to add customized fields for Documented Credit Decision (DCD) as well as enable it at the SCASE search screen.

Step 1. Enhance at table/structure level

Table SCMG_T_CASE_ATTR is for case general attributes like case ID, created details which used by all cases managed at FSCM like Credit Limit Request or Documented Credit Decision.

Table UKM_DCD_ATTR contains attributes like Business Partner Number and Credit Segment which specific for Documented Credit Decision. At this the table, we’re going to add our customized field ZZBILL_COCD company code by insertion at include structure CI_UKM_DCD_ATTR.

 

Step 2. Populate the customized field by creating BADI implementation

Here we are using BADI: UKM_SE_UKM_DCD_MNTNO and implement the method ‘INBOUND_PROCESSING’ (BADI UKM_DCD_MAINTAIN can achieve the same).

  • Get sales order number from output parameters OUT by checking its attribute ‘DCD_OBJ_ID’ which against order number at DCD.
  • Get company code from sales order and populate the company code to this new field which is OUT-ADD_ATTRIBUTES-ZZBILL_COCD.

Step 3. Display this new field at DCD Header Level

After populating the value of this field, we need to display this field at the DCD header level by using configurations SPRO path: FSCM->Dispute Management->Dispute Case processing->Attribute Profile->Create Attribute Profile. (Please note here is not belong to Credit management but dispute management instead.)

Find your attribute profile for DCD, go to attribute group then assign attributes:

Here controls the position where to display this customized field at Header data by setting row number and column number. After this configuration, the billing company code list in column 2 and line 12.

Final step. Display this new field at the case search screen

We need to enable this field as a search field at the search screen by configuration SPRO path: FSCM->Credit Management->Credit Risk Monitoring->Documented Credit Decision->Create Profile for Case Search.

Here the profile we created new profile refers to standard one: FDCD_LOC. Then set this new fields’ number for row and column as the last step.

Then we can get this field at case selection screen:

Conclusion:

By structure enhance, BADI implementation, and several configuration steps we can add a customized field for Documented Credit Decision (DCD) and enable it at the case search screen. It works at FSCM_CCD with release 617, not tested but very likely the same at S/4 Hana as well.

 

Assigned Tags

      27 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Claudio BIAGGI
      Claudio BIAGGI

      Hi,

      looks good material .

      thank you

      Claudio

      Author's profile photo Jigang Zhang 张吉刚
      Jigang Zhang 张吉刚
      Blog Post Author
      thanks for the comments : )
      Author's profile photo Sumit Chimangunde
      Sumit Chimangunde

      I want to configure Critical field in FSCM, if my payment term is change at sales order then sales order should block. How can we configure in S4 hana, please explain the steps to figure this

      Author's profile photo Jayasunder Reddy Banda
      Jayasunder Reddy Banda

      Hi Jigang Zhang,

      I have done change like above mentioned. But the BADI's are not triggering. Could you please let me know any configuration is required.

       

      Thanks

      Jayasunder

      Author's profile photo Jigang Zhang 张吉刚
      Jigang Zhang 张吉刚
      Blog Post Author

      @Jayasunder Reddy Banda

      that BADI doesn't need configuration. Please check if BADI implement is activated or not?

      Author's profile photo Jayasunder Reddy Banda
      Jayasunder Reddy Banda

      Hi Jigang Zhang,,

      After implemented and activated the BADI and another issue started is that Case ID is not creating. It  is critical issue after above steps done in my system.

      PLease let me know root cause?

      Thanks

      Jayasunder

      Author's profile photo Jigang Zhang 张吉刚
      Jigang Zhang 张吉刚
      Blog Post Author

      Have you got any dump or update termination? Try some luck with the tcode SM21 filter by your name and creation range. I guess maybe some fields can't pass the validation before creation.

      If no founding then has to debug... find the creation FM first (I'm no system access now, should have one) and trace whether it's been triggered or not.

      Author's profile photo Jayasunder Reddy Banda
      Jayasunder Reddy Banda

      Hi Jigang Zhang,

      Once i was  revert back changes ( you mentioned the Blog ), now system is  creating Case ID and able to see in SCASE.

      Requirement:

      The credit limit is more, system showing popup related Credit management  while sales order creation.  I need add some more new fields  in SCASE  and populate values for credit management.

      Please let me know steps to reach goal.

       

      Thanks

      Jayasunder

       

      Author's profile photo Jigang Zhang 张吉刚
      Jigang Zhang 张吉刚
      Blog Post Author

      Please just follow the step1&2 of this blog, extend the structure, get the inputs from the signature, write your logic and populate those Z fields at that BADI implementation, active it, and set break-point check whether it's running as expected.

      If the error happens, any error message/dump? Keep logic simple at first and make sure it's working then add more~ good luck

      Author's profile photo Karthick D
      Karthick D

      Hi Jigang,

      Thanks for the Blog,

      I tried the same till adding field to the structure, but when it comes to badi I can't find the sales document number in the signature can u please provide a screen shot of what you have done and the also the screen shot of the code you have written for lv_bukrs.

      Author's profile photo Jigang Zhang 张吉刚
      Jigang Zhang 张吉刚
      Blog Post Author

      @Karthick D

      Try to get an SO number like below:

      data: wa_attr TYPE bapi_dispute_attribute,
            lv_so TYPE vbeln.
      
          CLEAR wa_attr.
          " Get sales order number
          LOOP AT out-attributes INTO wa_attr WHERE attr_id EQ 'DCD_OBJ_ID'.
            lv_so = wa_attr-attr_value.
          ENDLOOP.

       

      Author's profile photo Harsh Bansal
      Harsh Bansal

      Hello Jigang,

      Thank you for detailed explanation. I have gone through all the steps of BADI and Customization.

      Fields are showing correctly in Header and also in Selection Criteria but are not getting filled. The reason behind this is BADI not being called. I activated both the BADIs - UKM_SE_UKM_DCD_MNTNO and UKM_DCD_MAINTAIN and put the breakpoints. But none of these is getting called while doing the Search in DCD.

      Can you please let me know if some other step has to be done.

      Regards,

      Harsh Bansal

      Author's profile photo Jigang Zhang 张吉刚
      Jigang Zhang 张吉刚
      Blog Post Author

      Harsh Bansal

      'But none of these is getting called while doing the Search in DCD.'

      If I remember correctly it'll be triggered at the creation of DCD instead of searching in DCD or changing. It's a kind of standard interface between SD and FSCM as standard DCD is created automatically after sales orders are created.

      If you populate Z fields at change try BADI: SCMG_CHNG_BFR_STR_C.

      Author's profile photo Harsh Bansal
      Harsh Bansal

      Hello Jigang,

      Actually we created multiple new Orders/Cases after that as well. Still BADI was not being called and hence new fields are still not getting filled.

      Regards,

      Harsh Bansal

      Author's profile photo Jigang Zhang 张吉刚
      Jigang Zhang 张吉刚
      Blog Post Author

      Harsh Bansal

      if you set a breakpoint there, maybe it'll not be triggered as it's not frontend running. Check your BADI, if not sure it's been called try to create an endless loop and catch it at SM50 to see what's happens.

      Author's profile photo VENKATESH B
      VENKATESH B

      Hi Jigang,

      Thanks for detailed blog on adding custom fields.  As we too have custom fields which are added and now the requirement is to have the same custom fields in the search results of the  ALV Layout.  Can this custom field added to this ALV layout. 

       

      Thanks in advance.

      Best Regards / Venkat

      Author's profile photo Jigang Zhang 张吉刚
      Jigang Zhang 张吉刚
      Blog Post Author

      VENKATESH B

      Yes, it'll display as this ALV using structure UKM_S_DCD_ATTR_ALV which contains the included structure CI_UKM_DCD_ATTR.

       

      Author's profile photo VENKATESH B
      VENKATESH B

      Thanks Jigang for the quick clarification. I'll try this.

      Author's profile photo Göksenin Çiğdem
      Göksenin Çiğdem

      Hello Jigang Zhang,

       

      I hope you are doing well. We are troubling the sames issue as other consultants mentioned. We added related custom field to the structure successfully. However, when we used this BADI:UKM_SE_UKM_DCD_MNTNO and we put break points in it. However, we were not be able to break in it. Our case is, we would like to add this custom field to the search ALV. We created new sales order for DCD but even if we were not be able to reach this BADI.

      If you can share your comments on that it will be appreciated.

      Best regards,

      Author's profile photo Jigang Zhang 张吉刚
      Jigang Zhang 张吉刚
      Blog Post Author

      Please check or add some signs to make sure BADI has been activated & Called like an endless loop or update some fields for the dummy Z table cause some BADI will not trigger while DCD creation especially if it's been processed by like web methods that run in the background.

      Author's profile photo Shaobo Kuang
      Shaobo Kuang

      Hello Jigang & Venkatesh,

      We faced the same problem that both BADI are not triggered.

      Any idea?

      Thanks,

      Shaobo K

      Author's profile photo Jigang Zhang 张吉刚
      Jigang Zhang 张吉刚
      Blog Post Author

      Shaobo Kuang

      I'm not sure whether the breakpoint has not been triggered or this BADI has not been triggered at all, please check or add some sign to make sure BADI has been activated & Called. I don't have a suitable case to check currently, I remember some BADI will not trigger breakpoints when DCD has been created (will trigger when it's been changed) cause we're using web methods way to deal with DCD-related interface methods.

      If all no issues from the BADI impl, maybe this BADI is not suited for your system...

      Author's profile photo Shaobo Kuang
      Shaobo Kuang

      Jigang,

      Thanks.

      It seems that the other Badi is triggered (UKM_DCD_MAINTAIN).

      Another question here. When implementing this Baid, it requires a structure CI_UKM_DCD_ADD_ATTR, which is not in our system. If I create it, this CI structure should include only znewfield, or should all the fields from UKM_DCD_ADD_ATTR.

      Thanks,

      Shaobo Kuang

       

       

       

      Author's profile photo Jigang Zhang 张吉刚
      Jigang Zhang 张吉刚
      Blog Post Author

      Shaobo Kuang

      not required, only Z fields are required for CI_UKM_DCD_ADD_ATTR.

      Author's profile photo Shaobo Kuang
      Shaobo Kuang

      Jigang,

      Thanks. It works.

      Shaobo Kuang

      Author's profile photo Noman Mohamed Hanif
      Noman Mohamed Hanif

      Hi Jigang,

      Thanks for the very detailed blog on setting up the customizing fields for DCD cases.

      Our requirement was to assign the existing fields in DCD such as Person Responsible, Approver 1, Approver 2

      • For this I use BAdi : SCMG_CHNG_BFR_STR_C and this works completely fine for assignment during the automatic case creation from SD documents.
      • Next we have a requirement to consider the validation of the above three approver fields based on a group user which we define using a custom maintenance table setup and this is also inline with the Approval setup for Credit Analyst based on the Open Credit amount threshold defined in standard customizing, So this validation triggers when user tries to edit attributes of the DCD case it checks if exists in the group user for Responsible, Approver1, Approver2 based on the requirement. Again we face no issue in setting up this validation through another BAdI : SCMG_VLDT_BFR_STR_C.
                    TRY. "Check if changed?
                        IF im_case->is_changed( ) = abap_true.
        *          Check if current user is not in approval hierarchy group
                    IF  ( lv_person_resp_grp IS NOT INITIAL
                      AND sy-uname NOT IN lt_person_resp_grp ) " Person Responsible          
                    OR ( lv_one_approver_grp IS NOT INITIAL
                      AND sy-uname NOT IN lt_one_approver_grp )" Approver 1
                    OR ( lv_two_approver_grp IS NOT INITIAL
                     AND sy-uname NOT IN lt_two_approver_grp )." Approver 2
        
                      ch_is_valid = if_srm=>false.
        
        *           Display message that user not authorized to save changes
                      ls_messages-type = 'E'.
                      ls_messages-id = 'SCMG_CASE'.
                      ls_messages-number = '009'.
        
                      CALL FUNCTION 'MESSAGE_TEXT_BUILD'
                        EXPORTING
                          msgid               = ls_messages-id
                          msgnr               = ls_messages-id
                        IMPORTING
                          message_text_output = ls_messages-message.
        
                      APPEND ls_messages TO ch_messages.
        
                      TRY.
        *                 Undo attribute changes if changed
                          im_case->undo_attribute_changes( ).
                        CATCH cx_srm_framework .
                      ENDTRY.
        
                    ENDIF.
                      CATCH cx_srm_framework .
                    ENDTRY.​
      • Next when we try to release the document , SD release is successful and the notes are updated successfully but surprisingly the Document Status for the case is still in status Blocked - '1' and does not get updated.
      • I tried to do analysis on this issue and find another strange observation while using this BAdI SCMG_VLDT_BFR_STR_C. When I avoid the usage of validation parameters CH_IS_VALID (Case validation flag)CH_MESSAGES (Message Structure) both provided by SAP to validate the DCD cases before Save the release status is updated without any issue and what's peculiar here is that when I just comment the usage of these parameters the release status is updated but in both the scenarios the control never would go inside my condition for a positive case and that is really strange. The below example is the same code as above but I just comment what is inside the validation condition and even if this condition does not satisfy whether commented or not it somehow seems to affect the release process because I have also tried extensive debugging to check the SD document release after this and there seems to be no difference there.
      •             TRY. "Check if changed?*                IF im_case->is_changed( ) = abap_true.
        *          Check if current user is not in approval hierarchy group
                    IF  ( lv_person_resp_grp IS NOT INITIAL
                      AND sy-uname NOT IN lt_person_resp_grp ) " Person Responsible          
                    OR ( lv_one_approver_grp IS NOT INITIAL
                      AND sy-uname NOT IN lt_one_approver_grp )" Approver 1
                    OR ( lv_two_approver_grp IS NOT INITIAL
                     AND sy-uname NOT IN lt_two_approver_grp )." Approver 2
        
        *              ch_is_valid = if_srm=>false.
        
        **           Display message that user not authorized to save changes
        *              ls_messages-type = 'E'.
        *              ls_messages-id = 'SCMG_CASE'.
        *              ls_messages-number = '009'.
        *
        *              CALL FUNCTION 'MESSAGE_TEXT_BUILD'
        *                EXPORTING
        *                  msgid               = ls_messages-id
        *                  msgnr               = ls_messages-id
        *                IMPORTING
        *                  message_text_output = ls_messages-message.
        
        *              APPEND ls_messages TO ch_messages.
        
        *              TRY.
        *                 Undo attribute changes if changed
        *                  im_case->undo_attribute_changes( ).
        *                CATCH cx_srm_framework .
        *              ENDTRY.
        
                    ENDIF.
                      CATCH cx_srm_framework .
                    ENDTRY.

      •  I have then also tried to investigate how this field is getting updated and apparently in S4HANA release this gets updated by the generic workflow user (SAP_WFRT) to avoid the requirement of credit management authorization to a sales person . The event created for DCD for a blocked sales order is shown in below image. But the important question here is how can I possibly control the release through this or this is some kind of bug which SAP needs to know? I want to raise an OSS note describing this issue but really want to understand if something is missed from my side. Your thoughts on this problem are really appreciated!

      Thanks & regards,

      Noman

      Author's profile photo Nelly MEYER
      Nelly MEYER

      Hi,

      I have activated the BADI but the value is not getting updated in the New field.

      I am not able to debug the BADI to check the issue . The system I am using is S4 HANA 2020.

      Can u please guide me the steps to debug:-

       

      I have Put the breakpoint on the BADI.

      Created a Sales order with credit block.

      Than i wait for the debugger to start but it never does. The credit case is created with blank values.

       

      I even tried applying infinite loop but no luck.

       

      Please help me on same