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: 

Link Workflow Document to BKPF object

Former Member
0 Kudos

I have a workflow document object (WF_DOC) that I created in my workflow that I want to attach/relate/link to a accounting document object (BKPF).

Has anyone tried this?

Standard workflow (SAP ver 4.6b) works great and attaches the WF_DOC to the task but I cannot find a way to create a link to it from the BKPF object.

I have tried calling the method CREATE_RELATION from the BDN Navigator class CL_BDS_DOCUMENT_SET but all I get is a 'Nothing found' message.

1 ACCEPTED SOLUTION

ramki_maley
Active Contributor
0 Kudos

Hi,

I doubt if it is possible. I have spent considerable time myself trying to get an attachment from WF to link to a BO, but could not. I am equally interested to see if someone will come up with an answer.

Cheers,

Ramki Maley.

9 REPLIES 9

ramki_maley
Active Contributor
0 Kudos

Hi,

I doubt if it is possible. I have spent considerable time myself trying to get an attachment from WF to link to a BO, but could not. I am equally interested to see if someone will come up with an answer.

Cheers,

Ramki Maley.

Former Member
0 Kudos

Thanks for your input Ramki,

in your efforts did you ever try the route as suggested by

SAP Note 501840?

0 Kudos

No, I have not. Interestingly this note is still in German though released in 2002! I tried to translate it on the Web but could not make any sense out of it.

Cheers,

Ramki Maley.

0 Kudos

it is for ver 610.

set your note language to 'EN'.

here follows SAP text:

Symptom

Conversion of WF_DOC object to SOFM documents generated in the step "Document from template" is managed by the workflow in the object type WF_DOC. Before you can send these documents as attachments, for example, they must be converted to the object type SOFM.

Other terms

Document from template, WF_DOC, SOFM, attachments in the workflow

Solution

1. To the class CL_SWF_DOC_TEMPLATE, add the method GET_CONTENT with the parameters

- CONTENT_SO Exporting type SOLIX_TAB

- SIZE Exporting type I

and exception NOT_FOUND

2. In the function group SWUO_OI, create the function module SWUO_GET_DOCUMENT_CONTENT with the parameters:

IMPORT

LOIO_ID TYPE SDOKOBJECT

EXPORT

PROPERTIES TYPE SWUOPROP

CONTENT_TAB_SO TYPE SOLIX_TAB

CONTENT_SIZE TYPE I

EXCEPTIONS

OBJ_NOT_SPECIFIED

NOT_FOUND

3. To the object type WF_DOC, add the method CREATE_SOFM ( no dialog, synchronous, no result parameter)

Export parameter SOFM_OBJECT type SOFM

Exception 1001 application area swuo message 12

Import the source code from the correction instructions.

0 Kudos

Thanks Niall,

I am pretty sure I did not see the 'EN' option when I looked at the note (but today is Friday, and my mind is already on the flight home!).

The note is not applicable for me because I am on 6.20 and what I was trying to do is to get a front end file attached to a WI to be linked to the BO.

Cheers,

Ramki Maley.

0 Kudos

I not sure how you would do this with a file that is on the frontend but I have now got this working by creating a binary relation between the WF_DOC and BKPF.

I noticed that when you use the WF_DOC SAP stores the file in SAP as RAW format and then uploads and downloads a copy with a key attached to the original filename to the users SAPWORKDIR on the frontend.

0 Kudos

Once the file is attached to a work item, it is stored in SAP as a folder document. What I was trying to do was automatically link the folder document to the Business Object so that it becomes visible through GOS. Can you explain how you made the binary relation between WF_DOC and BKPF?

Thanks,

Ramki Maley.

0 Kudos

Check out the gos documentation (look for references to table VRBINRELATION and function BINARY_RELATION_CREATE)

http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVOBS/BCSRVOBS.pdf

and

http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVGBT/BCSRVGBT_STRUCTURE.pdf

There are two tasks set this up:

Task 1: Create config for relation in table VRBINRELATION using SM34

Task 2: submit the the two objects with the OBJECT ROLES as required by function module BINARY_RELATION_CREATE and the RELATION TYPE you defined in task 1.

Dont forget to us the 'commit work' statement at the end.

eg my function module

Import parameters :

Value

