Skip to Content
0
Former Member
Apr 21, 2008 at 11:43 AM

Attaching PDF to FB02

817 Views

Hi

I am trying to write an ABAP program for uploading a PDF document from a smartform to SAP document in FB02 in background without any user dialog.

I am using the following FMs in sequence:

1. SSF_FUNCTION_MODULE_NAME & calling the Smartform FM enabling the OTF option in the control parameters.

2. CONVERT_OTF - converts OTF to PDF

3. SWA_STRING_FROM_TABLE - converts OTF to string

4. SWA_STRING_TO_TABLE - converts string to SAP Office table

5. SO_FOLDER_ROOT_ID_GET

6. SO_ATTACHMENT_INSERT

7. BINARY_RELATION_CREATE

My program is failing in the last step - It fails with message "No model"

Following is the code snippet for the attachment part:

CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'

EXPORTING

region = 'B'

IMPORTING

folder_id = l_folder_id

EXCEPTIONS

OTHERS = 1.

ls_object_hd_change-objdes = 'Test Radha'.

ls_object_hd_change-file_ext = 'PDF'.

CALL FUNCTION 'SO_ATTACHMENT_INSERT'

EXPORTING

object_id = l_folder_id

object_hd_change = ls_object_hd_change

attach_type = 'OTF'

IMPORTING

attach_id = l_attach_id

TABLES

objcont = lt_objcont[]

objhead = lt_objhead

EXCEPTIONS

active_user_not_exist = 1

object_type_not_exist = 2

operation_no_authorization = 3

owner_not_exist = 4

parameter_error = 5

substitute_not_active = 6

substitute_not_defined = 7

x_error = 8

system_failure = 9

communication_failure = 10

OTHERS = 11

.

CONCATENATE l_folder_id

l_attach_id

INTO ls_obj_roleb-objkey.

ls_obj_roleb-objtype = 'MESSAGE'.

ls_obj_rolea-objkey = '1900000557'.

ls_obj_rolea-objtype = 'BUS6035'.

lc_relationtype = 'ATTA'.

CALL FUNCTION 'BINARY_RELATION_CREATE'

EXPORTING

obj_rolea = ls_obj_roleb

obj_roleb = ls_obj_rolea

relationtype = lc_relationtype

EXCEPTIONS

no_model = 1

internal_error = 2

unknown = 3

OTHERS = 4

.

I am not very clear about the values to be passed to the parameters in BINARY_RELATION_CREATE.

Can anyone please assist?

- Radha