PROCESS DIRECTOR Note
Number 1639236
Subject Activation of the TM module (parameter TM_INVOICE_CLERK)
Component PD AP
Available with version 7.12, 7.11.2
Requires version All supported versions
Description
When Transportation Management module in SAP is activated (by using the user parameter
TM_INVOICE_CLERK), PD AP batch input call of MIRO fails due to change in display order
of tabs.
After applying this note system will check if TM is active and force navigation to PO
reference tab.
! PD AP doesn’t support parameter value 01 as PO reference tab is hidden in such case !
Pre-correction
1) Open SE24, enter /COCKPIT/CL_SYSTEM and add new Attribute as described below
CON_SWITCH_ON Constant Public Type SFW_SWITCHPOS Switch Position 'T'
PROCESS DIRECTOR Note
2) Add new methods as described below
IS_TM_ACTIVE Instance Method Public Is Transportation
Management module active?
IS_BFUNC_SWITCHED_ON Instance Method Public Is
Business Function switched on?
3) Go to Parameters of method IS_TM_ACTIVE and add parameter
EB_ACTIVE Returning Type ABAP_BOOL
4) Go to method IS_TM_ACTIVE source code and change code as follows
METHOD is_tm_active.
DATA: lb_tm_bfunc_active TYPE abap_bool,
lv_tm_switch_status TYPE sfw_switchpos.
" TM active - Business function LOG_TM_IV_INT and switch MM_SFWS_TM is
active in the system.
lb_tm_bfunc_active = is_bfunc_switched_on( 'LOG_TM_IV_INT' ).
lv_tm_switch_status = cl_abap_switch=>get_overall_switch_state( 'MM_SFW
S_TM' ).
2
PROCESS DIRECTOR Note
IF lb_tm_bfunc_active = abap_true AND lv_tm_switch_status = con_switch_
on.
eb_active = abap_true.
ELSE.
eb_active = abap_false.
ENDIF.
ENDMETHOD.
5) Go to Parameters of method IS_BFUNC_SWITCHED_ON and add parameter
IC_BFUNC_NAME Importing Type SFW_BFUNCTION
EB_SWITCHED_ON Returning Type ABAP_BOOL
6) Go to method IS_BFUNC_SWITCHED_ON source code and change code as follows
METHOD is_bfunc_switched_on.
DATA: l_dummy TYPE sfw_r3state,
lc_client_system TYPE sfw_system-client_system.
SELECT SINGLE client_system FROM sfw_system INTO lc_client_system.
IF lc_client_system IS INITIAL.
SELECT SINGLE version FROM sfw_active_b2 INTO l_dummy
WHERE version = 'A'
AND bfunction = ic_bfunc_name.
ELSE.
" Note: Client handling is automatically done by the compiler here :
"where mandt = sy-mandt
SELECT SINGLE version FROM sfw_active_bfunc INTO l_dummy
WHERE version = 'A'
AND bfunction = ic_bfunc_name.
ENDIF.
IF sy-subrc = 0.
eb_switched_on = abap_true.
ELSE.
eb_switched_on = abap_false.
ENDIF.
ENDMETHOD.
Activate and close.
7) Go to SE91 and add new message number 137 into message class /COCKPIT/CHK
3
PROCESS DIRECTOR Note
TM module active - user parameter &1 with value &2 not supported
Save and close.
8) Go to SE37 enter /COCKPIT/API_MIRO_CALL and change source code as follows
….
* Payment terma required
ls_posting LIKE /cockpit/cpostng,
ls_tbsl LIKE tbsl,
ls_pay_terms LIKE /cockpit/spay_disp,
ls_hdr_disp LIKE /cockpit/shdr_disp,
lc_pstkey LIKE /cockpit/cpostng-pstkey_crm_h,
>>>>INSERT
lc_tm_disp_type(2) TYPE c,
<<<<INSERT
lr_swiss_pmnt TYPE REF TO /cockpit/cl_tools_ch_pmnt_att.
* Cross-company code postings for FI documents allowed?
GET PARAMETER ID 'FOP' FIELD ls_rfopt.
IF ls_rfopt-xnobk EQ 'X'.
LOOP AT i_tab_account WHERE comp_code NE i_str_header-comp_code
AND NOT comp_code IS INITIAL.
EXIT.
ENDLOOP.
IF sy-subrc IS INITIAL.
* [X] Documents not cross-company code
CALL FUNCTION '/COCKPIT/OBJ_MESSAGE_APPEND'
EXPORTING
i_id = '/COCKPIT/CHK'
i_number = '101'
TABLES
c_tab_messages = e_tab_messages.
IF 1 EQ 2. MESSAGE e101(/cockpit/chk). ENDIF.
EXIT.
ENDIF.
ENDIF.
>>>>INSERT
4
PROCESS DIRECTOR Note
* Is TM active?
IF /cockpit/cl_system=>mr_system->is_tm_active( ) = abap_true.
GET PARAMETER ID 'TM_INVOICE_CLERK' FIELD lc_tm_disp_type.
" 01 - PO ref tab is hidden => unsupported
IF lc_tm_disp_type = '01'.
CALL FUNCTION '/COCKPIT/OBJ_MESSAGE_APPEND'
EXPORTING
i_type = 'E'
i_id = '/COCKPIT/CHK'
i_number = '137'
i_message_v1 = 'TM_INVOICE_CLERK'
i_message_v2 = lc_tm_disp_type
TABLES
c_tab_messages = e_tab_messages.
IF 1 = 2. MESSAGE e137(/COCKPIT/CHK) WITH space. ENDIF.
RAISE error_occured.
ENDIF.
ENDIF.
<<<<INSERT
* Initialize global data
ls_header = i_str_header.
CALL METHOD /cockpit/cl_tools_ch_pmnt=>mr->get_swiss_pmnt
EXPORTING
ic_comp_code = ls_header-comp_code
ic_vendor_no = ls_header-vendor_no
ic_currency = ls_header-currency
RECEIVING
er_swiss_pmnt = lr_swiss_pmnt.
….
* Afterwards change to tax register if necessary
IF ls_header-calc_tax_ind NE con_true AND
li_tax_subrc EQ 0 AND
lc_taxjuractive IS INITIAL AND
gb_nf EQ con_false.
PERFORM miro_tax TABLES lt_bdcdata
i_tab_tax
USING ls_header-currency.
ENDIF.
>>>>INSERT
PERFORM bdc_dynpro IN PROGRAM /cockpit/saplonline
TABLES lt_bdcdata
USING 'SAPLMR1M' '6000'.
* Go to PO reference tab
PERFORM bdc_field IN PROGRAM /cockpit/saplonline
TABLES lt_bdcdata
USING 'BDC_OKCODE' '=ITEMS_PO'.
PERFORM bdc_dynpro IN PROGRAM /cockpit/saplonline
TABLES lt_bdcdata
USING 'SAPLMR1M' '6000'.
<<<<INSERT
5
PROCESS DIRECTOR Note
* Set reference to purchase order (purchase order + items)
PERFORM bdc_field IN PROGRAM /cockpit/saplonline
TABLES lt_bdcdata
USING 'RM08M-REFERENZBELEGTYP' '1'.
* Enter purchase orders via multi selection.
IF i_tab_item[] IS INITIAL.
….
Activate and close.