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

Change ABAP code in FM

Former Member
0 Likes
2,939

Hi.

I have a custom field in table BKPF.

When i am trying to change value in this field (TC: FB02) i have a problem.

Value in this new field is not changing but change log on document is created.

I have found FM CHANGE_DOCUMENT which should make changes in table BKPF.

Include LFAGL_F005F03.

I whant to add new line to code of this FM (with my new fileld) but how to do this without entering acces Key?

There is no enhance point...

Code:

...

UPDATE bkpf
SET aedat = bkpf-aedat
upddt = bkpf-upddt
xblnr = bkpf-xblnr
bktxt = bkpf-bktxt
stodt = bkpf-stodt
xstov = bkpf-xstov
duefl = bkpf-duefl
brnch = bkpf-brnch
numpg = bkpf-numpg
xref1_hd = bkpf-xref1_hd "Note 624215
xref2_hd = bkpf-xref2_hd "Note 624215
WHERE bukrs = bkpf-bukrs
AND gjahr = bkpf-gjahr
AND belnr = bkpf-belnr.

...

Thanks in advance

Hi.

I have a custom field in table BKPF.

When i am trying to change value in this field (TC: FB02) i have a problem.

Value in this new field is not changing but change log on document is created.

I have found FM CHANGE_DOCUMENT which should make changes in table BKPF.

Include LFAGL_F005F03.

I whant to add new line to code of this FM (with my new fileld) but how to do this without entering acces Key?

There is no enhance point...

Code:

...

UPDATE bkpf
SET aedat = bkpf-aedat
upddt = bkpf-upddt
xblnr = bkpf-xblnr
bktxt = bkpf-bktxt
stodt = bkpf-stodt
xstov = bkpf-xstov
duefl = bkpf-duefl
brnch = bkpf-brnch
numpg = bkpf-numpg
xref1_hd = bkpf-xref1_hd "Note 624215
xref2_hd = bkpf-xref2_hd "Note 624215
WHERE bukrs = bkpf-bukrs
AND gjahr = bkpf-gjahr
AND belnr = bkpf-belnr.

...

Thanks in advance

7 REPLIES 7
Read only

MateuszAdamus
Active Contributor
0 Likes
2,517

Hello tomasz.piwowarski

It's a standard SAP function, only SAP is allowed to change it by default. Modifying standard objects is almost always a last resort. Try looking for other ways of achieving your goal.

For example, you could try to implement a BTE for this transaction, as it is described in this answer: https://answers.sap.com/comments/6621494/view.html

Kind regards,
Mateusz
Read only

matt
Active Contributor
2,517

While modifying standard is a last resort, it's better than making a copy of the standard and changing that. If you have to change the standard, then do so, but make sure it is really clear that this is a modification and why it's necessary.

During upgrade, when you run SPAU, the modification will be visible and will need to be re-applied.

I will add that my experience of many SAP implementations is that every single one has had a modification to standard somewhere.

Read only

2,517

Hello Matthew

Agreed, there is always an exception to the rule. That's why I said that it's the last resort. Not, that it's not possible or shouldn't be done at all.

And who says anything about copying? 🙂 Definitely avoid copying of programming objects, if possible.

Kind regards,

Mateusz
Read only

matt
Active Contributor
0 Likes
2,517

Nobody said anything about copying. I was more advising the OP than replying to your answer.

Read only

ziolkowskib
Active Contributor
2,517

Hi Tomek,

Did you have a chance to go through following article?

Extending BKPF Table by adding custom or ZZ Fields in SAP

Regards,

Bartosz

Read only

Former Member
0 Likes
2,517

Yes. When i am posting new document everything is ok.

Problem is in FB02 in change mode.

Part of this article

"Note: New Z fields can be added to FB03 only in the form of hard screen modification and is not recommended."

I add this field to FB02 FB03 screen.

Now i am looking for solution to make a posibility to change value in this field.

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,517

Please use a meaningful title (like "update custom field in FB02" for instance).

Please use the CODE button to format your code so that it's shown in a more user-friendly format (colorized).