SAP MDG: BP - Making of Field 02 Mandatory, based on choosing Field 01


Credits:

Vinay


Scenario:

Choosing of Field 01 - option (Y) - Field 02 is Mandatory to give the data, Error Message will popup if not entering the data in Field 02

Process:

Code:

METHOD if_ex_usmd_rule_service~check_entity.
**********************************************************************

  DATA lv_msg TYPE usmd_s_message.

  LOOP AT it_data ASSIGNING FIELD-SYMBOL(<ls_data>).

    IF <ls_data> IS ASSIGNED.
      ASSIGN COMPONENT 'Z_CON_INT' OF STRUCTURE <ls_data> TO FIELD-SYMBOL(<lv_name1>).
      ASSIGN COMPONENT 'Z_EMP_STA' OF STRUCTURE <ls_data> TO FIELD-SYMBOL(<lv_name2>).

      IF <lv_name1> IS ASSIGNED AND <lv_name2> IS ASSIGNED.
        IF <lv_name1> = 'Y' AND <lv_name2> IS INITIAL .
          cl_usmd_message=>convert_text2message(
              EXPORTING
                iv_message_text =  'Employee ID / Staff No. is required'                " Message text
              iv_message_type = 'E'                                       " Message type
              RECEIVING
                rs_message      =     lv_msg                              " USMD message
            ).

          APPEND lv_msg TO et_message.

        ENDIF.
      ENDIF.
    ENDIF.
  ENDLOOP .

ENDMETHOD.

Thank You :)

0
Subscribe to my newsletter

Read articles from sowmya surekha manukonda directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

sowmya surekha manukonda
sowmya surekha manukonda