Application Development 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: 

Screen Badi in ME21N

Former Member
0 Kudos

Hi Experts.....

I have implemented a screen exit in ME21N Transaction to add custom fields. With this I could get an extra custom tab in which I have included my fields. Now my req is to get multiple tabs as the fields are more in number. So I wanted to implement this using a BADI. I have searched the BADI named ME_GUI_PO_CUST.

in this I have passed the screen no and program name and label name along with element as PO and name of view as HEADER. But I cannot see an extra TAb in header details. I also created the subscreen and the corresponding program...

Can anyone help me to implement a screen badi in ME21N.

Thank you in advance

6 REPLIES 6

Former Member
0 Kudos

Hi Shakti,

The BADI ME_GUI_PO_CUST has an example implementation class CL_EXM_IM_ME_GUI_PO_CUST. Check the method SUBSCRIBE to see how the BADI can be subscribed.

The reason why your custom screen is not appearing is probably because your BADI implementation is not active or the custom screen has not be subscribed properly.

The code inside method SUBSCRIBE of your BADI implementation should be as follows:


  DATA: ls_subscriber LIKE LINE OF re_subscribers.

* we want to add a customer subscreen on the item detail tab
  CHECK im_application = 'PO'.
  CHECK im_element     = 'ITEM'.

* each line in re_subscribers generates a subscreen. We add one subscreen in this example
  CLEAR re_subscribers[].
* the name is a unique identifier for the subscreen and defined in this class definition
  ls_subscriber-name = 'ITEMSCREEN1'.
* the dynpro number to use
  ls_subscriber-dynpro = '0001'.
* the program where the dynpro can be found
  ls_subscriber-program = 'SAPLMEPOBADIEX'.
* each subscreen needs his own DDIC-Structure
  ls_subscriber-struct_name = 'MEPO_BADI_STRUCT'.
* a label can be defined
  ls_subscriber-label = 'BAdI customer'.
* the position within the tabstrib can be defined
  ls_subscriber-position = 5.
* the height of the screen can be defined here. Currently we suport two screen sizes:
* value <= 7 a sevel line subscreen
* value > 7  a 16 line subscreen
  ls_subscriber-height = 7.

  APPEND ls_subscriber TO re_subscribers.

To impelement multiple tabs you have to subscribe each tab differently using the parameter

ls_subscriber-name

of the BADI

and also name each tab differently using


ls_subscriber-label 

Let us assume that you have to implement three tabs, then you have to subscribe each tab with a different name and also label each tab differently.

You can name subscribe the first tab with name ITEMSCREEN1 label BAdI customer, subscribe 2nd tab with name ITEMSCREEN2 label BAdI customer'2 and subscribe 3rd tab with name ITEMSCREEN3 label BAdI customer3.

Mention a different positions for each tab.

Like say for BADI customer1 ls_subscriber-position = 5., for BADI customer2 ls_subscriber-position = 6. and for BADI customer3 ls_subscriber-position = 7..

Also append the subscribe data three times for the three tabs.

This will display three tabs with names BADI customer1, BADI customer2 and BADI customer3.

Hope the above information helps.

Regards,

Abhisek.

0 Kudos

Hey Thank you Abhishek.......

I have check the sample code and did the same way.. And also activation is done. But there is a parameter Structure name... What is that?? What shud I write there??????

0 Kudos

Hi Shakti,

Suppose in the there are three tabs BADI customer1, BADI customer2 and BADI customer3 at item level.

Say:

On BADI customer1 there are three fields FIELD1, FIELD2 and FIELD3.

On BADI customer2 there are two fields FIELD4 and FIELD5.

On BADI customer3 there are three fields FIELD6, FIELD7 and FIELD8.

Then the fields have to be added to EKPO (or requisite custom table as the need may be) and also fields are also to be added to custom structures.

Create a Structure ZSTRUCTURE1 which will contain the three fields FIELD1, FIELD2 and FIELD3.

Create another Structure ZSTRUCTURE2 which will contain the two fields FIELD4 and FIELD5.

Create another Structure ZSTRUCTURE2 which will contain the three fields FIELD6, FIELD7 and FIELD8.

The Structure STRUCTURE1 has to be passed for tab BADI customer1, the Structure STRUCTURE2 has to be passed for tab BADI customer2 and the Structure STRUCTURE3 has to be passed for tab BADI customer3.

Each custom tab/screen should have its own structure to handle the screen fields, but the screen field data has to be transfered to and from EKPO (or requisite custom table as the need may be) for database update/retrieve.

Hope this helps.

Regards,

Abhisek.

0 Kudos

Thank you Somuch....

I have not yet placed any fields in the tab. I have just put a text field with some text. thats it. so no need to pass structure as there are no fields. But its not getting triggered...

0 Kudos

Hi Shakti,

Passing a Structure Name is must, because the standard program checks if the value of structure is not initial and continues further processing only if condition is fulfilled.

So even if you are using a text field define a structure for this screen, at least one field from the custom structure for the screen has to be displayed on the screen.

Moreover a screen enhancment is generally not done to display a text field only. Screen enhancements are generally used to display custom/additional input/output fields. So a structure should always be created and passed. Otherwise no tab will be displayed.

Hope this helps.

Regards,

Abhisek.

Former Member
0 Kudos

This message was moderated.