Thursday, 13 July 2017

Adding Custom Fields in WZR1,WZR2 and WZR3

Creating Additional Tab in WZR1/WZR2/WZR3

Now here is the document to show how to create an Additional Tab in WRZ1 (Settlement Request) screen. I did this as per my requirement which is for creating Payment Settlement Request.Here the data is coming from the IDOC to SAP server and to track the Payment Information the Settlement request is created and gets stored in the Standard WBRK table.

Now in this IDOC, it contains some IMP user specific data which needs to be stored ,it can be anything in my case it is  For Ex. IDOC number, IBAN number, SWIFT key and many more for which there is no fields provided in the Standard WBRK table. Now so as to store those values in WBRK table we need to create Custom Fields in WZR1 screen as well as in WBRK table.

If you have the requirement for adding custom field to WZR1 tcode then this is the way for creating the Tab. Follow the steps below as mentioned below

First of all we need to get the S_Develop authorization for enhancing the standard table i.e. WBRK table. After getting the authorization create the Z fields as per your requirement just like I did as described below.

ABAP Development

After extending the standard table, check it in WBRK table for confirmation.

ABAP Development

As of now it looks like we are going fine. Now we have to create a Project using CMOD for enhancing the screen of WZR1 tcode.

Create a project in cmod and in its Enhancement Category give this exit name LWZRE011, then click on its component. You will find function exit EXIT_SAPLWLF2_006 and EXIT_SAPLWLF2_007 implement these by double clicking on this exit. When you double click these Function exit , you will find these customer exits ZXLFXU21 and ZXLFXU22 double click on that as well so as to implement them.

ABAP Development
ABAP Development

Now exit ZXLFXU21 and ZXLFXU22 have been implemented .
Now we will create the screen for adding the additional fields in WZR1,WZR2,WZR3 tcodes.
In the Screen exit you will find the screen no 244 Header screen. Double click on that exit and click on its layout button .

ABAP Development

ABAP Development

ABAP Development

Here it is where we have to create the additional fields to be added to WZR1 tcodes. Create the fields as per your requirement like I did for mine. After that give the names of your Custom fields as per your requirement and naming convention. Just be sure that these names are going to be used in our customer exits which we have implemented above.

ABAP Development

Till here a major part of our work is complete, Now so as to make sure we are in the right direction go to WZR2 tcode and enter a settlement request. Then click on GOTO in the Menu tab -> Header -> Details . Here you will find the Additional Data Tab, click on that you will find your custom fields added there.

Congrats you did a great job to add your fields in the Header Information of Settlement Request.

Before moving further place a hard breakpoint in both of the implemented exits.

Now enter some values in those custom fields and press Save button . As soon as you press the save button the breakpoint will get triggered this indicates the Exits are well implemented.

Now to save those entered value we also have to do some code in the Exit as described below.

ABAP Development

Here you might notice that standards structure i_komlfk e_komlfk consisting our Z fields. You can also find them in the Importing parameters of Function Exit EXIT_SAPLWLF2_006 and EXIT_SAPLWLF2_007 as Highlighted above. These fields are automatically gets created when you append the standard Table WBRK.

The first exit got triggered is ZXLFXU22 here we will pass the value entered in the Z fields to the standard structure to be get stored in our Table WBRK.

ABAP Development

Similarly will do the same in the next Exit as described below.

ABAP Development

Now the only this which is left is to restrict user to enter in WZR3 tcode and make our Z fields disable.

For that go to the CMOD enter project name -> component -> SAPLWLF2 244 Header screen (You already have been here).

ABAP Development

Now double click on PBO it will lead to create an exit ZXLFXO01,double click on that to implement that exit as well .Now do as described below.

ABAP Development

Everything has been created perfectly. You can execute it.

No comments:

Post a Comment