SAP MDG: How to Make UI Fields - Checked Default in CR

sowmya surekha manukonda's photo
·

1 min read


Credits: sowmya surekha manukonda


Requirement:

Once choosing of PO

The Following below fields has to be automatically checked


Implementation:

The BADI has to be used

Create Implementation:

Once Created Implementation Class:

Filter Values

Implementing Class

Code:

  METHOD if_ex_usmd_rule_service~derive_entity.

    DATA: lo_data TYPE REF TO data.

    FIELD-SYMBOLS : <ls_puorg> TYPE any,
                    <lv_value> TYPE any.

    CREATE DATA lo_data LIKE LINE OF ct_data.

    ASSIGN lo_data TO <ls_puorg>.

    IF lines( ct_data ) EQ 1.

      LOOP AT ct_data ASSIGNING <ls_puorg>.

        ASSIGN COMPONENT 'PRCH_ORG' OF STRUCTURE <ls_puorg> TO FIELD-SYMBOL(<lv_prog>).
        ASSIGN COMPONENT 'WEBRE' OF STRUCTURE <ls_puorg> TO FIELD-SYMBOL(<lv_webre>).
        ASSIGN COMPONENT 'KZAUT' OF STRUCTURE <ls_puorg> TO FIELD-SYMBOL(<lv_kzaut>).
        ASSIGN COMPONENT 'NRGEW' OF STRUCTURE <ls_puorg> TO FIELD-SYMBOL(<lv_nrgew>).

        IF <lv_prog> IS NOT INITIAL AND <lv_prog> IS ASSIGNED AND <lv_webre> IS ASSIGNED AND <lv_kzaut>
          IS ASSIGNED AND <lv_nrgew> IS ASSIGNED.

          <lv_webre> = 'X'.
          <lv_kzaut> = 'X'.
          <lv_nrgew> = 'X'.

        ENDIF.
      ENDLOOP.
    ENDIF.

  ENDMETHOD.

Done :)

//output of this already shown in requirement


Thanks,
Suggu Sandeep.