Application Development 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: 

Custom fields not getting saved in KNA1 on click "Save" from XD01

Former Member
0 Kudos

Hi Experts,

Let me explain my approach first. I used Customer_add_data and Customer_add_data_cs to add new subscreen on XD01, XD02 and XD03.

I created append structure in KNA1 and added 6 custom fields there.

I followed SAP links and written code at below calls:

IF_EX_CUSTOMER_ADD_DATA_CS~GET_TAXI_SCREEN

IF_EX_CUSTOMER_ADD_DATA_CS~GET_DATA

IF_EX_CUSTOMER_ADD_DATA_CS~SET_DATA

IF_EX_CUSTOMER_ADD_DATA~CHECK_DATA_CHANGED

Later I created my function group and under this FG I created one subscreen containing fields of Z Append structure of KNA1. Written code in PBO and PAI of the same. Fetching field data from memory and setting to fields.

I am successfully able to view data in custom fields of custom tab when I click on this custom tab. I am able to save values in KNA1 table as well after viewing. In XD02 and XD03 I am able to view all custom values under custom tab.

But unfortunately I am unable to save these custom values in KNA1 when I don't click on custom tab and save customer directly from main screen (XD01).

I put debugger in all implemented code areas and found that nothing is getting called when I don't click on custom tab and directly click on save.

As per requirement these values should get saved even though we don't click on custom tab. I read many SDN and outside SDN posts but unable to find solution of this issue.

Please help me sharing your expertise..

Thanks!

-Akanksha 

24 REPLIES 24

Former Member
0 Kudos

Hi Akanksha ,

In My case i added new fields using "Get Data Dictionary" On Screen so I didn't had to write any code in PBO and PAI , It worked fine.

Please check if that can help you .

Regards,

Shyam Sunder Goyal

0 Kudos

Hi Shyam,

I am trying to understand i added new fields using "Get Data Dictionary" On Screen.

Are you referring fields added into subscreen?

In my case I created append ZABC structure in KNA1 table and used same fields in my subscreen. I mean In Screen layout I am using "From Dictionary" option. Are you talking about same here?

I am sorry I am pretty new to ABAP that's why my questions may sound stupid. But I would appreciate your help for this.

Thanks!

-Akanksha

former_member190726
Participant
0 Kudos

hi akanksha,

hope this is helpful to u

SAPTechnical.COM - Creating Custom Screen in XD01

0 Kudos

Hi Reddy,

I followed same link and did implementation of 6 custom field in custom tab. As said all working fine apart from saving values from main screen. As my custom tab is not getting called at all from XD01.

Thanks!

Former Member
0 Kudos

Hi Akanksha,

It's interesting that you are able to see data in XD03 but not in KNA1 , it Means that data is being saved somewhere in database . Please check F1 details on the fields on screen and check with which field it is linked .

Hope that can help you .

Regards,

Shyam

0 Kudos

Hi Shyam,

Appreciate your in time response. My data is getting saved as well in KNA1 table once I click on custom tab. If I am not clicking on custom tab to navigate to subscreen data does not get saved in KNA1 table.

This is the issue. I am not getting any blog to see solution for this kind of issue. Please help me in resolving this.

Thanks!

-Akanksha

0 Kudos

Hi Akanksha,

I got your problem , But if you are not navigating to the custom field , that means you are not changing your fields  , So in that it should be as it is in KNA1  (No Change) , But if still it is getting changed then you can restrict your logic based on some flag which will be set in in PAI of that screen .

Hope fully I am getting your point correctly .

0 Kudos

Hi akanksha,

If your code is written in subscreen either in PBO or PAI,  it will execute when the particular screen is triggered, it is better to write the code in main screen/exit instead of sub screen pbo/pai.

Also please find in debugger whether the custom fields are updated before clicking the custom tab.

Regards

Rajkumar Narasimman

0 Kudos

Hi Rajkumar,

