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: 

Document Attachment

Former Member
0 Kudos
278

HI,

I need to attach a pdf file in plmd_audit transaction my file is already in SAP (AL11 directory); I'm using BDS_BUSINESSDOCUMENT_CREATEF with the standart parameters but not a local directory and, function module return error_kpro = 4

any suggestions?

thx in advance

Fabio

3 REPLIES 3

former_member189779
Active Contributor
0 Kudos
86

Hi,

Can you check if below code may be you can find the problem

data: i_files like bapifiles occurs 1 with header line,

i_signature like bapisignat occurs 1 with header line.

i_files-doc_count = '1'.

i_files-comp_count = '1'.

i_files-directory = 'C:\sappcadm'. "#EC NOTEXT

i_files-filename = 'BDSPRESENTATION.PPT'. "#EC NOTEXT

i_files-mimetype = 'PPT'.

append i_files.

i_signature-doc_count = '1'.

i_signature-prop_name = 'BDS_DOCUMENTTYPE'.

i_signature-prop_value = 'BUSTEST'.

append i_signature.

i_signature-prop_name = 'BDS_DOCUMENTCLASS'.

i_signature-prop_value = 'PPT'.

append i_signature.

call function 'BDS_BUSINESSDOCUMENT_CREATEF'

exporting

  • LOGICAL_SYSTEM =

classname = 'BUS0815'

classtype = 'BO'

  • CLIENT = SY-MANDT

object_key = '123'

  • IMPORTING

  • OBJECT_KEY =

  • return =

tables

files = i_files

signature = i_signature

0 Kudos
86

hi

the issue is

i_files-directory = 'C:\sappcadm'. "#EC NOTEXT

because my files are in a sap's directory for example /tmp

if I use the frontend directory it works fine

0 Kudos
86

I think this FM works only for uploading files from presentation server, at least i could not get it to work for files on AL11. The workaround that i implemented is to download the file from AL11 to the PC using a FM, and then call the FM BDS_BUSINESSDOCUMENT_CREATEF to upload from the folder.

I know this is a very crude method, but i didnt find any other solution. If you come across anything better, do share it on the forum, will help all of us

Regards,

Raghav.