16
inding out the BADI’s to implement to full fill the requirement of adding custom fields to the Vendor Master. SPRO -> Logistics -> General -> Business Partner -> Vendors - > Control -> Adoption of Customer’s Own Master Data Fields (last Option) -> Prepare Modification-Free Enhancement of Vendor Master Record (Click on IMG Activity Documentation) Information : Prepare Modification-Free Enhancement of Vendor Master Record Use You can enhance the master data of your customers and vendors (FI and LO) in order to add additional information. To do this, you develop subscreens to which you add the required fields. You can access your subscreens in the master records of the business partner via integrated buttons; there, your screens are integrated on tab page. You can assign up to 32 tab pages/subscreens to each button. With a change of release, upgrade, or a support package, you copy your own subscreens and data and the relevant tables without having to make any modifications. In this IMG activity, you prepare the modification-free transfer of enhancements from your business partner masters. Activities In the following, " business partner" indicates " customer" and " vendor". 1. Choose Edit screen group <business partner>, and define a two digit alphanumeric key and a name for each of the required screen groups. The name of the screen group appears later in the form of a pushbutton on the initial screens of your business partner master data.

BADI for Vendor

Embed Size (px)

DESCRIPTION

Additional tab in vendor master

Citation preview

Page 1: BADI for Vendor

inding out the BADI’s to implement to full fill the requirement of adding custom fields to the Vendor Master.

SPRO -> Logistics  -> General  -> Business Partner  -> Vendors  -> Control  -> Adoption of Customer’s Own Master Data Fields (last Option)  -> Prepare Modification-Free Enhancement of Vendor Master Record (Click on IMG Activity Documentation)

 

Information :

Prepare Modification-Free Enhancement of Vendor Master Record

     Use

     You can enhance the master data of your customers and vendors (FI and     LO) in order to add additional information. To do this, you develop subscreens to which you add the required fields. You can access your subscreens in the master records of the business partner via integrated buttons; there, your screens are integrated on tab page. You can assign up to 32 tab pages/subscreens to each button. With a change of release, upgrade, or a support package, you copy your own subscreens and data and the relevant tables without having to make any modifications.

     In this IMG activity, you prepare the modification-free transfer of enhancements from your business partner masters.

Activities

In the following, "business partner" indicates "customer" and "vendor".

1. Choose Edit screen group <business partner>, and define a two digit alphanumeric key and a name for each of the required screen groups. The name of the screen group appears later in the form of a pushbutton on the initial screens of your business partner master data.

    To use your enhancement, that is, your button is visible, activate it with the BADI Processing Master Data Enhancements with method CHECK_ADD_ON_ACTIVE (see step 3 below).

1. Choose Name tab page, and for each screen group, enter the data required for the tab pages.

     For each screen group you can create a maximum of 32 tab pages.

     Note the following:

     -   With Ordinal number, you control the order of the tab pages.

Page 2: BADI for Vendor

     -   With the Function code, at runtime, the system identifies the tab page selected by the user.

     -   The Name appears as heading on the tab page.

     -   The Icon (optional) appears next to the heading on the tab page.

     You call up the tab pages in the business partner master data via the corresponding pushbutton. Each tab page contains your customer-specific subscreen on which you can process your business partner data.

     You integrate your subscreens using the filter-dependent BADI Customer Subscreens; choose your screen group as filter (see step 3 below).

1. To link your subscreens and data to the standard application, use the following BADIs:

     -   Business Add-In: Processing Master Data Enhancements (CUSTOMER_ADD_DATA/VENDOR_ADD_DATA)

     -   Business Add-In: Customer Subscreens (CUSTOMER_ADD_DATA_CS/VENDOR_ADD_DATA_CS)

     -   Business Add-In: Processing Master Data Enhancements with Batch Input (CUSTOMER_ADD_DATA_BI/VENDOR_ADD_DATA_BI)

     You can access the BADIs in the Implementation Guide directly under this IMG activity; for more information see the documentation for the relevant BADIs and their methods.

  Now Go back to the IMG Screen. Actual activities Starts here!

F8

Click on continue on the Information POP-UP asking for Caution: The table is cross-client                             

** Define a two digit alphanumeric key and a name for each of the required screen groups.