OBJKEYA '15000510251202005' OBJCLSSA 'BKPF' BJCLSTYPA 'BO'

OBJKEYB '42EA7DD70630158CE1000000C0A8FB6EWF_FILE'

OBJCLSSB 'WF_DOC' OBJCLSTYPB 'BO'

RELTYP 'ZSUP'

(ZSUP is the relation type from VRBINRELATION)

function z_create_binary_relation.

*"----


""Local interface:

*" IMPORTING

*" REFERENCE(OBJKEYA) LIKE SWEINSTCOU-OBJKEY

*" REFERENCE(OBJCLSSA) LIKE SWEINSTCOU-OBJTYPE

*" REFERENCE(OBJCLSTYPA) LIKE BAPIBDS01-CLASSTYPE

*" REFERENCE(OBJKEYB) LIKE SWEINSTCOU-OBJKEY

*" REFERENCE(OBJCLSSB) LIKE SWEINSTCOU-OBJTYPE

*" REFERENCE(OBJCLSTYPB) LIKE BAPIBDS01-CLASSTYPE

*" REFERENCE(RELTYP) LIKE VRBRELTYP-RELTYPE

*"----


data: objrole_a type borident,

objrole_b type borident,

  • reltype type binreltyp,

binarel type gbinrel,

binrel_attrib type brelattr occurs 0.

if objclstypa = 'BO'.

call function 'SWO_OBJTYPE_EXIST'

exporting

objtype = objclssa

exceptions

objtype_not_found = 1

others = 2.

if sy-subrc <> 0.

exit.

  • message id sy-msgid type 'E' number sy-msgno

  • with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endif.

if objclstypb = 'BO'.

call function 'SWO_OBJTYPE_EXIST'

exporting

objtype = objclssb

exceptions

objtype_not_found = 1

others = 2.

if sy-subrc <> 0.

exit.

  • message id sy-msgid type 'E' number sy-msgno

  • with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

endif.

objrole_a-objkey = objkeya.

objrole_a-objtype = objclssa.

objrole_b-objkey = objkeyb.

objrole_b-objtype = objclssb.

call function 'BINARY_RELATION_CREATE'

exporting

obj_rolea = objrole_a

obj_roleb = objrole_b

relationtype = reltyp

importing

binrel = binarel

tables

binrel_attrib = binrel_attrib

exceptions

no_model = 1

internal_error = 2

unknown = 3

others = 4.

if sy-subrc <> 0.

exit.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

endif.

commit work.

endfunction.

Former Member
0 Kudos

Hello Niall,

Hello guys,

I tried to follow your description, from Sep 1, 2005 10:48 PM, how to link the SOFM and BKPF BOs.

Task 1: Create config for relation in table VRBINRELATION using SM34:

Roll categories:

Rolle type Description Obj.type Name

ZFIPP FIPP FIPP Parked Document

Rolle type Description Obj.type Name

ZSOFM SOFM SOFM Office Document

Binary relationship type

Rel. type ZFUS

Type role A ZFIPP

Type role B ZSOFM

Cardinality role A N

Cardinality role B N

Semantics A to B RTAB: FIPP --> SOFM

Semantics B to A RTAB: SOFM --> FIPP

Table SRGBINREL

and

Rel. type ZSUF

Type role A ZSOFM

Type role B ZFIPP

Cardinality role A N

Cardinality role B N

Semantics A to B RTAB: SOFM --> FIPP

Semantics B to A RTAB: FIPP --> SOFM

Table SRGBINREL

Task 2: submit the two objects with the OBJECT ROLES as required by function module BINARY_RELATION_CREATE and the RELATION TYPE you defined in task 1:

Here I call the FM u201CBINARY_RELATION_CREATEu201D with the following parameters:

OBJ_ROLEA FOL29000000000024EXT33000000000006 SOFM

OBJ_ROLEB FIPP:Z00232300000012008 FIPP

RELATIONTYPE ZSUF

FIRE_EVENTS X

Or

OBJ_ROLEA FIPP:Z00232300000012008 FIPP

OBJ_ROLEB FOL29000000000024EXT33000000000006 SOFM

RELATIONTYPE ZFUS

FIRE_EVENTS X

Unfortunately, although the FM ends without exception I do not get the desired linkage in GOS for the FIPP object.

Any idea is very appritiated!

Thanks,

Valentin