*&---------------------------------------------------------------------*
*& Report ZWEIGHT
*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zweight.
DATA:e_msg(255).
DATA:rt_domvalues TYPE RANGE OF matnr.
DATA: lv_return TYPE sy-subrc,
i_dom_apstt TYPE STANDARD TABLE OF dd07v,
lv_wa_domtab TYPE dd07v.
DATA: e_logid TYPE rspc_logid.
DATA: rs_status TYPE rspc_state.
DATA: p_chain TYPE rspc_chain .
DATA:e_manual_abort TYPE rspc_manual_abort.
DATA:e_message TYPE so_text255.
DATA:e_s_message TYPE rspc_s_msg.
DATA:lv_result(255).
PARAMETERS: p_run RADIOBUTTON GROUP sr1.
PARAMETERS: p_check RADIOBUTTON GROUP sr1.
*&---------------------------------------------------------------------*
IF i_dom_apstt IS INITIAL.
CALL FUNCTION 'DD_DOMVALUES_GET'
EXPORTING
domname = 'RSPC_STATE' "域名
text = 'X'
langu = sy-langu
IMPORTING
rc = lv_return
TABLES
dd07v_tab = i_dom_apstt
EXCEPTIONS
wrong_textflag = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDIF.
rt_domvalues = VALUE #( FOR line IN i_dom_apstt ( sign = 'I' option = 'EQ' low = line-domvalue_l high = line-ddtext ) ).
*&---------------------------------------------------------------------*
p_chain = 'ZBPC_WM_IM' .
IF p_run EQ 'X'.
CALL FUNCTION 'RSPC_API_CHAIN_START'
EXPORTING
i_chain = p_chain
* I_T_FOR_PROCESS =
* I_T_VARIABLES =
* I_SYNCHRONOUS =
* I_SIMULATE =
* I_NOPLAN =
* I_DONT_WAIT =
* I_POLL =
* I_GUI =
IMPORTING
e_logid = e_logid
* E_T_PROCESS_FAILED =
EXCEPTIONS
failed = 1
OTHERS = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
ENDIF.
*&---------------------------------------------------------------------*
IF p_check EQ 'X'.
CALL FUNCTION 'RSPC_API_CHAIN_GET_STATUS'
EXPORTING
i_chain = p_chain
i_logid = e_logid
* I_DONT_UPDATE =
* I_DONT_POLL =
IMPORTING
e_status = rs_status
e_manual_abort = e_manual_abort
e_message = e_message
e_s_message = e_s_message.
IF sy-subrc <> 0.
lv_result = e_manual_abort && e_message .
ELSE.
IF line_exists( rt_domvalues[ low = rs_status ] ).
lv_result = rt_domvalues[ line_index( rt_domvalues[ low = rs_status ] ) ]-high .
ENDIF.
ENDIF.
WRITE: lv_result.
ENDIF.
*&---------------------------------------------------------------------*
*e_msg = REDUCE bapi_msg( INIT s = CONV string( e_msg )
* FOR ls_return IN i_dom_apstt
* NEXT s = s && |{ ls_return-ddtext };| ) .
BREAK-POINT.