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

Transaction code in change documents

Former Member
0 Likes
2,006

Hello,

I have a program which I'm running in background. This program alters IS-U data using several function modules. In the function modules, we have the option to create change documents.

The problem is that the transaction codes are not written in the change documents when running the program in BACKGROUND.

Eg. FM EQUIPMENT_SAVE

with import I_WRITE_CDOCS = 'X'.

The change documents are created, but the transaction codes are not written if the program is run in background.

Any ideas?

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,419

Hello,

first: the TCODE-Field in changedocuments is an informational field. At least up to Rel.4.7 you can fill it with TCODE that are not really existing in the SAP-System.

In your example with the EQUIPMENT_SAVE-function: if you look into the source, there

is comment "part 8: change documents if required (only in change mode)". After that there are Changedoc written in a form EQUI_CDOCS_UPDATE_F10. There's an other form called CD_CALL_EQUI which calls an function EQUI_WRITE_DOCUMENT- there's a input parameter for TCODE. Unfortunately that's filled before from sy-tcode - i guess it's empty in background processing.

So, what you could do is call in your program the EQUIPMENT_SAVE-function without I_WRITE_CDOCS = 'X' and book the changedocuments separately via Function EQUI_WRITE_DOCUMENT - but it's pretty much work because you will need to fill the before image and the after image in your own program.

Regards Wolfgang

6 REPLIES 6
Read only

Former Member
0 Likes
1,419

Search for OSS notes?

Read only

Former Member
0 Likes
1,420

Hello,

first: the TCODE-Field in changedocuments is an informational field. At least up to Rel.4.7 you can fill it with TCODE that are not really existing in the SAP-System.

In your example with the EQUIPMENT_SAVE-function: if you look into the source, there

is comment "part 8: change documents if required (only in change mode)". After that there are Changedoc written in a form EQUI_CDOCS_UPDATE_F10. There's an other form called CD_CALL_EQUI which calls an function EQUI_WRITE_DOCUMENT- there's a input parameter for TCODE. Unfortunately that's filled before from sy-tcode - i guess it's empty in background processing.

So, what you could do is call in your program the EQUIPMENT_SAVE-function without I_WRITE_CDOCS = 'X' and book the changedocuments separately via Function EQUI_WRITE_DOCUMENT - but it's pretty much work because you will need to fill the before image and the after image in your own program.

Regards Wolfgang

Read only

0 Likes
1,419

Thanks for the answers.

After a deeper look in the program, I can tell you this: I don't think it's related to which function module is called but to the way how it is called.

My program exists of several calls to function modules.

When I use CALL FUNCTION XXX, the transaction code is not written in the change docs in background.

When I use CALL TRANSACTION XXX, the transaction code is written in the change docs in background.

But the problem is that I can't use a CALL TRANSACTION XXX for my main program...

Read only

0 Likes
1,419

Hello Glenn,

it's right: if you use CALL TRANSACTION xxxx, you'll set the field sy-tcode. That's what call transaction does.

Regards Wolfgang

Read only

0 Likes
1,419

Ok, so is there any way to pass the transaction code of my main program so that it's included in the change documents?

I suppose that if I use CALL TRANSACTION 'MyTcode' that it should work?

Read only

0 Likes
1,419

Hello,

if you use CALL Transaction, you should get the transaction in the changedocument. But there might be the problem that not all transactions run in background, specially if they use such things like controls or popup's.

The other chance would be what i wrote in the first answer - book the changedocument separately via

function EQUI_WRITE_DOCUMENT .

Regards Wolfgang