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

Adding fields to the vendor master screen without append structure

Former Member
0 Likes
4,079

Hi,

My requirement is to add 2 custom fields to the vendor master screens without using the append structure approach. Would this be possible by using a custom table and using the BADIs VENDOR_ADD_DATA and VENDOR_ADD_DATA_CS?

Please could you help me out with the step by step detail of using a custom table with these 2 BADIs without appending any fields to LFA1.

Thanks & Regards,

Neera Sood

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,845

Hi Raymond,

Thank you for your response. Could you be a bit more explicit on which parameters I can use. Please could you give me an example.

Thanks ,

Neera

13 REPLIES 13
Read only

Former Member
0 Likes
2,845

Hi Neera,

If you do not want to have an append structure you need to put all the primary keys of your requirement  ( i assume its only Customer Number i.e. KUNNR) in the Z table and put the Z fields.

Now The BADI's mentioned by you will add additional tab and it is similar to Customer BADI. Steps for the same are well documented at http://saptechnical.com/Tutorials/ABAP/XD01/XD01.htm

BR,

Ankit.

Read only

bastinvinoth
Contributor
0 Likes
2,845

Hi Neera Sood

Check SAP Note 580266 - Enhancements without modification in vendor master

http://pavelgk.pbworks.com/f/sapnote_0000580266.pdf

See this also further reference

Regards,

Bastin.G

Read only

former_member193464
Contributor
0 Likes
2,845

yes possible ,
first there a little config you need to do on Free enhancement of Vendor Master Record. you need to create a screen group and label it.
Then vendor_add_data badi you need to  implement method CHECK_ADD_ON_ACTIVE
for your screen group set e_active = 'X' (this is the only thing you need to do in this BADI)
Then VENDOR_ADD_DATA_CS , fileter dependent on the screen group that you created in the config. you need to implement get_taxi_screen , passing the Zscreen you made in a seperate function group.

Now in GET_DATA and SET_ DATA you can call two custom FM that you would specifically make for your custom screen passing data to screen(storing it in the PAI of your custom screen) and setting data (reading data and passing it to screen in PBO of your custom screen).
I think the link provided above by all are very helpful....

one thing though , you actually need to save data at PAI to your custom table as you are not appending it to lfa1 , or you can use memory id to transfer it to memory , and in the method save_data of your vendor_add_data save it once to the database.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
2,845

Yes it is possible, but you will have to codein the BAdI the read/update with database.

(Look at methods IF_EX_VENDOR_ADD_DATA~READ_ADD_ON_DATA and SAVE_DATA of VENDOR_ADD_DATA)

Regards,

Raymond

Read only

Former Member
0 Likes
2,845

Hi everyone,

Thank you for your help. I will try this out in my system and get back to you.

Regards,

Neera Sood

Read only

0 Likes
2,845
  1. Go to Transaction SPRO à Logistics – General à Business Partner à Customers à Control à Adoption of Customer’s own Master Data fields à Prepare Modification à Free enhancement of Customer Master Record. 

Following screen appears:             

Go to CHANGE mode and Click ‘New Entries’ button. Then add a Screen Group (SK here)and meaningful description. Save the entry and then SELECT that entry and Click on ‘Label Tab Pages’.

       

Add a Label Tab Page i.e. enter a Screen Number, Function Code and Meaningful Description.

Save the entry and come back to the SPRO screen. Click Business Add-in: Processing Master Data Enhancements 

 

Create one Implementation by giving implementation name (must start with Z. ZSURESHKUMAR here). Give meaningful description and press enter. The following screen appears. 

 

Go to Interface and Click on ‘CHECK_ADD_ON_ACTIVE’ method. Add the following code and save. 

method IF_EX_CUSTOMER_ADD_DATA~CHECK_ADD_ON_ACTIVE .

data: l_flg_active type BOOLE-BOOLE.

if i_screen_group = 'SK'. 

      e_add_on_active = 'X'. 

  endif.

  1. endmethod. 

 

Activate that and come back to SPRO initial screen. Click Business Add-in: Customer Subscreens 

The following screen will appear. Create one implementation (ZSURESHKUMAR1 here).  

 

Press enter. The following screen will come. Enter a meaningful Description and Screen Group (which we created earlier) as shown below. 

Then go to Interface  

 

