SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

BAPI_DOCUMENT_CREATE



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Interfaces | Интерфейсы -> BAPI
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1637

PostPosted: Mon Dec 22, 2008 11:48 am    Post subject: BAPI_DOCUMENT_CREATE Reply with quote

BAPI_DOCUMENT_CREATE - Create document

Functionality
You can use this method to create documents and their respective data.
You can also check the original application files (1 and 2) into the SAP data base, vault, or archive.

Restrictions:
Additional files are not supported Long texts for object links are not supported Value assignments for the object
links are not supported
Code:
**..... Document data
DATA: ls_doc    LIKE bapi_doc_draw.

**..... Bapi return structure

ls_return LIKE bapiret2.

**.... key fields of new document
DATA: lf_doctype    LIKE bapi_doc_draw-documenttype,

lf_docnumber  LIKE bapi_doc_draw-documentnumber,
      lf_docpart    LIKE bapi_doc_draw-documenttype,

lf_docversion LIKE bapi_doc_draw-documenttype.

**.... Originals that are checked in at the same time

DATA: lt_files LIKE bapi_doc_files OCCURS 0 WITH HEADER LINE,

**.... Descriptions

lt_drat  LIKE bapi_doc_drat OCCURS 0 WITH HEADER LINE,

**.... Object links

lt_drad  LIKE bapi_doc_drad OCCURS 0 WITH HEADER LINE.

**----------------------------------------------------------------------

** Allocate document data

ls_doc-documenttype    = 'DRW'.
 ls_doc-documentnumber  = '4711'.
 ls_doc-documentversion = '000'.

ls_doc-documentpart    = '00'.

 ls_doc-description    = 'Gear box'.
 ls_doc-statusextern   = 'AF'.

ls_doc-laboratory     = '001'.
 ls_doc-wsapplication1 = 'DWG'.


** Check original 1 into the SAP data base at the same time
 REFRESH lt_files.
 CLEAR lt_files.

 lt_files-originaltype = '1'.
 lt_files-datacarrier  = 'SAP-SYSTEM'.
 lt_files-docfile      = 'c:\temp\drawing1.dwg'.

APPEND lt_files.

** Description in english
 CLEAR lt_drat.
 REFRESH lt_drat.
 lt_drat-language    = 'EN'.

lt_drat-description = 'gear'.
 APPEND lt_drat.

** Object link to material master
 CLEAR lt_drad.
 REFRESH lt_drad.
 lt_drad-objecttype = 'MARA'.
 lt_drad-objectkey  = 'M4711'.
 APPEND lt_drad.

* ---------------------------------------------------------------------
* Create document

* ---------------------------------------------------------------------
 CALL FUNCTION 'BAPI_DOCUMENT_CREATE'

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.

** Error occurred ??
  IF ls_return-type CA 'EA'.
    ROLLBACK WORK.

MESSAGE ID '26' TYPE 'I' NUMBER '000'
            WITH ls_return-message.

  ELSE.
    COMMIT WORK.
  ENDIF.


Notes
Apart from the document data, you can create the following data:
Object links
Classifications and characteristic value assignments
Language-dependent document descriptions
Document long texts
Document structures
Originals (1 and 2)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Interfaces | Интерфейсы -> BAPI All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.