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_CHANGE2



 
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 1:57 am    Post subject: BAPI_DOCUMENT_CHANGE2 Reply with quote

BAPI_DOCUMENT_CHANGE2 - Change document

Functionality
You can change documents with this function module.
It can also be used to check in original application files into the SAP database, vault, or archive simultaneously.

Restrictions:
Additonal files are supported only as interface parameter for future deveoplemnt Mass check in is not supported
Code:

**..... Document data
DATA: ls_doc    LIKE bapi_doc_draw2.

**..... Indicator for change relevance

ls_docx   LIKE bapi_doc_drawx2,

**..... Bapi return structure
      ls_return LIKE bapiret2.


**.... Originals that are checked in simultaneously
      lt_files LIKE bapi_doc_files OCCURS 0 WITH HEADER LINE,


**.... Short texts
      lt_drat  LIKE bapi_doc_drat OCCURS 0 WITH HEADER LINE,

**.... Object links

lt_drad  LIKE bapi_doc_drad OCCURS 0 WITH HEADER LINE.

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


 ls_doc-documenttype    = 'DRW'.

ls_doc-documentnumber  = '4711'.
 ls_doc-documentversion = '00'.
 ls_doc-documentpart    = '000'.


ls_doc-description    = 'Transmission'.
 ls_doc-laboratory     = ''.

**  Set indicator for change relevance

ls_docx-description    = 'X'.
 ls_docX-laboratory     = 'X'.

** Insert object links
 CLEAR lt_drad.

REFRESH lt_drad.
 lt_drad-objecttype = 'MARA'.
 lt_drad-objectkey  = 'M0815'.
 APPEND lt_drad.

**----------------------------------------------------------------------
** Change document

**----------------------------------------------------------------------
  CALL FUNCTION 'BAPI_DOCUMENT_CHANGE2'

EXPORTING: documenttype    = ls_doc-documenttype
                  documentnumber  = ls_doc-documentnumber

documentpart    = ls_doc-documentpart
                  documentversion = ls_doc-documentversion

documentdata    = ls_doc
                  documentdatax   = ls_docx

IMPORTING: return          = ls_return
       TABLES:    objectlinks     = lt_drad.

** 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.
 ENDIF.


Notes
In addition to the document data you can also change the following data:

Object links
Classification and characteristic valuations
Language dependent document descriptions
Document long texts
Document structures
Original application files
Back to top
View user's profile Send private message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1637

PostPosted: Mon Dec 22, 2008 1:58 am    Post subject: Reply with quote

Code:
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                 =
          .

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
  EXPORTING
    WAIT = 'X'.
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.