Skip to Content

Finding 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.

     –   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! 

Picture1.jpgF8

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.

Picture2.jpg

          ** 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)

Picture3.jpg

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.

Picture4.jpg

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.

Picture5.jpg


  1. 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.

*** 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,

Picture6.jpg

  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

Picture7.jpg

.

Picture8.jpg

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

Picture9.jpg

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

Enhancement of structure is as fallows :

Picture10.jpg

Click on the append structure form the goto menu item

Picture11.jpg

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

Picture12.jpg

Give the name of the structure to append.

Picture13.jpg

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

Picture14.jpg

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.

Picture15.jpg

Code:

MODULE STATUS_1100 OUTPUT.
*  SET PF-STATUS ‘xxxxxxxx’.
*  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 SYTCODE EQ ‘XK03’.” Display
screeninput = ‘0’.
ELSEIF SYTCODE EQ ‘XK01’ OR SYTCODE EQ ‘XK02’.
screeninput = ‘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.


Picture16.jpg

7. Now Implement the fist BADI: VENDOR_ADD_DATA

Goto SE18.

  1. 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.

Picture17.jpg

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

Picture18.jpg

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 manually
if I_SCREEN_GROUP = ‘ZC’. ” check the import parameter for the screen group name.
e_add_on_active
= ‘X’. ” Activate it by setting the return parameter
endif.
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.

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.

Picture19.jpg

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 name
AND i_taxi_fcode = ‘ZFIRM’. “And import parameter FCODE for Tab : for custom Tab Function code
” If these two are true then
e_screen  
= ‘9000’.   “set the changing parameter sub-screen to custom sub-screen number u created in FG ZMM_ZC
e_program 
= ‘SAPLZMM_ZC’“Function Group (Main program name of the function group ZMM_ZC)
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’
EXPORTING
iv_zzfirm_type      
= I_LFA1zzfirm_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:

method IF_EX_VENDOR_ADD_DATA_CS~GET_DATA.
DATA lv_zzfirm_type TYPE zzfirm_type.
CALL FUNCTION ‘Z_GET_FIRM_TYPE’
IMPORTING
EV_ZZFIRM_TYPE      
= lv_zzfirm_type
.

S_LFA1zzfirm_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
= LFA1ZZFIRM_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.

Picture20.jpg

Picture21.jpg

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 .


To report this post you need to login first.

41 Comments

