Hello Experts,
Is it possible to achieve a screen-enhancement using BADI. Let me explain in detail on what I wanna achieve.
Requirement:
Let us assume that I have a standard SAP transaction that has several fields; now the customer requests to put 2 more additional Z-fields on to screen.
I know that this very much achievable through a lot of options that SAP has provided to the developers. But here I want to achieve this requirement using a custom BADI.
I was thinking will the following steps of logical execution that are mentioned below make us achieve the same.
1. We will define a custom BADI in SE18 using the Enhancement Spot Technology.
2. Create an Interface containing 2 methods namely
PUT_DATA_TO_SCREEN
GET_DATA_FROM_SCREEN
3. Create an Enhancement Implementation.
4. Create a BADI implementation that holds the logic for the above methods.
5. Create a screen of the Subscreen type. Arrange the required fields on the screen.
6. Write the program for the screen by creating either a module pool or a function group.
It holds the following content (From help.sap.com)
Topinclude:
DATA:
lo_exit TYPE REF TO zif_ex_badi_screen,
flight TYPE sflight.
At PBO time:
MODULE status_0100 OUTPUT.
IF lr_exit IS INITIAL.
CALL METHOD cl_exithandler=>get_instance_for_subscreens
CHANGING
instance = lo_exit
EXCEPTIONS
OTHERS = 6.
ENDIF.
CALL METHOD exit->get_data_from_screen
IMPORTING
flight = flight
EXCEPTIONS
reserved = 1
OTHERS = 2.
ENDMODULE.
At PAI time:
If data has been changed, the method PUT_DATA_TO_SCREEN is called at PAI.
MODULE user_command_0100 INPUT.
CALL METHOD exit->put_data_to_screen
EXPORTING
flight = flight
EXCEPTIONS
reserved = 1
OTHERS = 2.
ENDMODULE.
7. Choose the Subscreens tab. Enter the name of the called program and of the subscreen.
8. Make a trigger to the BADI from the Standard program.
Will this work out?
Regards,
Tanmoy