Page 3: BADI for Vendor

          ** This name of the screen group appears later in the form of a PUSHBUTTON on the initial screens of your business partner master data.

  POST View after doing this activity in XK03 (XK01, XK02)

Page 4: BADI for Vendor

Once Added the screen group. Select the custom screen group from the list and then double click on the Label Tab Pages Item from the tree of Dialog structures.

 

Here you add your own custom tabs; you can add as many number of tabs you need, as of now we are adding only one tab with tab-name/Description (Caption/Labled) Custom Tab.

A. We will see in later Screen shots how it looks like in Vendor Master J

This is the tab  to which will need to add to A sub-screen (YET TO CREATE) which will be displayed upon clicking the custom screen group button from the vendor master tab.

Page 5: BADI for Vendor

*** Now, Your screen group and the tab to which you need to add the sub-screen is ready.

** Lets create the sub-screen which you need to add to created tab.

* For this You need to create a function-poll (Will explain why Function Pool and its Importance).

Lets create it using the T-code SE80,

 

1. So Enter the name of the function-pool / function group and create it.2. Create the sub- screen 9000(any number) which should not collide with the screen

numbers in the main program of XK01/02/03

 

.

 

3. On the sub-screen add the custom fields like: You can add many fields you want.

Page 6: BADI for Vendor

4. This is the screen field we add is enhanced structure item of LFA1.

Enhancement of structure is as fallows :

Page 7: BADI for Vendor

Click on the append structure form the goto menu item

From the pop up click on the Create button to add the custom structure.

Give the name of the structure to append.

Page 8: BADI for Vendor

Add the custom fields : ZZFIEM_TYPE only field now but can add many fields here.

Activate the structure and then use this element to insert it on to the screen.

 

5. Now go to the program logic write the logic for this particular screen.

Like below : say you want to make all these items to be in display mode when you are in XK03 and rest for XK01 and XK02 it should be in Edit mode.

Code:

MODULE STATUS_1100 OUTPUT.*  SET PF-STATUS 'xxxxxxxx'.

Page 9: BADI for Vendor

*  SET TITLEBAR 'xxx'.*  IMPORT act TO g_aktyp FROM MEMORY ID 'ZZACT'. “ check the exported activity type * and change accordingly the screen *                                             elements.*    LOOP AT SCREEN.*        IF g_aktyp = 'A'. " Display*            screen-input = '0'.*        ENDIF.*        MODIFY SCREEN.*   ENDLOOP.

 

 

  LOOP AT SCREEN.IF SY-TCODE EQ 'XK03'." Displayscreen-input = '0'.ELSEIF SY-TCODE EQ 'XK01' OR SY-TCODE EQ 'XK02'.screen-input = '1'.ENDIF.MODIFY SCREEN.ENDLOOP.ENDMODULE.                 " STATUS_1100  OUTPUT

 

6. As we are going to work with LFA1 Structure at run time you need to add this line TABLES: LFA1. To the function pools TOP Include.

7. Now Implement the fist BADI: VENDOR_ADD_DATA

Goto SE18.

A. Enter the definition(Interface) of the BADI as VENDOR_ADD_DATA . à Click on display.

  In the BADI display screen. Click on Implementation menu Item à choose the display to see all the implementations. But now Click on Create option from the menu list.

Page 10: BADI for Vendor

Enter the Name of the BADI Implementation name (Any Name) and click on ü Mark.

8. In this BADI enhance/redefine the method CHECK_ADD_ON_ACTIVE in your subclass/Implementation

Code:

method IF_EX_VENDOR_ADD_DATA~CHECK_ADD_ON_ACTIVE." If the screen group is ur custom screen group you have to activate it manuallyif I_SCREEN_GROUP = 'ZC'. " check the import parameter for the screen group name.e_add_on_active = 'X'. " Activate it by setting the return parameterendif.endmethod.

** Now your screen group is active. So now you can see the screen group as button on xk01/02/03 with a button and when u click on the button will take dump screen because the screen sub-screen is still not added to the tab that tab is not called yet.

Page 11: BADI for Vendor

 

9. Now Implement the other BADI VENDOR_ADD_DATA_CS:

