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

Former Member
0 Likes
1,735

Hi,

I am new to ABAP, could you please let me know what are the mandatory fields that I need to provide to create the Document Number in this BAPI BAPI_DOCUMENT_CREATE2. Please provide the complete details.

Also let me know will it allow us to create an external document number, i.e this document no can flow from another system to SAP R/3

Regards,

Nithiyanandam

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,433
CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
      EXPORTING: documentdata         = ls_doc
      IMPORTING: documenttype         = lf_doctype
                 documentnumber       = lf_docnumber
                 documentpart         = lf_docpart
                 documentversion      = lf_docversion
                 return               = ls_return
     TABLES: documentdescriptions = lt_drat
             objectlinks          = lt_drad
             documentfiles        = lt_files.

above are mandatory fields . after calling bapi_document_create2 ..check for sy-subrc and call BAPI_TRANSACTION_COMMIT as i have shown below.

** Did an error occur ??
      if ls_return-type ca 'EA'.
        rollback work.
        message id '26' type 'I' number '000'
                with ls_return-message.

      else.
        commit work.
        call function 'BAPI_TRANSACTION_COMMIT'
*     EXPORTING
*       WAIT          = WAIT
*     IMPORTING
*       RETURN        = RETURN
                  .
        write:/ lf_doctype,
                lf_docnumber,
                lf_docpart,
                lf_docversion.

      endif.
      clear: lt_drad, lt_files, ls_doc.
      refresh: lt_drad, lt_files.

9 REPLIES 9
Read only

Former Member
0 Likes
1,434
CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'
      EXPORTING: documentdata         = ls_doc
      IMPORTING: documenttype         = lf_doctype
                 documentnumber       = lf_docnumber
                 documentpart         = lf_docpart
                 documentversion      = lf_docversion
                 return               = ls_return
     TABLES: documentdescriptions = lt_drat
             objectlinks          = lt_drad
             documentfiles        = lt_files.

above are mandatory fields . after calling bapi_document_create2 ..check for sy-subrc and call BAPI_TRANSACTION_COMMIT as i have shown below.

** Did an error occur ??
      if ls_return-type ca 'EA'.
        rollback work.
        message id '26' type 'I' number '000'
                with ls_return-message.

      else.
        commit work.
        call function 'BAPI_TRANSACTION_COMMIT'
*     EXPORTING
*       WAIT          = WAIT
*     IMPORTING
*       RETURN        = RETURN
                  .
        write:/ lf_doctype,
                lf_docnumber,
                lf_docpart,
                lf_docversion.

      endif.
      clear: lt_drad, lt_files, ls_doc.
      refresh: lt_drad, lt_files.

Read only

Former Member
0 Likes
1,433

Link:

Read only

Former Member
0 Likes
1,433

Hi Friend,

Check this link for complete information regarding BAPI_DOCUMENT_CREATE2:

http://abap.wikiprog.com/wiki/BAPI_DOCUMENT_CREATE2

Regards,

Chandra Sekhar

Read only

0 Likes
1,433

Hi,

Could you please provide me these details of the values that I can provide for those fields, because the doc no is not getting generated.

Regards,

Nithiyanandam

Read only

0 Likes
1,433

Hi,

If the document number is not getting generated check SPRO settings also once....since if this is an external numbering then system would be expecting a document number provided by user .

Otherwise the essential fields are :

In document description table the language and the description field.

Under documentdata

1. the document type

2. the documnet number

3. the version

4. the document part

5. status extern

Thanks

Papiya

Read only

Former Member
0 Likes
1,433

Hi Nithayanandam,

Check this thread also

Regards,

Chandra Sekhar

Read only

Former Member
0 Likes
1,433

hii

here DOCUMENTDATA is mandatory field.you can check that in SE37 IMPORT parameters.

document number is generated by system so it will not allow you to create external document number.

regards

twinkal

Read only

0 Likes
1,433

Hi twinkal patel,

Please check the link, i have provided.

This is related to the fields present in DOCUMENTDATA. I want to know the values which I need to pass, so that th document number is created.

http://rapidshare.com/files/143564533/Document_create.PNG.html

Regards,

Nithiyanandam

Read only

0 Likes
1,433

Hi,

Any clues...

Regards,

Nithiyanandam