Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Important Question on BADIs

Former Member
0 Likes
619

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

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

2 REPLIES 2
Read only

madhu_vadlamani
Active Contributor
0 Likes
582

Hi Tanmoy,

This is how a standard will work if sap provides. I do not think this will work because where you are going to keep you includes and how the document flow you will handle.

Regards,

Madhu.

Read only

former_member1716
Active Contributor
0 Likes
582

Hi tanmoy,

Can you please tell me the fields that you are going to add is custom fields, or standard fields.

On both cases it is possible,but logic differs.

May be the method suggested by you above helps you are not, but i have done the same as above with slight modifications, and it can be done

Please get back if you need any info on this