DATA : CL_MATNR TYPE REF TO ZMTM_BGCO_ITAB_REPORT.
DATA : EXCP TYPE REF TO CX_AI_SYSTEM_FAULT.
DATA : LW_INPUT TYPE ZMTM_ITAB_REPORT_ADD_TAB_REPO1,
LW_OUTPUT TYPE ZMTM_ITAB_REPORT_ADD_TAB_REPOR.
DATA:IT_TAB TYPE STANDARD TABLE OF ZMTM_TAB_REPORT_REQUEST_DTO WITH HEADER LINE .
DATA ERRO_MSG TYPE STRING.
DATA: DATETIME(14) TYPE C,
DATETIME2(19) TYPE C,
DATE(8) TYPE C,
TIME(6) TYPE C.
DATE = SY-DATUM .
TIME = SY-UZEIT.
CONCATENATE DATE TIME INTO DATETIME.
CALL FUNCTION 'CONVERSION_EXIT_TSTPS_OUTPUT'
EXPORTING
INPUT = DATETIME
IMPORTING
OUTPUT = DATETIME2.
.
IT_TAB-CHECK_CODE = '05'.
IT_TAB-SUM_QTY = 1.
IT_TAB-CREATE_ON = DATETIME2.
APPEND IT_TAB.
IF CL_MATNR IS NOT BOUND.
TRY .
" CREATE OBJECT CL_MATNR TYPE ZMTM_BGCO_ITAB_REPORT.
CREATE OBJECT CL_MATNR
EXPORTING
LOGICAL_PORT_NAME = 'ZMTM_BG'.
CATCH CX_AI_SYSTEM_FAULT INTO EXCP.
ENDTRY.
LW_INPUT-REQUEST-TAB_REPORT_REQUEST_DTO = IT_TAB[].
TRY.
CALL METHOD CL_MATNR->ADD_TAB_REPORT
EXPORTING
INPUT = LW_INPUT
IMPORTING
OUTPUT = LW_OUTPUT.
CATCH CX_AI_SYSTEM_FAULT INTO EXCP.
CALL METHOD EXCP->GET_TEXT
RECEIVING
RESULT = ERRO_MSG.
WRITE /1 ERRO_MSG.
ENDTRY.
WRITE /2 LW_OUTPUT-ADD_TAB_REPORT_RESULT-CODE .
WRITE /3 LW_OUTPUT-ADD_TAB_REPORT_RESULT-MESSAGE .
ENDIF.