‎2009 Apr 15 10:02 AM
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
‎2009 Apr 15 10:35 AM
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
‎2009 Apr 15 10:11 AM
‎2009 Apr 15 10:35 AM
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
‎2009 Apr 15 10:48 AM
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...
‎2009 Apr 15 11:59 AM
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
‎2009 Apr 15 12:06 PM
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?
‎2009 Apr 15 2:01 PM
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