Application Development 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: 

ECC 6: BAPI_DOCUMENT_CHECKOUTVIEW2 dumps in update

jrgkraus
Active Contributor
0 Kudos
1,435

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.
1 ACCEPTED SOLUTION

chaouki_akir
Contributor
1,288

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."

https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abapcall_function_des...

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.
7 REPLIES 7

Sandra_Rossi
Active Contributor
0 Kudos
1,288

Better post your code and attach the short dump...

(we'll see if you use "SAPFTPA" and "SAPHTTPA")

jrgkraus
Active Contributor
1,288

Dump and coding have been added

chaouki_akir
Contributor
1,289

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."

https://help.sap.com/doc/abapdocu_latest_index_htm/latest/en-US/index.htm?file=abapcall_function_des...

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.

0 Kudos
1,288

What if you pass

     PF_HTTP_DEST    = 'SAPHTTPA'
     PF_FTP_DEST     = 'SAPFTPA'
?

1,288

The dump is no more occurring indeed : function RFC_PING is no more called because pf_ftp_dest is nomore empty

0 Kudos
1,288

Thanks!

I think it should solve the issue then.

  • SAPHTTP/SAPFTP are for running in dialog
  • SAPHTTPA/SAPFTPA are for running in background

1,288

Works like a charm. Thank you both.