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

BAPI_DOCUMENT_CREATE2 - Document is created but is "missing"

Former Member
0 Likes
596

I have the following code to test this BAPI. When I execute it I get a document number returned and the return structure is initial. This tells me that a document was sucessfully created. However, when I try to view the document, it doesn't exist. Any ideas?

I know this is "bare-bones" but that is by design.

Regards,

Davis


  DATA: documentdata TYPE bapi_doc_draw2.
   DATA: documenttype TYPE bapi_doc_aux-doctype,
        documentnumber TYPE bapi_doc_aux-docnumber,
        documentpart TYPE bapi_doc_aux-docpart,
        documentversion TYPE bapi_doc_aux-docversion,
        return TYPE bapiret2.
  documentdata-documenttype = 'ABC'.
  documentdata-description = 'Test'.

CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
  EXPORTING
    documentdata               = documentdata
*   HOSTNAME                   =
*   DOCBOMCHANGENUMBER         =
*   DOCBOMVALIDFROM            =
*   DOCBOMREVISIONLEVEL        =
*   CAD_MODE                   = ' '
*   PF_FTP_DEST                = ' '
*   PF_HTTP_DEST               = ' '
 IMPORTING
   DOCUMENTTYPE               = DOCUMENTTYPE
   DOCUMENTNUMBER             = DOCUMENTNUMBER
   DOCUMENTPART               = DOCUMENTPART
   DOCUMENTVERSION            = DOCUMENTVERSION
   RETURN                     = RETURN
* TABLES
*   CHARACTERISTICVALUES       =
*   CLASSALLOCATIONS           =
*   DOCUMENTDESCRIPTIONS       =
*   OBJECTLINKS                =
*   DOCUMENTSTRUCTURE          =
*   DOCUMENTFILES              =
*   LONGTEXTS                  =
*   COMPONENTS                 =
          .

1 ACCEPTED SOLUTION
Read only

former_member451655
Active Participant
0 Likes
509

hi ,

use a Transaction Commit (Copy the Below Code and paste right after Execute BAPI )

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'.

Br,

Dilum Alawatte

I have the following code to test this BAPI. When I execute it I get a document number returned and the return structure is initial. This tells me that a document was sucessfully created. However, when I try to view the document, it doesn't exist. Any ideas?

I know this is "bare-bones" but that is by design.

Regards,

Davis


  DATA: documentdata TYPE bapi_doc_draw2.
   DATA: documenttype TYPE bapi_doc_aux-doctype,
        documentnumber TYPE bapi_doc_aux-docnumber,
        documentpart TYPE bapi_doc_aux-docpart,
        documentversion TYPE bapi_doc_aux-docversion,
        return TYPE bapiret2.
  documentdata-documenttype = 'ABC'.
  documentdata-description = 'Test'.

CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
  EXPORTING
    documentdata               = documentdata
*   HOSTNAME                   =
*   DOCBOMCHANGENUMBER         =
*   DOCBOMVALIDFROM            =
*   DOCBOMREVISIONLEVEL        =
*   CAD_MODE                   = ' '
*   PF_FTP_DEST                = ' '
*   PF_HTTP_DEST               = ' '
 IMPORTING
   DOCUMENTTYPE               = DOCUMENTTYPE
   DOCUMENTNUMBER             = DOCUMENTNUMBER
   DOCUMENTPART               = DOCUMENTPART
   DOCUMENTVERSION            = DOCUMENTVERSION
   RETURN                     = RETURN
* TABLES
*   CHARACTERISTICVALUES       =
*   CLASSALLOCATIONS           =
*   DOCUMENTDESCRIPTIONS       =
*   OBJECTLINKS                =
*   DOCUMENTSTRUCTURE          =
*   DOCUMENTFILES              =
*   LONGTEXTS                  =
*   COMPONENTS                 =
          .

2 REPLIES 2
Read only

former_member451655
Active Participant
0 Likes
510

hi ,

use a Transaction Commit (Copy the Below Code and paste right after Execute BAPI )

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT = 'X'.

Br,

Dilum Alawatte

Read only

0 Likes
509

I tried that in the test tool but not in the program. Good idea; it was an oversight by me. That corrected the problem.

Thanks!

Davis