Monday, 18 September 2023

External Mode API

 Reading Entity Data using this External Mode API.

READ  Entity data

  DATA: lo_model     TYPE REF TO if_usmd_model_ext,

          ls_sel       TYPE usmd_s_sel,

          lt_sel       TYPE usmd_ts_sel,

          lt_objlist   TYPE usmd_t_crequest_entity,

          ls_objlist   TYPE usmd_s_crequest_entity,

          lv_structure TYPE REF TO data.


    FIELD-SYMBOLS : <lt_data> TYPE ANY TABLE.


    IF iv_crequest IS INITIAL.

      RETURN.

    ELSE.

      IF io_model IS INITIAL.

        CALL METHOD cl_usmd_model_ext=>get_instance

          EXPORTING

            i_usmd_model = '0G'

          IMPORTING

            eo_instance  = lo_model.

      ELSE.

        lo_model = io_model.

      ENDIF.


      CLEAR: ls_sel, lt_sel.

      ls_sel-fieldname = usmd0_cs_fld-crequest.

      ls_sel-option = 'EQ'.

      ls_sel-sign = 'I'.

      ls_sel-low = iv_crequest.

      INSERT ls_sel INTO TABLE lt_sel.


      CALL METHOD lo_model->read_char_value

        EXPORTING

          i_fieldname = usmd0_cs_fld-crequest

          it_sel      = lt_sel

          i_readmode  = if_usmd_model_ext=>gc_readmode_no_inact

        IMPORTING

          et_data     = lt_objlist.


      IF lt_objlist IS INITIAL.

        RETURN.

      ELSE.

*        LOOP AT lt_objlist INTO ls_objlist WHERE usmd_entity = if_usmdz_cons_entitytypes=>gc_entity_account. " Entity - ACCOUNT

        LOOP AT lt_objlist INTO ls_objlist.

          CLEAR: ls_sel.

          ls_sel-fieldname = ls_objlist-usmd_entity_obj.

          ls_sel-option = 'EQ'.

          ls_sel-sign = 'I'.

          ls_sel-low = ls_objlist-usmd_value.

          INSERT ls_sel INTO TABLE lt_sel.

        ENDLOOP.



        CALL METHOD lo_model->create_data_reference

          EXPORTING

            i_fieldname = iv_entity

            i_struct    = 'KATTR'

          IMPORTING

            er_data     = lv_structure.


        ASSIGN lv_structure->* TO <lt_data>.


        CALL METHOD lo_model->read_char_value

          EXPORTING

            i_fieldname = iv_entity

            it_sel      = lt_sel

            i_readmode  = iv_readmode

          IMPORTING

            et_data     = <lt_data>.

        it_data[] = <lt_data>[].

      ENDIF.

    ENDIF.

1 comment:

  1. Our MacBook Logic Repair service covers a spectrum of issues, including but not limited to power-related failures, connectivity issues, graphics problems, and more. We understand the importance of your MacBook in your daily life, whether for work, creative projects, or personal use. MacBook Screen Repair

    ReplyDelete