I tried to put debugger on custom fields implementation but it is not getting triggered if I don't click on custom tab.

What do you refer here by saying "it is better to write the code in main screen/exit instead of sub screen pbo/pai."?

Can you please elaborate a bit? Its been little time I am in ABAP so I did not understand exactly.

Thanks!

Akanksha

0 Kudos

Yes Shyam,

I am not navigating to custom tab but in main tab I perform address validation for customer and it saves values of custom field(Added in custom tab) in memory.

PAI and PBO ob that custom tab (Subscreen containing custom fields) not getting called at all when I don't click on custom tab and directly save customer in XD01.

-Akanksha

0 Kudos

In that case as said by Rajkumar , Please find another exit or enhancement where you can write your code instead of PAI .

0 Kudos

Yes may be I need to do something like that. But how can I do that? I am not getting any development approach apart from Customer_add_data and Customer_Add_data_CS.

Can you please help!

Thanks

0 Kudos

Hi akanksha,

  We are not doing any action(enter, value change etc.,) in the sub-screen, but we are displaying the value to the screen element using PBO Coding. The same value we need to update in the database.  So without clicking the tab, the screen element won't get value, then empty value is saved in database.


akanksha srivastava wrote:

I tried to put debugger on custom fields implementation but it is not getting triggered if I don't click on custom tab.

Don't remove the Existing coding in PBO, it is required for displaying the value when user click the tab button.

Search the Exit/badi during check/save operation, You can update the custom fields dynamically using field symbols as shown below.

Press F1 in the custom field and get the program and variable name and use the same below.


"Data Declaration

field-symbol <f_werks> like werks.     "Custom Field name and data-Type here

"Get the Werks value using Program and Variable name

assign ('(program_name)varible_name') to <f_werks>.

"Assign Value

if <f_werks> is assigned.

"Update some value here, it will be updated to the appropriate screen element.

<f_werks> = 'value' .

endif.

Regards

Rajkumar Narasimman

0 Kudos

Hi akanksha..

Check the below exit/badi is triggering, write the above dynamic code inside the same, hope it will work.

Exit name        Short text

RFDRRANZ  User exits: Accounts Receivable Information System

Name of a BAdI   Enhancement Implementation         Description

QISR1_SCA2                     QISR1_SCA2                     Customer Address

QISR1_SCB2                     QISR1_SCB2                     Business Partner Bank Details

QISR1_SCC2                     QISR1_SCC2                     Accounting Clerk with Business Partner

If you face any problem, do let us know.

Regards

Rajkumar Narasimman

0 Kudos

Hi Rajkumar,

I have created my interface in Enhancement spot Customer_Add_Data. Please refer to the screenshot attached. And I checked putting debugger in program "SXV_GET_CLIF_BY_NAME" that this spot also gets called when we click on save.

Then supposedly my code also should get called.. Any suggestions?

-

-Akanksha

0 Kudos

Hi akanksha,

Please find the below options.

Option 1:

If you got any Badi/exit/implicit enhancement when the user is processing the screen.

For Ex:

  When enter button is pressed, if Exit/badi is triggered, then we can write the above dynamic code for changing the custom screen field value. If custom screen field value is changed, then automatically it will update the database.

Option 2:

If the Badi/exit is triggering only during saving, then we have to find the internal table/structure in debugger which holds the custom fields. Modify the same and check the table after save done.

Regards

Rajkumar Narasimman

0 Kudos

Hi Rajkumar,

I got the method getting called when we click on save. It is: IF_EX_CUSTOMER_ADD_DATA~SAVE_DATA. I have written code here to set values in table fields and it is getting executed as well. but unfortunately values are still not getting save in the KNA1 table.

My code is:

FIELD-SYMBOLS : <fs_kna1> TYPE ANY.

DATA : w_kna1(20) VALUE '(SAPMF02D)KNA1',

        it_kna1 TYPE kna1.

