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

Modify fields in Append Structure

Former Member
0 Likes
2,765

Hi there,

I am driving crazy about append structures. We appended a few fields to KNA1 - e.g. a field that keeps a version number (every time a record changes we want to increment the version starting with 1 at creation time).

We found a lot of material about how to append structures and actually, it's fairly simple to extend KNA1 with append structures. But HOW can someone update those fields?

We tried user exit EXIT_SAPLVV01_001 and BAdI IF_EX_CUSTOMER_ADD_DATA-SAVE_DATA to populate those fields at commit of customer data. In both scenarios, we don't have CHANGING or EXPORTING parameters. So, we tried to update the table directly, e.g.

method IF_EX_CUSTOMER_ADD_DATA~SAVE_DATA .

DATA: w_kna1 type kna1.

select single *

from kna1 " Customer master table

into w_kna1

where kunnr = I_KUNNR.

w_kna1-sap_version = w_kna1-sap_version + 10.

update kna1 from w_kna1.

break-point.

endmethod.

Now, when we execute VD02 the program stops at the given break-point and we see the data changed in KNA1. But the record gets updated by the SAP program SAPMF02D (underlying program of VD02), of course as we cannot manipulate the KNA1 record in the internal table of SAPMF02D.

Is there any way to store information into append structures at save time (within the same transaction) without customizing standard programs?

Many thanks for your help

7 REPLIES 7
Read only

Former Member
0 Likes
1,493

Hi,

Look at documentation in this program LV02ZFKA. In this it says you can change field of KNA1.

Regards,

Ramesh.

Read only

0 Likes
1,493

Thx Ramesh,

do you know of any other option that does not require to modify existing SAP objects?

Regards

Read only

0 Likes
1,493

Hi Maic,

Normally for append structures to standard tables, code is written in user exits where it is mandatory to change existing SAP objects (user exits exist are provided by SAP and you need change key).

For additional functionality to the existing flow of transaction, we use BADIs and customer exits (through CMOD).

Your requirement suits the first point above.

Annyways, try using method GET_DATA in badi CUSTOMER_ADD_DATA_CS. This has changing parameter for KNA1.

Ramesh.

Read only

Former Member
0 Likes
1,493

Hi,

Please go through the link , contains screen-shots and code.

http://www.saptechnical.com/Tutorials/ABAP/XD01/XD01.htm

if useful reward.

Bye

Read only

Former Member
0 Likes
1,493

Many thanks for your valuable help. Unfortunately, BAdI CUSTOMER_ADD_DATA_CS doesn't do it, because we have to filter on a screen group which we don't use. Also the tutorial did not help, we don't require to add an additional screen to show or modify those fields. They are used for internal processing only. So, all we need is that we increment one field like a trigger every time a customer record gets saved.

Read only

Former Member
0 Likes
1,493

Seems, we don't have another resolution here...

Read only

Former Member
0 Likes
1,493

Hi,

You may add a invisible field in the customer subscreen, and  if the sy-tcode = 'XD02', then to add 1 to your version field.

John Hu