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

CUSTOMER_ADD_DATA: Check data on save

Former Member
0 Likes
3,589

Hi there,

I'm facing a little problem here. I'm using the following BADIs:

- CUSTOMER_ADD_DATA;

- CUSTOMER_ADD_DATA_CS.

I am using this BADIs for transactions XD01 and XD02 because I want to save an additional field on table KNB1. I have already created my APPEND structure on the table, the subscreen and the corresponding field so that it can appear on the screen when I execute transaction XD02.

It is working fine, but the problem is that the additional field that I have created is not obligatory and it is not required for the user to execute my subscreen. On my screen I have implemented a PBO method and I can validate the field and give it a default value in case it is CLEAR. This works fine if the user is on my screen and clicks on 'SAVE' pushbutton.

The problem is that when the user is not on my screen and click on 'SAVE' pushbutton, the PBO method that I have created is not executed.

How can I check the value of my field and give it a default value in case the user is not on my screen?

Thanks in advance.

Hi there,

I'm facing a little problem here. I'm using the following BADIs:

- CUSTOMER_ADD_DATA;

- CUSTOMER_ADD_DATA_CS.

I am using this BADIs for transactions XD01 and XD02 because I want to save an additional field on table KNB1. I have already created my APPEND structure on the table, the subscreen and the corresponding field so that it can appear on the screen when I execute transaction XD02.

It is working fine, but the problem is that the additional field that I have created is not obligatory and it is not required for the user to execute my subscreen. On my screen I have implemented a PBO method and I can validate the field and give it a default value in case it is CLEAR. This works fine if the user is on my screen and clicks on 'SAVE' pushbutton.

The problem is that when the user is not on my screen and click on 'SAVE' pushbutton, the PBO method that I have created is not executed.

How can I check the value of my field and give it a default value in case the user is not on my screen?

Thanks in advance.

8 REPLIES 8
Read only

naimesh_patel
Active Contributor
0 Likes
2,222

You can set the value of the field as your default value in the method READ_ADD_ON_DATA of the BADI CUSTOMER_ADD_DATA.

To integrate everything, you might try to use the Function Mdoules. Like Z_SET_DATA FM to set the data to the global variables of the FM. Now, whenever user tries to go your screen, GET_DATA form the CUSTOMER_ADD_DATA_CS would trigger. You can use the Z_GET_DATA FM to get the data from your global variables and initialize your screen fields.

Regards,

Naimesh Patel

Read only

Former Member
0 Likes
2,222

Hi Tabrez,

If you want to make the field mandatory,follow the below mentioned procedure.

Link an executable program to the subscreen created so that you can validate to make the field mandatory.

You can achieve this using method GET_TAXI_SCREEN of BADI CUSTOMER_ADD_DATA_CS.

Link your program to parameter E_PROGRAM and screen number to parameter E_SCREEN.

Now you can validate your field in the Z program linked to make it mandatory.

LOOP AT screen.

If screen-name = 'Zfield' (Custom field created)

Screen-required = '1' (To make it mandatory).

ENDIF.

ENDLOOP.

Revert back for any further information required.

Regards,

Babul.

Read only

0 Likes
2,222

Thanks to both for the replies...but my problem is still unsolved.

The GET_TAXI_SCREEN is only executed when the user goes to my screen. Is there any other way to make this possible in case the user does not go to my screen (e.g. in the initial screen of the transaction XD01 ? )

Thanks

Read only

0 Likes
2,222

Hi Tabrez,

You can follow the same procedure mentioned above to so that it works at the time of creation (XD01)

It works even if the user doesn't go to your screen.

Use method PRESET_VALUES_CCODE of BADI CUSTOMER_ADD_DATA.

Make use of field symbols to achieve the functionality.

Regards,

Babul.

Read only

0 Likes
2,222

Hi Babul,

But with the method PRESET_VALUES_CCODE of BADI CUSTOMER_ADD_DATA I'm not able to link an executable program to my subscreen.

The method does not have the E_PROGRAM and E_SCREEN parameters.

Read only

0 Likes
2,222

Ok let me explain you the entire design.

1. Implement the GET_TAXI_SCREEN in BADI CUSTOMER_ADD_DATA_CS to link your Custom Screen. Here you create a Function Group E.g ZXD02_CS and create your required subscreen 9001.

2. Implement READ_ADD_ON_DATA in the BADI CUSTOMER_ADD_DATA to read your data. This method will only trigger once when you start the XD02/XD03 transaction. Here you have all the required key fields available to read your custom data.

3. Implement SET_DATA in the BADI CUSTOMER_ADD_DATA_CS to transfer the standard data to your screen's PBO. Create a FM ZXD02_CS_GET to save the required information from the BADI interface to the Global data variables in the FG ZXD02_CS and call it in this method. E.g. You have added ZZ_Z1 in KNB1. You create WF_ZZ_Z1 in the Top include of the FG. Place this field on the screen. You create importing parameter I_KNB1 in the FM ZXD02_CS_GET.


FUNCTION ZXD02_CS_GET.
  WF_ZZ_Z1 = I_KNB1-ZZ_Z1.
ENDFUNCTION.

4. Implement GET_DATA in the BADI CUSTOMER_ADD_DATA_CS to transfer back the screen data to the standard table. Create a FM ZXD02_CS_SET to retrieve the information from the Global variables to the standard fields. You make the exporting parameter E_KNB1 in this FM.


FUNCTION ZXD02_CS_GET.
  I_KNB1-ZZ_Z1 = WF_ZZ_Z1.
ENDFUNCTION.

Since you are using the append structure you don't need to implement the SAVE_DATA in the CUSTOMER_ADD_DATA.

Regards,

Naimesh Patel

Read only

0 Likes
2,222

Thanks to both for the tips.

Best regards,

Tabrez

Read only

0 Likes
2,222

Hello Tabrez,

I require some help,

i am having the same issue as you for calling my subscreen.

Could you kindly provide your help in solving this issue? it has been some days i have been trying to get a solution.

thanks for considering my request if possible.

kind regards,

devi