Get Latest Change Request for Business Partner or Material in MDG (ABAP)

  data: lo_model1 type ref to if_usmd_model_ext,
          lo_model  type ref to cl_usmd_model_ext.

    if iv_partner is not initial.

      ls_sel-sign      = ‘I’.
      ls_sel-option    = ‘EQ’.
      ls_sel-fieldname = ‘BP_HEADER’.
      ls_sel-low       = iv_partner.
      insert ls_sel into table lt_sel.

      ls_sel-fieldname = usmd0_cs_fld-fieldname_objlist.
      ls_sel-low       = ‘BP_HEADER’.
      insert ls_sel into table lt_sel.

      call method cl_usmd_model_ext=>get_instance
        exporting
          i_usmd_model = ‘BP’
        importing
          eo_instance  = lo_model1.

      if lo_model1 is not bound.
        return.
      endif.
      lo_model ?= lo_model1.


      lo_model->if_usmd_model_ext~read_char_value

           ( exporting i_fieldname = usmd0_cs_fld-crequest
                       it_sel      = lt_sel
                       if_no_flush = abap_true
             importing et_data     = lt_objlist ).

      if lt_objlist is not initial.
        describe table lt_objlist lines data(lv_count).
        read table lt_objlist index lv_count into ls_objlist.
        if sy-subrc = 0.

          select single * from usmd120c into ls_usmd120c
          where usmd_crequest = ls_objlist-usmd_crequest.
          if sy-subrc = 0.
            move-corresponding ls_usmd120c to es_crequest.
          endif.
        endif.
      endif.
    endif.

Leave a Comment

Your email address will not be published. Required fields are marked *

error: Content is protected !! Leave the comment to connect with us
Scroll to Top