Goto SE18.

Enter the definition(Interface) of the BADI as VENDOR_ADD_DATA_CS

  In the BADI display screen. Click on Implementation menu Item à choose the display to see all the implementations. But now Click on Create option from the menu list.

 

10. In this Implementation we will call the screen when the screen group is our custom screen group.here we handle the each individual custom screen groups.

To do this; In this BADI we will enhance/redefine the method GET_TAXI_SCREEN in your subclass/Implementation

CODE:

method IF_EX_VENDOR_ADD_DATA_CS~GET_TAXI_SCREEN.IF flt_val = 'ZC'  "Check the import parameter screen group if it is ur custom screen group nameAND i_taxi_fcode = 'ZFIRM'. "And import parameter FCODE for Tab : for custom Tab Function code" If these two are true thene_screen   = '9000'.   "set the changing parameter sub-screen to custom sub-screen number u created in FG ZMM_ZCe_program  = 'SAPLZMM_ZC'.  "Function Group (Main program name of the function group ZMM_ZC)

Page 12: BADI for Vendor

e_headerscreen_layout = ' '."Filter if u want to make it. as of now its global.ENDIF.endmethod.

 

11. Now your screen field is ready and displayed on XK01/02/03 but to SET/GET the value of these elements you have to redefine/enhance/implement the methods SET_DATA to set the value entered to LFA1/ (all other runtime structure) runtime structure and GET_DATA to get data from the LFA1/ (all other runtime structure) runtime structure and set it to the screen element from this same BADI Implementation.

SET_DATA: Method implementation.

In this we have only the import parameters which are structures and to set the runtime structure like LFA1. We have to do it from outside so to do this we will export value from this method through the FM call which is written in the Function Group ZMM_ZC and in which we will set the value (new value entered on the screen) to LFA1 runtime structure.

CODE:

method IF_EX_VENDOR_ADD_DATA_CS~SET_DATA.CALL FUNCTION 'Z_SET_FIRM_TYPE'EXPORTINGiv_zzfirm_type       = I_LFA1-zzfirm_type “ sent here             .endmethod.

Code:

Z_SET_FIRM_TYPE:

FUNCTION Z_SET_FIRM_TYPE.*"----------------------------------------------------------------------*"*"Local Interface:*"  IMPORTING*"     REFERENCE(IV_ZZFIRM_TYPE) TYPE  ZZFIRM_TYPE*"----------------------------------------------------------------------" LFA1-ZZFIRM_TYPE is the screen field name.LFA1-ZZFIRM_TYPE = IV_ZZFIRM_TYPE. “set here ENDFUNCTION. GET_DATA: Method implementation.

In this method we have to set the sub-screen value to the value which is there in the LFA1. But here I have access to the s_lfa1 which is screen structure, but to set the value of this entry we need access to this runtime structure so we will do it with the help of FM which is written in the Function Group ZMM_ZC.

CODE:

Page 13: BADI for Vendor

method IF_EX_VENDOR_ADD_DATA_CS~GET_DATA.DATA lv_zzfirm_type TYPE zzfirm_type.CALL FUNCTION 'Z_GET_FIRM_TYPE'IMPORTINGEV_ZZFIRM_TYPE       = lv_zzfirm_type.

S_LFA1-zzfirm_type = lv_zzfirm_type.endmethod.

CODE:

Z_GET_FIRM_TYPE:

FUNCTION Z_GET_FIRM_TYPE.*"----------------------------------------------------------------------*"*"Local Interface:*"  EXPORTING*"     REFERENCE(EV_ZZFIRM_TYPE) TYPE  ZZFIRM_TYPE*"----------------------------------------------------------------------"LFA1-ZZFIRM_TYPE is the screen field name.EV_ZZFIRM_TYPE = LFA1-ZZFIRM_TYPE.

ENDFUNCTION.

 

So by now you got to know why we added the tables statement : TABLES : LFA1. To the main program of the Function Group ZMM_ZC.

12. So now XK02 look like.

Page 14: BADI for Vendor

13. To add more fields follow the same procedure from beginning or can add custom fields to existing enhanced structure and can add the fields as elements and do the coding in set an get methods and Function Modules corresponding to the set and get methods .