cancel
Showing results for 
Search instead for 
Did you mean: 

BAPI DOCUMENT CREATE2

Former Member
0 Kudos

Hi,

when I look at my BAPI-explorer (ECC 6.0) there is no export parameter documentnumber, which gives back the number of the DIR using internal numbering.

If I look at the function module BAPI_DOCUMENT_CREATE2 there is an export parameter documentnumber.

Is there any other way to find out, which documentnumber is asigned ?

regards Iring

Accepted Solutions (0)

Answers (1)

Answers (1)

christoph_hopf
Advisor
Advisor
0 Kudos

Hi Iring,

as far as I know there is no other possibility to see the new generated document number than in the result of BAPI_DOCUMENT_CREATE2 (table DOCUMENTDATA).

Best regards,

Christoph

Former Member
0 Kudos

Hi Christoph,

there is no table documentdata in BAPI_DOCUMENT_CREATE2, it is an export parameter. Using the function module BAPI_DOCUMENT_CREATE2, I get the documentnumber back in this export parameter, but I can't access this export parameter calling the BAPI. Look at the BAPI-explorer at the method CREATE2, there is no export parameter documentnumber.

Unfortunately I can't add a screen-dump here to clarify this.

regards Iring

christoph_hopf
Advisor
Advisor
0 Kudos

Hi Iring,

I'm sorry but if you use the internal numbering the new document number could only be seen as export parameter. There is no other way in the BAPI to get this number before.

If you use the external or mixed document numbering you can hand over a document number in the field "Documentnumber" as import parameter.

Best regards,

Christoph

Former Member
0 Kudos

Hi Christoph,

you are right. But my problem is, that there is no export-parameter in the BAPI-call.

I have send you some screen dumps, maybe that makes clear what I mean.

May be this is a matter for an OSS-call.

Iring

christoph_hopf
Advisor
Advisor
0 Kudos

Hi Iring,

thanks for the sent screenshots. I've checked the behavior and settings in our internal test systems and these are the current standard settings for BAPI_DOCUMENT_CREATE2.

Maybe you can tell me what you want to do with the export parameters. However as far as I know the exported document data could not be changed.

Best regards,

Christoph

Former Member
0 Kudos

Hi Christoph,

my intension was to write an excel VBA, which creates a DIR with internal numbering and report the new documentnumber back into the excel-sheet. I tried to do this with a bapi call, but i didn't find an way to get the documentnumber back.

In the meantime I solved the problem, by using the function module BAPI_DOCUMENT_CREATE2 instead of the BAPI.

So my code looks like this :

Set oDocument = functionCtrl.Add("BAPI_DOCUMENT_CREATE2")

Set oService = functionCtrl.Add("BAPI_TRANSACTION_COMMIT")

Set oDocumentdata = oDocument.exports("DocumentData")

......

......

oDocument.call

oService.exports("WAIT") = "X"

oService.call

dok_nummer = oDocumentdataExport("documentnumber")

doc_version = oDocumentdataExport("documentversion")

dok_teil = oDocumentdataExport("documentpart")

dok_art = oDocumentdataExport("documenttype")

I was just wondering, whether I didn't seen the right way, or whether it is not implemented.

regards Iring

christoph_hopf
Advisor
Advisor
0 Kudos

Hi Iring,

first of all I'm glad to hear that the issue could be solved and that you post the information about the solution in the forum.

However I always thought we are talking about the BAPI_DOCUMENT_CREATE2 function module, as the BAPI transaction is only used for getting information on all available BAPIs. However the behavior is the current standard and the CREATE2 BAPI is used to create new document info records.

Best regards,

Christoph

Former Member
0 Kudos

Hi Christoph,

so far we used BAPI calls, when we connected via RFC. The code then looks like this :

Set oService = oBapiCtrl.GetSAPObject("BapiService")

Set oService = oBAPICtrl.GetSAPObject("BapiService")

Set oDocumentdata = oBAPICtrl.DimAs(oDocument, "Create2", "DocumentData")

......

......

oDocument.Create2 DocumentData:=oDocumentdata, ClassAllocations:=oDocumentClassAll, _

DocumentDescriptions:=oDocumentDescription, _

LongTexts:=oDocumentLongText, _

CharacteristicValues:=oDocumentClassChar, _

ObjectLinks:=oDocumentLinks, Return:=oReturn

Service.TransactionCommit WAIT:="X"

But this doesn't work with internal numbering, when you have the need to get the documentnumber back.

Thank you very much for your help

Iring