EDUCAÇÃO E TECNOLOGIA

Customized Fields at Dispute case creation screen for FBL5N

It’s quite an understandable requirement that additional fields and questionnaires need to be shown at added sub-screen while creating dispute cases through FBL5N.

  • Customized fields will save to dispute case attribute table UDMCASEATTR00, and answers to the questionnaire will be saved to a new Z customized table (cause various versions may happen so can’t save to UDMCASEATTR00);
  • Answers to the questionnaire will be updated to notes of dispute cases;.
  • Customized fields and questionnaires can be displayed/modified through TCODE UDM_DISPUTE.

1. Activation of dispute case button in FBL5N

First of all, please check whether the dispute case button is not available or greyed out in FBL5N.

The configuration path of the IMG at SPRO:
Financial Supply Chain Management -> Dispute Management -> Process Integration with Accounts Receivable Accounting -> Active Process Integration for SAP Dispute Management.

After this activation, it is possible to create Dispute cases by pressing the ‘Dispute Case’ button in FBL5N. Meanwhile, the indicator of FI-DM will be ticked (set as ‘X’) at table TBE11 like below.

2. Add the additional screen for Dispute creation by BADI

This part will be a little duplicated with my other blog ‘Customized Fields in Dispute management of FSCM’. But this one will be more focused on the customized screen part.

Create a customized screen with the number for example ‘9001’ at the customized Z program:

Then pass those screen info to the method ‘GET_CREATE_SCREEN’ of the above implementation.

 method IF_EX_FDM_USER_SCREEN~GET_CREATE_SCREEN. E_DYNNR = '9001'. E_PROGNAME = 'Zz_program_name'. endmethod.

Get screen values and pass to E_USER_ATTRIBUTES for additional fields at method CREATE_SCREEN_PAI, then the system will save to table UDMCASEATTR00. For those z fields not at table UDMCASEATTR00, sorry… have to use memory…

METHOD if_ex_fdm_user_screen~create_screen_pai. DATA: wa_attr TYPE LINE OF fdm_t_attribute. DATA: l_dynpro_program LIKE sy-repid, l_dynpro_number LIKE sy-dynnr, lt_dynpfield TYPE TABLE OF dynpread, wa_dynpfield LIKE LINE OF lt_dynpfield.
*-------------------------
* 1,Get screen values
*------------------------- l_dynpro_program = 'ZXXX_PROGRAM_NAME'. l_dynpro_number = '9001'. CLEAR wa_dynpfield. REFRESH lt_dynpfield. MOVE 'UDMCASEATTR00-ZZ_FIELDS' TO wa_dynpfield-fieldname. APPEND wa_dynpfield TO lt_dynpfield. CALL FUNCTION 'DYNP_VALUES_READ' EXPORTING dyname = l_dynpro_program dynumb = l_dynpro_number TABLES dynpfields = lt_dynpfield. *----------------------------------------
*2, Pass Z field to Dispute attribute (UDMCASEATTR00)
*---------------------------------------- wa_attr-attr_id = 'ZZ_FIELDS'. CLEAR wa_dynpfield. READ TABLE lt_dynpfield INTO wa_dynpfield WITH KEY fieldname = 'UDMCASEATTR00-ZZ_FIELDS'. wa_attr-attr_value = wa_dynpfield-fieldvalue. APPEND wa_attr TO e_user_attributes. CLEAR wa_attr.
...
*--------------------------------------------------------------------
* 3, Get Answers and export to memory for dispute case saving using
*-------------------------------------------------------------------- CLEAR: wa_dynpfield, l_memory. READ TABLE lt_dynpfield INTO wa_dynpfield WITH KEY fieldname = 'ZZR1_Y'. IF wa_dynpfield-fieldvalue IS INITIAL. MOVE 'N' TO l_memory+0(1). ELSE. MOVE 'Y' TO l_memory+0(1). ENDIF.
... EXPORT l_memory = l_memory TO MEMORY ID 'ZANSWER'. ENDMETHOD.

3. Save Z fields to Z table at Save event by BADI

Create an implementation for BADI SCMG_STORE_S with filter SCMGPROCESS equal to F_DM.

When the user hits the ‘SAVE’ button, get the answer values of the questionnaire list and save them to Z customized table. Meanwhile, call the ‘note_insert’ method of dispute, to insert those answers to dispute case notes using notes type ‘Z001’.

 METHOD if_ex_scmg_store_s~was_saved.
