UUID For Vendor Invoices
UUID For Vendor Invoices
Follow the
below mentioned steps for achieving this requirement.
IMPORTANT: You need to create a Function Group in customer namespace (for ex: ZTEST_MX
as used in the following screenshots). The screen (20 in this case) has to be created under this
function group.
STEP 1: In case the UUID is to be added to Invoice header, please add the YUUD field as
customer field in append structures of INVFO, RBKP, RBKP_V, ACMM_VENDOR_COMP.
method IF_EX_BADI_FDCB_SUBBAS05~PUT_DATA_TO_SCREEN_OBJECT .
* fill interface attributes from importing paramters
me->if_ex_badi_fdcb_subbas05~invfo = im_invfo.
endmethod.
method IF_EX_BADI_FDCB_SUBBAS05~GET_DATA_FROM_SCREEN_OBJECT .
* fill export parameters from interface attributes
ex_invfo = me->if_ex_badi_fdcb_subbas05~invfo.
endmethod.
STEP 4: Create a screen (for ex: 20) for the Z implementation. This screen 20 must have the
UUID field by referring to YUUD field of INVFO structure added in Step 1. Provide the master
program associated with the function group created earlier. The same has been highlighted in
RED below.
STEP 5: Declare the following variables in the top include of the program assigned to screen
20(in this case: SAPLZTEST_MX).
STEP 6: Code the necessary logic to ensure that the YUUD field appears only for the required
tcodes.
The following logic provided is for reference only. Please add the additional logic as per your
business need.
MODULE receive_data.
MODULE Hide_fields.
MODULE receive_actual_data.
FIELD: INVFO-YUUD.
MODULE USER_COMMAND_0100.
*&---------------------------------------------------------------------*
*& Module receive_data OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE receive_data OUTPUT.
IF o_badi_fdcb_subbas05 IS INITIAL.
CALL METHOD cl_exithandler=>get_instance_for_subscreens
CHANGING
instance = o_badi_fdcb_subbas05
EXCEPTIONS
no_reference =1
no_interface_reference =2
no_exit_interface =3
data_incons_in_exit_managem = 4
class_not_implement_interface = 5
OTHERS = 6.
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.
*&---------------------------------------------------------------------*
*& Module HIDE_FIELDS OUTPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE hide_fields OUTPUT.
LOOP AT SCREEN.
IF screen-group1 = 'MX'.
IF invfo-bukrs IS NOT INITIAL.
DATA: ls_t001 TYPE t001,
ls_t005 TYPE t005,
lv_nummr TYPE wt_acno,
lv_bcode TYPE bcode.
IF ls_t005-intca EQ 'MX'.
CASE sy-tcode.
WHEN 'MIRO'.
screen-input = 1.
WHEN OTHERS.
screen-active = 0.
ENDCASE.
ELSE.
screen-active = 0.
ENDIF.
ELSE.
screen-active = 0.
ENDIF.
ENDIF.
MODIFY SCREEN.
ENDLOOP.
*&---------------------------------------------------------------------*
*& Module receive_actual_data INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE receive_actual_data input.
* object created ?
CHECK NOT o_badi_fdcb_subbas05 IS INITIAL.
* get data from main screen
*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE USER_COMMAND_0100 input.
CHECK NOT o_badi_fdcb_subbas05 IS INITIAL.
* put data to main screen