DATA:

       LV_FLAG TYPE C VALUE SPACE,

       LV_RDI TYPE CHAR4,

       LV_DPV TYPE CHAR4,

       LV_CMRA TYPE CHAR30,

       LV_EWS TYPE CHAR4,

       LV_LAT TYPE CHAR30,

       LV_LONG TYPE CHAR30.

  GET PARAMETER ID  'LAT' field lv_lat.

  GET PARAMETER ID  'LONG' field lv_long.

  GET PARAMETER ID  'RDI' field lv_rdi.

  GET PARAMETER ID  'DPV' field lv_dpv.

  GET PARAMETER ID  'CMRA' field lv_cmra.

  GET PARAMETER ID  'EWS' field lv_ews.

ASSIGN (w_kna1) TO <fs_kna1>.

it_kna1 = <fs_kna1>.

it_kna1-Zlatitude = LV_LAT.

it_kna1-ZLONGITUDE = LV_LONG.

it_kna1-ZRDI = LV_RDI.

it_kna1-ZDPV = lv_dpv.

it_kna1-zcmra = lv_cmra.

it_kna1-zews = lv_ews.

<fs_kna1> = it_kna1.

UNASSIGN <fs_kna1>.

Please help me correcting it if I have done any mistakes here.

Thanks

-Akanksha

0 Kudos

Hi Sri,

In method

IF_EX_CUSTOMER_ADD_DATA_CS~SET_DATA

SET parameter id 'ZURL' field S_KNA1-ZURL.


IF_EX_CUSTOMER_ADD_DATA_CS~GET_DATA

GET parameter id 'ZURL' field S_KNA1-ZURL.


IF_EX_CUSTOMER_ADD_DATA_CS~GET_TAXI_SCREEN

     when 'ZC_TAB'.

       e_screen  = '0200'"Eart + Objekt

       e_program = 'ZTEST_ADD_TAB_XD01'.

       e_headerscreen_layout = ''.


in ZTEST_ADD_TAB_XD01 program write pbo and pai.  It will work


Regards,

Madhu.

0 Kudos

Hi Madhu,

These three methods are working perfectly fine for me. Its just that I am unable to save data when I dont click on custom tab.

For that I am supposed to write logic at IF_EX_CUSTOMER_ADD_DATA.

Not sure what I am doing wrong.

0 Kudos

0 Kudos

Hi Sandy,

I tried this code as well but it is also not working.

Thanks!

-Akanksha

Former Member
0 Kudos

Hi Akanksha,

Here you need to display your Screen forcibly, so as to data flow.

I would suggest you to implement method 'IF_EX_CUSTOMER_ADD_DATA~CHECK_ALL_DATA' and in this provide your E_MSGID, E_MSGNO, Screen number (preferebly 4000 as further checks would involve 4000), Screen group(defined in ADD_DATA_CS) and Fcode which is defined for ADD_DATA_CS.

Here message would be displayed as error but it is Information message in real time execution.

And there supposed to be entries in 'Tab Control (TAXITABS)' radiobutton in transaction VFBS.

After above all processing, it'll call the screen attached to Screen Group and FCODE in ADD_DATA_CS.

Regards,

Shailesh Nagaonkar.

0 Kudos

Hi Shailaish,

I do not want to show any pop-up when I click on save button. I just want to save values of all custom fields into table KNA1.

In the code above I have written values of all customs fields are coming from memory and I am setting them into S_KNA1 but it is not getting updated in the table.

-Akanksha

0 Kudos

Hi Shailesh,

I am not getting any solution to this issue. I am now trying to show my screen on click of ave now but unable to do that. Written code in IF_EX_CUSTOMER_ADD_DATA~CHECK_ALL_DATA.

    e_msgid = 'S'.

     E_msgno = 100.

     E_SCRGR = 'CD'.

     E_DYNNR = '65'.

     E_FCODE = 'CD_TAB'.

Still nothing happens. Can you please help!

Thanks

-Akanksha