cancel
Showing results for 
Search instead for 
Did you mean: 

Getting error "file cannot be opened" while runningFM BAPI_DOCUMENT_CREATE2

Former Member
0 Kudos

Hi,

We are trying to upload document through Function Module BAPI_DOCUMENT_CREATE2. But we are getting below error.

TYPE E

ID 26

NUMBER 107

MESSAGE "File cannot be opened"

Original files are stored in SAP ECC Application Server.

Below I/Ps are given to Function Modules.

DOCUMENTDATA

DOCUMENTTYPE APP

DOCUMENTNUMBER

DOCUMENTVERSION 00

DOCUMENTPART 000

DESCRIPTION Upload from Server

USERNAME TPL_MM_ABAP

STATUSINTERN FR

DOCUMENTFILES

SOURCEDATACARRIER tpeccdev

STORAGECATEGORY ZST_AHMD

WSAPPLICATION JPG

DOCPATH /usr/sap/data/dms/file0023/712FL20070616.0002068.jpg

We also given full rights to folder "file0023" on OS level.

Thanks in advance....

Sunny

Accepted Solutions (1)

Accepted Solutions (1)

pavan_rachamalla
Explorer
0 Kudos

Hi,

Can you pass following parameters for hte function module?

pf_ftp_dest = 'SAPFTPA'

pf_http_dest = 'SAPHTTPA'

Thanks

Pavan

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

Thanks Pavan Rachamalla & Christoph Hopf for your replies.

I just passed the below data & it is working fine....now am able to upload documents.

pf_ftp_dest = 'SAPFTPA'

pf_http_dest = 'SAPHTTPA'

Once again thanks for your prompt reply.

Thanks & Regards,

Sunny

Former Member
0 Kudos

Hi,

Thanks Pavan Rachamalla & Christoph Hopf for your replies.

I just passed the below data & it is working fine....now am able to upload documents.

pf_ftp_dest = 'SAPFTPA'

pf_http_dest = 'SAPHTTPA'

Once again thanks for your prompt reply.

Thanks & Regards,

Jaimin shah

christoph_hopf
Advisor
Advisor
0 Kudos

Dear Sunny,

I would kindly ask you to check if a data carrier is defined in transaction DC20 with the file path prefix in transaction DC20 under "Define mount points /logical drive" or please remove the value 'tpeccdev' from your BAPI data in field SOURCEDATACARRIER in case the whole path is "/usr/sap/data/dms/file0023/712FL20070616.0002068.jpg".

Further I think this value should be entered in field DOCFILE instead of DOCPATH because here also the filename and extension is included.

Best regards,

Christoph

pavan_rachamalla
Explorer
0 Kudos

Hi Christoph,

I have a similar question. Here is my code. However it does not work. The error message i get is Error uploading the file.

I tried splitting file name to split between docpath as '/usr/sap/XFV/DVEBMGS20/data/' and doc file as 'pdfdata1.pdf'. But it still does not work.

ws_docdata-documenttype = 'XEV'.

ws_docdata-description = 'BAPI DMS'.

ws_docdata-statusextern = 'CT'.

ws_file-storagecategory = 'SAP-SYSTEM'.

ws_file-wsapplication = 'PDF'.

ws_file-originaltype = '1'.

ws_file-docfile = '/usr/sap/XFV/DVEBMGS20/data/pdfdata1.pdf'.

APPEND ws_file TO it_files.

lw_link-OBJECTTYPE = 'DIMAIOB'.

lw_link-OBJECTKEY = '00000000000053009076'.

APPEND lw_link to it_links.

CALL FUNCTION 'BAPI_DOCUMENT_CREATE2'

EXPORTING

documentdata = ws_docdata

pf_ftp_dest = 'SAPFTPA'

pf_http_dest = 'SAPHTTPA'

IMPORTING

documentnumber = v_docnum

documentpart = v_docpart

documentversion = v_docver

return = v_ret

TABLES

OBJECTLINKS = it_links

documentfiles = it_files.

Thanks

Pavan

christoph_hopf
Advisor
Advisor
0 Kudos

Hi Pavan,

based on your provided sample data and the fact that you are using SAP-SYSTEM for storing your originals I think the original data needs to be passed to BAPI table DOCUMENTDATA and not DOCUMENTFILES. The table DOCUMENTFILES is used for originals which are stored in KPRO storage categories.

Best regards,

Christoph

pavan_rachamalla
Explorer
0 Kudos

Hi Christoph,

I changed the storage category just to test. Initially i had

ws_file-storagecategory = 'DMS_C1_ST'.

ws_file-wsapplication = 'PDF'.

ws_file-originaltype = '1'.

ws_file-docfile = v_file.

APPEND ws_file TO it_files.

I changed the doc type to Kpro also.

However if i have this storage category The document is created, but there are no attachments.

I tried using app server file path, i get the same issue. Any clues?

Thanks

Pavan

christoph_hopf
Advisor
Advisor
0 Kudos

Hi Pavan,

normally the storage category DMS_C1_ST should be maintained in transaction OACT. Could you please check if this

entry exists here.

Best regards,

Christoph

pavan_rachamalla
Explorer
0 Kudos

Hi Christoph,

It was my mistake. I was passing on pf_ftp_dest = 'SAPFTPA' pf_http_dest = 'SAPHTTPA' for presentation server, that was the reason. I commented that out and added only for application server files. It worked. Appreciate your help. Unfortunately i did not raise the question. I could not award the points for you. Please let me know if you want me to raise another thread with the same question and pass it on to you to award points.

Thanks

Pavan