You must be Logged on to comment or reply to a post.

  1. Silvio Miranda

    Very good information.. I applied into our system.. we created 2 new tabs to XK01/02/03.. it works perfectly… thank you for sharing this Malathesha Sodad!! 🙂

    (0) 
  2. Luís Martins

    Hello Malathesha. Great work! I’ve a question: Is it possible to control button “Additional Data” according to Sales Area? I would like to show the button when Sales Area Info is filled. What do you know about this?

    (0) 
    1. Raymond Giuseppi

      Can be performed in IF_EX_VENDOR_ADD_DATA_CS~SUPPRESS_TAXI_TABSTRIPS method :

      * Hide company tab if not passed or not allowed
      IF i_bukrs IS INITIAL.
         APPEND ‘Z1-LFB1’ TO e_not_used_taxi_fcodes.
      ELSE.
         AUTHORITY-CHECK OBJECT ‘F_LFA1_BUK’
                  ID ‘BUKRS’ FIELD i_bukrs
                  ID ‘ACTVT’ FIELD ’03’.
         IF sysubrc NE 0.
           APPEND ‘Z1-LFB1’ TO e_not_used_taxi_fcodes.
         ENDIF.
      ENDIF.


      Regards,

      Raymond

      (0) 
    2. Malathesha Sodad Post author

      Hi Luís Martins,

      The solution that Raymond Giuseppi given will work fine to suppress the tab strips within the subscreen, suppose like If you have got two tab strips in which one of the tab strip will be having elements to capture info related to sales area. then you can control that using the above code. For suppressing entire button I don’t think it is possible bcoz its the part of config.

      Regards,

      Malathesha Sodad

      (0) 
    3. Sachin Adak

      Hi Luis,

      Below code can be used to control visibility of button based on Conditions:

      Include                                        :   MF02DFE0

      Implicit Enhancement under form   :  EXCTAB_FUELLEN_ANLEGEN

      DATA :LV_FIELDNAME TYPE STRING.

         FIELD-SYMBOLS:  <LV_FIELDNAME> TYPE ANY.

      * Check if User has entered Sales Area Details

      IF  RF02D-VKORG IS INITIAL AND

          RF02D-VTWEG IS INITIAL AND

          RF02D-SPART IS INITIAL .

      * Hide Custom Button or Sales Area additional fields ( Screen group YY)

      DATA:  LV_FIELDNAME(30)     TYPE C VALUE ‘DYNAMIC_FUNCTION-GOTO_ADDON_’, LV_SCGR_COUNTER_N(2) TYPE N.

      DATA: LS_SCGR_ACTIVE TYPE LINE OF ZDTT_OM_SCGR_ACTIVE.

      CONSTANTS : LC_GRP TYPE ZDS_OM_SCGR_ACTIVE-SCREEN_GROUP VALUE ‘Z1’.

        LOOP AT I_GT_SCGR_ACTIVE INTO LS_SCGR_ACTIVE  WHERE SCREEN_GROUP = ‘YY’.

      * wegen führender Null bei ‘_01’

            LV_SCGR_COUNTER_N   = SY-TABIX.

            LV_FIELDNAME+28(2)  = LV_SCGR_COUNTER_N.

            MOVE LV_FIELDNAME TO I_FS_FNAME.

            CLEAR LS_SCGR_ACTIVE.

            EXIT.

          ENDLOOP.

      * Pass Null value to Button and make it disappear from App. tool bar

        ASSIGN (LV_FIELDNAME) TO <LV_FIELDNAME>.

        <LV_FIELDNAME> = SPACE.

      Regards,

      Sachin

      (0) 
  3. Arindam Ghosh

    Dear Mr. Sodad,

    Thank you so much for this post. This couldn’t have been described in a better way. I’m a beginner and it was just what I needed. I am looking forward to reading more posts like this on different subjects related to SD(or anything).

    Regards,

    Arindam

    (0) 
  4. Stefano Casari

    Hello Malathesha.

    Great article!

    I’ve a question to you: i performed all as you explained and i have my custom screen with a checkbox field. When i access with XK02, i put the check at my custom field and I click SAVE the transaction says to me: “no changes were made” and in LFA1 (with the custom table append) my new field still empty.

    Have you got any suggest?


    Thank you.

    Best regards,

    Stefano

    (0) 
        1. Vinicius Souza

          Hello Malathesha,

          I’m facing the same problem Stefano had.

          But I could not find the problem. Could you please suggest?

          Regards.

          (0) 
      1. Vinicius Souza

        Hi Stefano,

        Could you explain better what you have done? I’m facing the same problem, I did as you told, but the problem persists.

        Regards.

        (0) 
        1. Stefano Casari

          Hi Vinicius,

          My problem was in Z_GET_FIRM_TYPE and Z_SET_FIRM_TYPE.

          The LFA1 filed name that we want to manage, in this case LFA1-ZZFIM_TYPE, must be equal to the field name in your dynpro. So equal to the field that you add in LFA1 using append structure.

          I hope was clear enough.

          Regards

          Stefano

          (0) 
          1. Vinicius Souza

            Hi Stefano,

            I did as you told and it worked. In Dynpro we must refer to table and field.

            The name of new field must be the same that is appended in LFA1.

            Regards.

            (0) 
  5. Gaurav Karkara

    Hello Malathesha,

    Thanks for the great blog.

    I have a question. When we click on ‘BACK’ button in new subscreen, system will ask you to save the vendor first & when saved it comes out to vendor master initial screen. Logically, it should have gone to previous screen without asking to save. I expect it to work similar to ‘Tax Categories’ pushbutton in ‘Vendor:Control’ screen w.r.t. ‘BACK’ button functionality but its not working so.

    Can you help on this?

    Regards

    Gaurav K

    (0) 
    1. Malathesha Sodad Post author

      Hi Gaurav Karkara

      In this case what I would suggest you is to go ahead and create an local button on the taxi screen (like you would have seen some buttons inside the tabs) and handle the back button in the taxi screen’s PAI.

      Hope this will works for your use case…!

      (0) 
  6. Nunda Riengchan

    Hello Malathesha,

    Can the custom field be add to the company code data (table LFB1) instead of LFA1? Also, can we make the custom field added to the company code data mandatory for specific company code? In our system, multiple company codes share the same account group and certain information is required for certain company code. Appreciate if you could share with me the solution.

    Regards,

    Nunda

    (0) 
    1. Malathesha Sodad Post author

      Hi Vinicius Souza,

      You can do it… Check one of the screen exit. Write an if statement to check the sy-tcode if any tcode other than xk01 or 02 you can change the visiblity of the button by looping in the screen elements in one of screen exit PBO event.


      Let me know if you need any help.! 🙂


      Regards,

      Malathesha Sodad

      (0) 
  7. Malathesha Sodad Post author

    Hi David López Alcaide,

    This can easily be achieved, I did some trails and worked fine for me. Thinking of to recreate the newer version of this document. As your query is a very valid one.!! 🙂


    Thanks for your findings.


    To take this effect on to the fk04 or xk04 all you have to do is just make additional field data element’s change document check box active. This you will find it under the further characteristics of Data Element in SE11.

    fk04 and xk04 are not really any transactions as such. They are just some reports looking for data flagged for the change document.

    Read more on ‘Change documents’ under ABAP dictionary for more information.

    Hope this will help you…!

    Regards,

    Malathesha Sodad

    (0) 
      1. Malathesha Sodad Post author

        Hi David López Alcaide,

        Hmm for this if you really want to track you should have this check box ticked. And I am not sure if you any other logistics related customization which will help you to achieve this. Please talk to some functional expertise if you can get this fixed.

        As I said, technically possible and can easily be achieved with this tick.

        The last other options would be find the function module generated for the change object( you need to findout the change object used in the xd04 for LFA1 table) and write enhancement before calling write_change_document or inside write_change_document. (again these are just alternatives)

        Thanks And Regards,

        Malathesha Sodad

        (0) 
      1. Perinbarani shunmugavelu

        Hi Malathesha,

        Am a SRM Technical Consultant, sitting @ customer location.

        Need your assistance on this. Even i need to achieve the same.

        But not the custom screen.. need to add a custom check box in XK01 under conditions.

        xk01 screen.png

        can u mail me… perinbarani.maniraj@gmail.com.

        I need to discuss with you regarding the flow to enhance xk01.

        Thanks,

        Rani.

        (0) 
  8. Uma Shankar Nachimuthu

    Hi Malathesha Sodad,

    It is an wonderful article, it did save my day. It works fine for me, though i have a small enhancement in this enhancement 😛 , it is the ‘Additional Data’ button should be visible only in the Address screen i.e., Address, and after that it should be invisible like the ‘Tax Categories’ is visible only in Control. Can you kindly help me to sort this out.,

    Thank you in advance.

    (0) 
    1. Malathesha Sodad Post author

      Yes,You can do it. It is very simple check for the sub screen number or like the tab active and then control the visibility of the button.

      (0) 
      1. Uma Shankar Nachimuthu

        Hi Malathesha Sodad,

        Thank you for the idea, can you be little more specific on where i have to check for the sub screen number or tab active to control the visibility? i.e which class of the BADI

        (0) 
        1. raja rajan anbalagan

          Hi Uma Shankar,

          I have the similar requirement now to be done in our system. Were you able to achieve this? If so, could you please tell me what needs to be done?.

          Thanks,

          Rajarajan

          (0) 
        2. raja rajan anbalagan

          Hi Malathesha,

          This article was very helpful. I have the same question which Uma Shankar has posted, Is it possible to have the custom button only visible on the address tab? If so, could you please suggest how to do it?

          Thanks,

          Rajarajan

          (0) 
  9. Miguel Alvear

    Hi Malathesha.

    Very good article, I’m just doing something like this and it is very helpful.

    Question, does it work on Fk01, FK02, FK03 and MK01, MK02, MK03???

    shoud work also or not?

    Regards

    Miguel

    (0) 
  10. Veena S

    Hi,

    Thank you for the documentation.

    I added a new custom field in the screen as per this document. But I am unable to find it when I try to record BDC. Could you please help me to update this custom field using BDC ?

    Thanks in advance,

    Veena

    (0) 

Leave a Reply