Create a Function Pool SAPLZSURESHKUMAR. (See the code of the program for other details). Create a Screen ‘1111’ with field old Customer Number – screen group PSK (SE51)

Click on GET_TAXI_SCREEN method and add the following code. 

method IF_EX_CUSTOMER_ADD_DATA_CS~GET_TAXI_SCREEN .

case i_taxi_fcode.

    when 'SK_TAB'.

      e_screen  = '1111'.  "Eart + Objekt

      e_program = 'SAPLZSURESHKUMAR'.

      e_headerscreen_layout = ' '.

  endcase.

  1. endmethod. 

 

Activate and leave the transaction. 

Go to KNA1 (Customer Master) table and add a custom field as shown below. Activate the table

Now go to XD01 transaction. 

The screen we created will appear as shown in the above screen-shot. Click the button. The following screen will appear. 

 

Enter a customer number and save the transaction. Now go to KNA1 table and check the value of the Old Customer Number field’s value. The value you entered in this screen will appear on there. 

Until now, we have written code for creating the Custom field. Now we need to disable that field when we are opening the transaction in DISPLAY mode. 

 

Go to include – LZSURESHKUMARTOP and enter the following code and activate the program. 

 

Now execute the Transaction in display mode and check the output.  

Regards

Naresh

Read only

0 Likes
2,845

Hi,

    Yes it is possible.Create z table with key as header table key if you want add fields in header data or item table key if you want to add item level .Then add tab,screen ,fields as normal but you have to write your own update function module  and call it in IF_EX_VENDOR_ADD_DATA~ SAVE_DATA. In display mode you need to select data from custom table and  make available  in IF_EX_VENDOR_ADD_DATA~READ_ADD_ON_DATA

Regards,

Sreenivas.

Read only

Former Member
0 Likes
2,845

Hi ,

I have updated/modified the custom table in the method IF_EX_VENDOR_ADD_DATA~SAVE_DATA and I have set the data in method IF_EX_VENDOR_ADD_DATA_CS~SET_DATA.

Could you let me know how I will get the data when switching between screens? The GET_DATA method of IF_EX_VENDOR_ADD_DATA_CS and the READ_ADD_ON_DATA of IF_EX_VENDOR_ADD_DATA do not have an interface(signature) to support the new fields from the custom table.

Thanks,

Neera

Read only

0 Likes
2,845

You should "store" the data related to your z-table in some instance attributes of the BAdI implementing class. Of course you could also add your own methods like read_my_data and save_my_data in this class.

Regards,

Raymond

Read only

Former Member
0 Likes
2,846

Hi Raymond,

Thank you for your response. Could you be a bit more explicit on which parameters I can use. Please could you give me an example.

Thanks ,

Neera

Read only

0 Likes
2,845

One soultion could be

  • Defining an instance attribute with the structure of the ztable
  • (Opt) Define an instance method get_Zdata which read the attributes and return its value
  • (Opt) Define an instance method set_Zdata which receive the structure and update the instance attribute
  • Define an instance method read_Zdata_from_database, which execute the select from database and update the instance attributes (can use me->set_Zdata)
  • Define an instance method save_Zdata, which read the instance attributes (can use me-get_Zdata), and call an update FM in update task to update database table
  • In PBO method/exit call me->get_Zdata or read attributes
  • In PAI method/exit call me->set_Zdata or update attributes

Many variations availabe, like storing data in a function group (same that would contain the subscreen)

(And yes, much simplier to append z-fields, and so get the data from standard)

Regards,

Raymond

Read only

Former Member
0 Likes
2,845

hi,

Please could you let me know how I can access the vendor number in the new subscreen which has been created for the additional custom fields.

The vendor number is required for selection from the custom table in the PBO of the subscreen.

Alternatively, please could you let me know how I can fetch the details of the custom fields from the custom table for vendors which already have data in the custom fields i.e. in change mode

Thanks,

Neera

Read only

0 Likes
2,845

Hi Neera,

Try reading the screen Field Value as,

field-symbols <fs_lifnr> type any.

constants lc_lifnr type char30 value '(SAPMF02K)LFA1-LIFNR'.

Assign (lc_lifnr) to <fs_lifnr>.

<fs_lifnr> is the field symbol with your value.

BR,

Ankit.