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

ECC 6: BAPI_DOCUMENT_CHECKOUTVIEW2 dumps in update

jrgkraus
Active Contributor
0 Likes
3,771

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
Read only

chaouki_akir
Contributor
3,624

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.

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

Sandra_Rossi
Active Contributor
0 Likes
3,624

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

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

Read only

jrgkraus
Active Contributor
3,624

Dump and coding have been added

Read only

chaouki_akir
Contributor
3,625

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.
Read only

0 Likes
3,624

What if you pass

     PF_HTTP_DEST    = 'SAPHTTPA'
     PF_FTP_DEST     = 'SAPFTPA'
?
Read only

3,624

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

Read only

0 Likes
3,624

Thanks!

I think it should solve the issue then.

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

3,624

Works like a charm. Thank you both.