2023 Jul 21 9:35 AM
When we try to call BAPI_DOCUMENT_CHECKOUTVIEW2 in update (during message output with dispatch time 4), we get a runtime error POSTING_ILLEGAL_STATEMENT (see dump.txt). It seems that during the checkout via SCMS_HTTP_GET_FILE a PING is being performed against the RFC destination SAPGUI which causes the dump.
How can I check out documents in update sessions?
The BAPI is being called like this:
call function 'BAPI_DOCUMENT_CHECKOUTVIEW2'
exporting
documenttype = 'ZSP'
documentnumber = '0000000000000010001541977'
documentpart = '000'
documentversion = '00'
documentfile = space
getstructure = '1'
getcomponents = 'X'
originalpath = space
hostname = space
getheader = 'X'
docbomchangenumber = space
docbomvalidfrom = space
docbomrevisionlevel = space
pf_http_dest = space
importing
return = result-return
tables
documentstructure = result-documentstructure
documentfiles = result-documentfiles
components = result-components.
2023 Jul 26 4:00 PM
Reading the dump and doing a test, we can conclude that the call of the function RFC_PING with a DESTINATION ("SAPGUI") triggers a COMMIT statement that is illegal in UPDATE TASK.
"The synchronous RFC triggers a database commit in the calling program with the following exception: No database commit is triggered by an sRFC during update processing. sRFC is not forbidden during updates."
REPORT toto.
PARAMETERS p_upd TYPE xfeld.
CASE p_upd.
WHEN ' '.
data lt_return type STANDARD TABLE OF bapiret2.
CALL FUNCTION 'Z_IN_PD_TASK'
TABLES et_return = lt_return.
WHEN OTHERS.
CALL FUNCTION 'Z_IN_PD_TASK' IN UPDATE TASK.
COMMIT WORK.
ENDCASE.
FUNCTION z_in_pd_task.
*"----------------------------------------------------------------------
*"*"Module fonction de mise à jour :
*"
*"*"Interface locale :
*" TABLES
*" ET_RETURN STRUCTURE BAPIRET2
*"----------------------------------------------------------------------
DATA documenttype TYPE bapi_doc_aux-doctype.
DATA documentnumber TYPE bapi_doc_aux-docnumber.
DATA documentpart TYPE bapi_doc_aux-docpart.
DATA documentversion TYPE bapi_doc_aux-docversion.
DATA documentfile TYPE bapi_doc_files2.
DATA return TYPE bapiret2.
CALL FUNCTION 'BAPI_DOCUMENT_CHECKOUTVIEW2'
EXPORTING
documenttype = documenttype
documentnumber = documentnumber
documentpart = documentpart
documentversion = documentversion
documentfile = documentfile
* GETSTRUCTURE = '1'
* GETCOMPONENTS = 'X'
* ORIGINALPATH = ' '
* HOSTNAME = ' '
* GETHEADER = 'X'
* DOCBOMCHANGENUMBER = DOCBOMCHANGENUMBER
* DOCBOMVALIDFROM = DOCBOMVALIDFROM
* DOCBOMREVISIONLEVEL = DOCBOMREVISIONLEVEL
* PF_HTTP_DEST = ' '
* PF_FTP_DEST = ' '
IMPORTING
return = return
* TABLES
* DOCUMENTSTRUCTURE = DOCUMENTSTRUCTURE
* DOCUMENTFILES = DOCUMENTFILES
* COMPONENTS = COMPONENTS
.
*et_return = value #( return ).
APPEND return TO et_return.
ENDFUNCTION.
2023 Jul 22 9:59 AM
Better post your code and attach the short dump...
(we'll see if you use "SAPFTPA" and "SAPHTTPA")
2023 Jul 26 6:58 AM
2023 Jul 26 4:00 PM
Reading the dump and doing a test, we can conclude that the call of the function RFC_PING with a DESTINATION ("SAPGUI") triggers a COMMIT statement that is illegal in UPDATE TASK.
"The synchronous RFC triggers a database commit in the calling program with the following exception: No database commit is triggered by an sRFC during update processing. sRFC is not forbidden during updates."
REPORT toto.
PARAMETERS p_upd TYPE xfeld.
CASE p_upd.
WHEN ' '.
data lt_return type STANDARD TABLE OF bapiret2.
CALL FUNCTION 'Z_IN_PD_TASK'
TABLES et_return = lt_return.
WHEN OTHERS.
CALL FUNCTION 'Z_IN_PD_TASK' IN UPDATE TASK.
COMMIT WORK.
ENDCASE.
FUNCTION z_in_pd_task.
*"----------------------------------------------------------------------
*"*"Module fonction de mise à jour :
*"
*"*"Interface locale :
*" TABLES
*" ET_RETURN STRUCTURE BAPIRET2
*"----------------------------------------------------------------------
DATA documenttype TYPE bapi_doc_aux-doctype.
DATA documentnumber TYPE bapi_doc_aux-docnumber.
DATA documentpart TYPE bapi_doc_aux-docpart.
DATA documentversion TYPE bapi_doc_aux-docversion.
DATA documentfile TYPE bapi_doc_files2.
DATA return TYPE bapiret2.
CALL FUNCTION 'BAPI_DOCUMENT_CHECKOUTVIEW2'
EXPORTING
documenttype = documenttype
documentnumber = documentnumber
documentpart = documentpart
documentversion = documentversion
documentfile = documentfile
* GETSTRUCTURE = '1'
* GETCOMPONENTS = 'X'
* ORIGINALPATH = ' '
* HOSTNAME = ' '
* GETHEADER = 'X'
* DOCBOMCHANGENUMBER = DOCBOMCHANGENUMBER
* DOCBOMVALIDFROM = DOCBOMVALIDFROM
* DOCBOMREVISIONLEVEL = DOCBOMREVISIONLEVEL
* PF_HTTP_DEST = ' '
* PF_FTP_DEST = ' '
IMPORTING
return = return
* TABLES
* DOCUMENTSTRUCTURE = DOCUMENTSTRUCTURE
* DOCUMENTFILES = DOCUMENTFILES
* COMPONENTS = COMPONENTS
.
*et_return = value #( return ).
APPEND return TO et_return.
ENDFUNCTION.
2023 Jul 26 4:53 PM
What if you pass
PF_HTTP_DEST = 'SAPHTTPA'
PF_FTP_DEST = 'SAPFTPA'
?
2023 Jul 26 6:12 PM
The dump is no more occurring indeed : function RFC_PING is no more called because pf_ftp_dest is nomore empty
2023 Jul 26 7:22 PM
Thanks!
I think it should solve the issue then.
2023 Jul 28 1:11 PM