*----------------------------------------
* 1. Get Question Answer and Store to Ztable
*---------------------------------------- IMPORT l_memory = l_memory FROM MEMORY ID 'ZANSWER'. FREE MEMORY ID 'ZANSWER'. IF l_memory IS INITIAL. RETURN. ENDIF. ...process data... modify ztable from lt_tab. IF sy-subrc EQ 0. COMMIT WORK. ENDIF. *----------------------------------
* 2, Store Qustions to Dispute Notes
*---------------------------------- "Get Dispute Guid l_guid = im_case->get_guid( ). CALL METHOD cl_scmg_case_api=>if_scmg_case_api~open_case EXPORTING im_case_guid = l_guid im_enqueue = abap_false
* im_scope = IF_SRM_SP_ENQUEUE=>SCOPE_DIALOG_AND_UPDATE_TASK im_check_authority = abap_false RECEIVING re_case = lref_case EXCEPTIONS failed = 1 enqueue_failed = 2 invalid_guid = 3 cx_srm_gsp_back = 4 no_authority = 5 OTHERS = 6. " concatenate answers for case notes CLEAR wa_im_text. REFRESH lt_im_text. i = 1. MOVE i TO wa_im_text-tdformat. MOVE 'If any of these questions is answered `Yes`, then this is a Quality Complaint. Please create an F1.' TO wa_im_text-tdline. APPEND wa_im_text TO lt_im_text.
... CALL METHOD lref_case->note_insert EXPORTING im_id = 'Z001' im_text = lt_im_text im_lang = sy-langu EXCEPTIONS failed = 1. IF sy-subrc <> 0. ENDIF. CALL METHOD lref_case->save EXPORTING im_dequeue = '' EXCEPTIONS failed = 1 OTHERS = 2. IF sy-subrc <> 0. ELSE. COMMIT WORK. ENDIF. 

Final. To display/modify Additional fields and questionnaires through UDM_DISPUTE

Each customized button has a unique FCODE which is usually created by Function through SPRO. Financial Supply Chain Management -> Dispute Management ->Dispute case processing->function profiles->customer-specific functions->Define Functions.

Create an implementation for BADI SCMG_CASE_FCODE_S with filter SCMG_UI_FUNC equal to the button’s FCODE created above. Create a function module with input parameter dispute case GUID and process mode like below.

FUNCTION z_qnq_screen.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(CASE_GUID) TYPE SCMG_CASE_GUID
*" REFERENCE(IM_MODE) TYPE SCMG_PROCESSING_MODE
*"---------------------------------------------------------------------- CALL SCREEN 9001 STARTING AT 10 10.
ENDFUNCTION.

Now, need to create another customized screen at the function group which contains the above function module. Not the same one as FBL5N shown as it only contains fields not belonging to table UDMCASEATTR00. Call this sub-screen at this function, call this function module inside method ‘IF_EX_SCMG_CASE_FCODE_S~EXECUTE’ like below.

 method IF_EX_SCMG_CASE_FCODE_S~EXECUTE. DATA: l_guid TYPE bdm_case_guid. l_guid = im_case->g_backend->get_guid( ). if im_mode eq 'C'. message 'Only Modify/Disply allowed at UDM_DISPUTE.' type 'E'. endif. CALL FUNCTION 'Z_QNQ_SCREEN' EXPORTING case_guid = l_guid IM_MODE = im_mode. endmethod.

Get the latest version of the answer from the defined customized table, and assign those answers to the questionnaire list at the PBO module of the defined customized screen.

 LOOP AT SCREEN. IF screen-name = 'R1_Y'. CLEAR r1_y. MOVE 'X' TO r1_n. MODIFY SCREEN. ENDIF. ... ENDLOOP. LOOP AT SCREEN . IF screen-name NE 'BCANCEL' AND im_mode EQ 'D'. screen-input = '0'. MODIFY SCREEN. ENDIF. ENDLOOP.

Get the case GUID from input parameters and use method ‘note_insert’ to add updated answers to the notes of dispute cases at the PAI module of the defined customized screen. After that, we can achieve fully integrated customized fields at the Dispute case creation screen.

It’ll take some time as it’s across 3 BADI involving various screens. Enjoy!

Related Sap notes:

  • 2452272 – FSCM: Dispute case button not available in FBL5N
  • 2155880 – FAQs in Collection and Dispute Management