Application Development 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: 

Help in Bapi_document_change

Former Member
0 Kudos

I am using Bapi_document_change.Its not changing the document fields.How to proceed?

4 REPLIES 4

former_member214131
Active Contributor
0 Kudos

Hi,

Please check the FM documentation. There is a Limitations section also. There is an example coding part also.

Also not sure of your exact requirement since there is no details explaining the problem or piece of code.

Best Regards, Murugesh AS

0 Kudos

Thanks for ur answer.

The error message it shows is "the knowledge provider is using this document type".Dnt know if there is mistake in my code or some other problem.Could you tell me what is the problem.

Former Member
0 Kudos

hi

good

go through this

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

thanks

mrutyun^

0 Kudos

Hi

Its given in the documentation part itself.The error I get reads like the knowledge provider is using the document type.I dnt understand this.