Example: Customer-Defined Conversion Module
The following implementation serves as an example of the definition of a customer-specific conversion module. For this, module SMO2_VARIANT_DATE_CONVERSION
was copied to a function module in the customer namespace and the implementation part was replaced. The
coding reproduced below anticipates a GUID (32-character, globally unique ID) to be entered in field i_s_bwselp-low
(the from
value in the generic variant definition) and converts this GUID into the user name from table SMOUSERS
,
which has key SFAMITABT
corresponding to the GUID. This GUID can also be defined using a user-specific subscription (for example, for the publication User (by Employee)
)
FUNCTION z_smo2_variant_user_conversion.
*"--------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" REFERENCE(I_BWRFC) TYPE RFCDEST
*" REFERENCE(I_USERGRP) TYPE SMOUSERGRP
*" REFERENCE(I_WBUID) TYPE SMOWBUID
*" REFERENCE(I_GENUNIID) TYPE SYSUUID_25
*" REFERENCE(I_BWUSER) TYPE SMOBWUSER
*" REFERENCE(I_S_BWSELP) TYPE SMOBWSELP
*" VALUE(I_TEST_FLAG) TYPE C DEFAULT SPACE
*" TABLES
*" E_T_VARIANT STRUCTURE RSPARAMS
*"--------------------------------------------------------------------
IF i_s_bwselp-smohpubl IS INITIAL.
MOVE-CORRESPONDING i_s_bwselp TO e_t_variant.
e_t_variant-option = i_s_bwselp-opti.
APPEND e_t_variant.
ELSE.
CALL FUNCTION 'SMO2_GET_SUBSCRIPTION'
EXPORTING
i_bwrfc = i_bwrfc
i_bwuser =i_bwuser
i_s_bwselp = i_s_bwselp
TABLES
e_t_variant = e_t_variant.
ENDIF.
LOOP AT e_t_variant.
SELECT SINGLE userid INTO e_t_variant-low FROM smousers
WHERE sfamitabt = e_t_variant-low.
IF sy-subrc = 0.
MODIFY e_t_variant.
ENDIF.
ENDLOOP.
ENDFUNCTION.