cancel
Showing results for 
Search instead for 
Did you mean: 

Issue creating new version with a external user from Java

Former Member
0 Kudos

Hi Gurus,

i need your help. i've implemented RFC in Sap that's called by JCO. When i want to create a new version, i do two calls to bapis:

1. CALL FUNCTION 'BAPI_DOCUMENT_CREATENEWVERSION'

EXPORTING

REFDOCUMENTVERSION = old_version

and copying object links from version.

2. CALL FUNCTION 'BAPI_DOCUMENT_CHANGE2'

EXPORTING

documenttype = DOCUMENTTYPE

documentnumber = DOCUMENTNUMBER

documentpart = DOCUMENTPART

documentversion = new_version

documentdata = gt_documentdata

documentdatax = gt_documentdatax

IMPORTING

return = gt_return

TABLES

objectlinks = gt_objectlinks

documentfiles = gt_documentfiles.

In table gt_return appears the following error: Document with new_version does not exist.

This only happens when i call RFC from JCO. If i call RFC in Sap, everything works perfectly.

Will I need SAP NOTE?

Thank you very much in advance. Regards,

Almudena

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

try like this, please enter what u configured parameters.

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.

Benakaraja

??

Former Member
0 Kudos

Can you please tell me what are the mandatory parameters and the values I need to pass for BAPI_DOCUMENT_CREATENEWVRS2 , as I am new to DMS.

Shilpa

Answers (3)

Answers (3)

christoph_hopf
Advisor
Advisor
0 Kudos

Hi Almudena,

regarding the BAPI call from JCO maybe the information at http://wiki.sdn.sap.com/wiki/display/PLM/BAPI_DOCUMENT_CHECKOUTVIEW2+in+JCO+environment could be useful for you.

Christoph

Former Member
0 Kudos

Hi,

Can you please tell me what are the mandatory parameters and the values we need to pass in BAPI_DOCUMENT_CREATENEWVRS2.

Shilpa

roopa_ms
Participant
0 Kudos

Hi

Please check your logic .

you are trying to get teh object links of the old version and then passing data to BAPI_DOCUMENT_CHANGE2 which will throw error .BAPI_DOCUMENT_CHANGE2 is used only for changing an existing document .

So, instead of doing this ,you can call BAPI_DOCUMENT_CREATENEWVRS2

with refdocument number/type/part/version and with new document version to be created.

Please do pass the object type (eg : MARA , AENR etc ) you want to copy in COPYOBJECTLINKS table .Otherwise it won't work.

Or else, if you don't know which all object types to copy,then get the details of old document version via BAPI_DOCUMENT_GETDETAIL2 and pass the object links to BAPI_DOCUMENT_CREATE2.

This will work .

Best Rgds,

Roopa