01-03-2008 1:55 PM
Hi All,
I have to implement badi for customer master. my requirment is as follows.1) In the xd01 transaction i have to add a button like customers additional data.
2) in that there will two tab pages
general additional data
in this tabpage i have to add some custom fields which are aadded in kna1 table .
sales area additional data
in this tabpage i have to add some custom fields which are aadded in knvv table .
3)now i can do up to this by going to spro and executing these
badis and customizing the screen
4)now how can i save the data entered in to these tables .
since we have to use (Customer_Add_Data,Customer_Add_Data_cs )
Customer_Add_Data_cs---methods set_data--pbo of screen
and get_data----pai of screen
so please tell me the code to insert into these methods so that i can save the data in tables kna1 and knvv table
01-06-2008 3:42 PM
narasimha,
what a coincidence even i am stuck there,
could you please let me know how to use these methods set_data and get_data,
so that this BADI works perfeclty,
thanks
01-06-2008 4:37 PM
Narasimha,
Find below the Sample code for all the four methods.
Method GET_DATA
method IF_EX_CUSTOMER_ADD_DATA_CS~GET_DATA.
CALL FUNCTION 'ZSDCU_ADD_FIELDS_GET_DATA'
IMPORTING
E_KUNNR = S_KNA1-KUNNR
E_ZZSCPC = S_KNVV-ZZSCPC
E_ZZCSNM = S_KNVV-ZZCSNM
E_ZZDTCM = S_KNVV-ZZDTCM
E_ZZTEXP = S_KNVV-ZZTEXP
E_ZZTSTA = S_KNVV-ZZTSTA
E_ZZCERT = S_KNVV-ZZCERT.
endmethod.
****************************************************
Method SET_DATA
METHOD if_ex_customer_add_data_cs~set_data.
TYPES:
BEGIN OF tab_type,
col1(10),
END OF tab_type.
DATA:
wa_indx TYPE indx,
wa_itab TYPE tab_type,
cl TYPE mandt,
itab TYPE STANDARD TABLE OF tab_type.
wa_itab-col1 = s_kna1-ktokd.
APPEND wa_itab TO itab.
wa_indx-aedat = sy-datum.
wa_indx-usera = sy-uname.
wa_indx-pgmid = sy-repid.
EXPORT tab = itab
TO DATABASE indx(XY)
FROM wa_indx
CLIENT sy-mandt
ID 'TABLE'.
CALL FUNCTION 'ZSDCU_ADD_FIELDS_SET_DATA'
EXPORTING
i_kunnr = s_kna1-kunnr
i_zzscpc = s_knvv-zzscpc
i_zzcsnm = s_knvv-zzcsnm
i_zzdtcm = s_knvv-zzdtcm
i_zztexp = s_knvv-zztexp
i_zztsta = s_knvv-zztsta
i_zzcert = s_knvv-zzcert
i_activity = i_activity.
ENDMETHOD.
*******************************
Method GET_TAXI_SCREEN
method IF_EX_CUSTOMER_ADD_DATA_CS~GET_TAXI_SCREEN.
A'.
E_SCREEN = '1234'.
E_PROGRAM = 'SAPLZSD_CUST_ADD_FIELDS'.
E_HEADERSCREEN_LAYOUT = ''.
endmethod.
****************************************************
Method CHECK_ADD_ON_ACTIVE
method IF_EX_CUSTOMER_ADD_DATA~CHECK_ADD_ON_ACTIVE.
IF I_SCREEN_GROUP = 'Z1'. " Z1 is the screen group defined in SPRO
E_ADD_ON_ACTIVE = 'X'.
ENDIF.
ENDIF.
endmethod.
*****************************************************************************************
Hope this helps.
Le'me know if you need more.
Vinodh Balakrishnan
03-28-2008 8:47 PM
Hi Vinodh or anybody who can help:
I currently have my custom screen on customer master working. I have an ALV that I display on the custom tab that I create. It's an editable ALV so the user can change values on it and then when they hit "Save" on the customer master I need to have these values transferred over to an external system using an RFC-JCO communication. I got all of this to work but I still don't know how to pass values from my ALV screen to the GET_DATA method or for that matter any methods of the BADIs involved.
Right now to pass values from my BADi to my custom screen I simply use SET PARAMETER/GET PARAMETER combinations but I cannot keep using that when I have over 1000 values to pass over.
I looking for this so that I can perform some data validations on my ALV fields when the user hits enter after typing the values. Also, to check whether anything was changed or not - to set or not to set the fields changed flag in the BADI, etc.
Any help would be appreciated.
Thanks,
Kushal
Edited by: Kushal Thakore on Mar 31, 2008 7:33 PM
01-07-2008 11:08 AM
This document will give a step by step process to add the custom tab on the
customer master and implementation of respective BADIs accordingly.
Create a Screen Group and a corresponding Function code for the enhancement
i) Go to SPRO and follow the path Logistics-General -> Business Partner ->
Customer -> Control -> Adoption of Customers own master data fields ->
Prepare Modification - Free Enhancement of Customer Master Record.
ii) Add the screen group ZP (SSS Customer Protocol) and Label the same
With Function code ZCUP and save.
Create a Function group ZCUP. Create a screen 0100 with the fields required on the screen from the dictionary (KNVV) and add the screen to the function group. In the PBO for the screen make an arrangement to keep the screen fields as display only fields if the transaction code is XD03.
Implement the BADI CUSTOMER_ADD_DATA (Implementation name -
Z_CUST_ADD_DATA) and implement the method CHECK_ADD_ON_ACTIVE.
If the Screen Group = ZP then E_ADD_ON_ACTIVE = X.
Implement the BADI CUSTOMER_ADD_DATA_CS (Implementation name -
Z_CUST_ADD_DATA _CS)
i) Implement the method SET_DATA: Here we have the structure S_KNVV and all the data contained in it. So if sy-tcode = XD02 / XD03, use
SET PARAMETER to store all the data in SAP memory that is required on the screen. This data will then be retrieved in the PBO of the screen using GET PARAMETER.
ii) Implement the method GET_TAXI_SCREEN: If i_taxi_fcode = ZCUP,
then pass the Screen # and Program Name created in the earlier step and pass V (for Sales Area Data) to the header screen layout. Here we also put in the USER EXIT STRATEGY to display the custom screen only for company code 1070(SSS).
iii) Implement the method GET_DATA: Use GET PARAMETER to retrieve all the data that has been SET in the PAI of the screen after modifications by the user. Pass on these values into S_KNVV to update the details in database.
PBO & PAI of Screen: In the PBO of the screen use GET PARAMETER to retrieve all the values for screen fields set in the method SET_DATA if the transaction is XD02 or XD03. In the PAI of the screen use SET PARAMETER to store in the SAP memory from the screen fields if the transaction is XD01 or XD02.