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

Creating attachments in background

Former Member
0 Likes
919

Hi,

I have a PDF document stored on my C: drive. I want to attach it to a RFQ in background.

RFQ is getting created by a RFC which is called from a third party(Non SAP) system.After the RFQ is created, the file in C: drive should automatically get attached to the created rFQ.

I have seen that the function module SO_DOCUMENTS_NAMAGER can be used to read and create a document in SAP. Later we can use BINARY_RELATION_CREATE to create the link between invoice and the document.Problem is these use Frontennd Services.

If I execute these function modules in SAP GUI, it works fine. But when the call is made from a third part system in background, these functions give a DUMP "CNTL_ERROR" in CL_GUI_FRONTEND_SERVICES->CONSTRUCTOR.

Any one has any idea of how a document can be read in background without using Frontend services.

Thanks,

Prasanna

7 REPLIES 7
Read only

Former Member
0 Likes
769

Prasanna,

The GUI CONTROL used by the Class CL_GUI_FRONTEND_SERVICES is SAP GUI dependent. Since you making a Call from the Third Party system, you cannot use the Services available in the CL_GUI_FRONTEND_SERVICES.

Please look out for the other options.

Thanks

Kam

Read only

0 Likes
769

Hi Kam,

Do you have any idea of other options available.

Thanks,

Prasanna

Read only

athavanraja
Active Contributor
0 Likes
769

you can use the following function module

BDS_BUSINESSDOCUMENT_CREATEF

Regards

Raja

Read only

0 Likes
769

use the following paramters:

Logical system = <logical system>

Class name = 'BUS2105'

Class type = 'BO'

Client = <client no>

object key = <RFQ Number> " network no. is 12 char long so the number has to be passed with leading zeros

and for the FILES table

directory = "d:\Documents and Settings\user\Desktop\"

(please note that this is case sensitive"

filename = <fielanme.txt> "with extension"

Regards

Raja

Read only

0 Likes
769

HI Raja,

I tried this and I got a dump

"CALL_XMLRFC_BACK_REJECTED "

ShortText RFC callback calls are not allowed in the current ABAP program

What hapenned?

The function module "RFC_START_PROGRAM" is to be called as Remote Function Call with destination 'BACK' (RFC Callback) in the ABAP context "SAPMHTTP ", but an RFC callback from the program "SAPMHTTP " was prevented explicitly.This is due to an application problem. The active transaction was " ".

Error in the ABAP application program.

The running ABAP program "SAPLSYSE" had to be terminated because a statement cannot be executed.

Erroranalysis In the main program "SAPMHTTP ", it was determined that no RFC callbacks are to be called in its ABAP context. Now, a function module was called that has executed an RFC callback via the ABAP statement CALL FUNCTION 'RFC_START_PROGRAM' DESTINATION 'BACK'

This action was explicitly executed by the application in the transaction " " and in the ABAP main program "SAPMHTTP ". This is due to an application problem.

Do you have any idea of why this dump is coming.

I am calling BDS_BUSINESSDOCUMENT_CREATEF in a Custom RFC Z_RFQ_CHANGE. This Z_RFQ_CHANGE is called from a third party system.

Thanks,

Prasanna

Read only

0 Likes
769

Hello dear all,

thanks to Raja I checked BAPI BDS_BUSINESSDOCUMENT_CREATEF which upload and store files to SAP objects. So, I sucessed to attach the file while testing the BAPI in our SAP system (these are my paramaters):

Import parameters Value

LOGICAL_SYSTEM <our system>

CLASSNAME BKPF

CLASSTYPE BO

CLIENT 020

OBJECT_KEY 024550100042102006

Tables Value

FILES 1 Entry

DOC_COUNT 00000001

COMP_COUNT 00000001

DIRECTORY C:\ZERP

FILENAME BOOK1.XLS

SIGNATURE

DOC_COUNT PROP_NAME PROP_VALUE

00000001 BDS_DOCUMENTTYPE ZFI3S_XLS

00000001 BDS_CONTREP SD

But we would like to call this BAPI from VBA (visual basic) program (we use the same parameters as the ones above) but we recieve :ERROR_KPRO and we do not have the message number in the log file of VBA , so we are not able to understand where can be the problem. My question is can we use this BAPI from external application like VBA and if yes what can be our problems . Because in the same VBA we call BAPI_ACC_DOCUMENT_POST and we do not have any problem.

Thansk a lot for any help

Best regards

Sabina

Read only

0 Likes
769

Hello,

sry for unearth this old thread.

I got similiar error when calling the bapi BDS_BUSINESSDOCUMENT_CREATEF via RFC.

"RFC_START_PROGRAM" doesn't work.

Have you found a solution for this?

Regards,