06-26-2013 4:29 PM
Hello Experts,
I am working on a basic requirement like sending invoice outputs as email attachment. For this i have created a Z include and attached it to NACE.
Its working fine. Further to my requirement i need update the invoice in DMS. For this i am using the same include. After sending mail part i have written code for DMS.
I am able to generate the DMS number using BAPI_DOCUMENT_CREATE2 and attaching document using CVAPI_DOC_CHECKIN.
The problem is now after calling create BAPI and chekin Bapi, i am using commit BAPI. This is generating a runtime error like not use commit statement or BAPI before system commit.
To over come this i read, update fm and perform is commit is available. Now i have created a FM, processing type as update and Coll.run.
inside Fm if use commit i am getting run time error, if dont use the dms number is not generating.
Please suggest how to proceed further.
Regards,
NN
06-27-2013 12:21 PM
You must not use any commit either in update task or in a perform at commit form. So create a RFC enabled wrapper that will execute the BAPI and the COMMIT-WORK, and call this FM IN BACKGROUND TASK.
Regards,
Raymond
06-26-2013 4:56 PM
You cannot use commit work statement in an update function module. Please refer to the following link:
http://scn.sap.com/thread/1665041
I believe you are using two commit work statements one after BAPI_DOCUMENT_CREATE2 and other after .CVAPI_DOC_CHECKIN. If you don't use first commit work then the bapi does not create document and hence attachment would not happen. What you can do is that just use BAPI_DOCUMENT_CREATE2 in the update function module without commit statement. This would be commited automatically after the system commit. For creating attachment, event of object "DRAW" (I think "CREATED" ) is raised whenever a DMS document is generated(check tcode SWEL). You can call CVAPI_DOC_CHECKIN to add attachment in a new FM which would be entered as receiver in SWE2.
Regards
06-26-2013 8:57 PM
Hi,
Yes, you got my trouble / point.
Event 'CREATED' is triggered when i created in CV01N but not using the BAPI_DOCUMENT_CREATE2. Checked it SWEL.
Am i missing any parameter to trigger an event? let me check. Please suggest if there is no event triggered using event.
Regards,
NN
06-27-2013 7:32 AM
then try raising the event using FM "SWE_EVENT_CREATE" after the bapi "BAPI_DOCUMENT_CREATE2".
Regards
06-26-2013 5:01 PM
Hi NK,
Probably your error becomes because these code it's in UPDATE TASK execution. In this type of execution is prohibited the use of COMMIT WORK because it's automatically called.
Regards,
Alex
06-27-2013 1:19 AM
06-27-2013 8:05 AM
Hi,
Try to use the same bapi 'BAPI_DOCUMENT_CREATE2' to attach the files as well, just pass the attachment in the tables parameter 'DOCUMENTFILES'. There is no need to of another function module 'CVAPI_DOC_CHECKIN' for uploading.
Thanks & Regards
Bala Krishna
06-27-2013 9:35 AM
Hi NK,
You can try taking all the code and encapsulated in a module function and call it in another thread by asynchronously RFC call. Obviously your RFC destination it will be the same system (loopback) and it will need a COMMIT inside this remote call.
Regards,
Alex
06-27-2013 8:29 AM
Hi,
Have you used "BAPI_TRANSACTION_COMMIT" to commit the changes?
Since it will call a function module to refresh the buffer if previous BAPI have any errors or not...With commit functionality.
Hope it will help you.
Thanks
Gangadhar
06-27-2013 12:21 PM
You must not use any commit either in update task or in a perform at commit form. So create a RFC enabled wrapper that will execute the BAPI and the COMMIT-WORK, and call this FM IN BACKGROUND TASK.
Regards,
Raymond
07-09-2013 5:13 AM
Hi Raymond,
Thank you, its working.
I have created a RFC FM and a report. From FM scheduled the report using JOB_OPEN/CLOSE.
I have moved the values using EXPORT values TO DATABASE indx(st) ID indxkey and imported the same in the report. Because export/import abap memory is not working in scheduled jobs.
My DMS document number is generated and pdf document attached.
I have called the FM like below
call function FM starting new task XXXX.
In update debugging a separate window is opened and my coding is working perfectly.
requirement is to show a pop-up with DMS number. How to display the DMS number since its executing separately from the original t-code. Also how to clear the export database memory, because examples are for available only for free abap memory.
Regards,
NK