Application Development and Automation 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: 
Read only

bapi_document_create2 problem

Former Member
0 Likes
584

Hi,

i face with a problem while using the bapi bapi_document_create2.

it adds the file path like '
Dogan\Main\Standards\0010415--P.pdf'

but i cannot open the file in cv02n.

And also it adds the material master elements but the description is not seen and when looked at with cv02n for material master, it asks me to 'Do you want to delete the object links? ', why i get this error?

The file is not on desktop, it is in another server and its path like that:

'
Dogan\Main\Standards\0010415--P.pdf'

Here is my sample code(i am trying to make it run):

(itabb is the internal table that i upload the file, tab-delimeted txt file.)

data:

lt_drad like standard table of BAPI_DOC_DRAD with header line,

data like BAPI_DOC_DRAW2,

dd like standard table of BAPI_DOC_DRAT with header line,

dfiles like standard table of BAPI_DOC_FILES2 with header line,

return like BAPIRET2.

clear:lt_drad,lt_drad[],data,dd,dfiles,dfiles[].

LOOP AT itabb.

CLEAR lt_drad.

lt_drad-objecttype = 'MARA'.

lt_drad-objectkey = itabb-matnr.

APPEND lt_drad.

data-DOCUMENTTYPE = itabb-dokar.

data-DOCUMENTNUMBER = itabb-doknr.

data-DOCUMENTVERSION = itabb-dokvr.

data-DOCUMENTPART = itabb-doktl.

data-DESCRIPTION = itabb-dktxt.

data-WSAPPLICATION1 = itabb-dappl.

data-DOCFILE2 = itabb-filep.

data-DATACARRIER2 = itabb-dttrg.

data-username = itabb-dwnam.

data-LABORATORY = itabb-labor.

dfiles-storagecategory = 'SAP-SYSTEM'.

dfiles-docfile = itabb-filep.

dfiles-wsapplication = itabb-dappl.

APPEND dfiles.

ENDLOOP.

sort:dfiles.

delete adjacent duplicates from dfiles.

data: dtype like BAPI_DOC_AUX-DOCTYPE,

dnumber like BAPI_DOC_AUX-DOCNUMBER.

CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'

EXPORTING

DOCUMENTDATA = data

    • HOSTNAME =

    • DOCBOMCHANGENUMBER =

    • DOCBOMVALIDFROM =

    • DOCBOMREVISIONLEVEL =

    • CAD_MODE = ' '

    • PF_FTP_DEST = ' '

    • PF_HTTP_DEST = ' '

    • DEFAULTCLASS = 'X'

IMPORTING

DOCUMENTTYPE = dtype

DOCUMENTNUMBER = dnumber

    • DOCUMENTPART =

    • DOCUMENTVERSION =

RETURN = return

TABLES

    • CHARACTERISTICVALUES =

    • CLASSALLOCATIONS =

DOCUMENTDESCRIPTIONS = dd

OBJECTLINKS = lt_drad

    • DOCUMENTSTRUCTURE =

DOCUMENTFILES = dfiles

    • LONGTEXTS =

    • COMPONENTS =

  • .

.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

wait = 'X'.

endform.

1 REPLY 1
Read only

Former Member
0 Likes
348

Hai....

As per the source code, i have checked there is no issue with that but check entry for

"'
Dogan\Main\Standards\0010415--P.pdf' "

remove this line

data-DOCFILE2 = itabb-filep.

if required remove data-DATACARRIER2 = itabb-dttrg

add this line

dfiles-docfile = '
Dogan\Main\Standards\0010415--P.pdf'

if this not works, just revert me back.

Cheers

KHS