cancel
Showing results for 
Search instead for 
Did you mean: 

how to access BO Type attribute inside workflow steps

jagesh_lakdawala
Active Participant
0 Kudos

Hi Experts,

I have created one BO Type ZBO1 which having the Key_field1, Key_field2 and Method M1 and 1 attribute Atr1 defined.

From within the Workflow Template, I have used first Activity step which uses the single step Task which in turn uses the BO Type SYSTEM method GENERICINSTANTIATE. I am passing the BO Type and Key fields Key_Field1 and Key_Field2 in input and getting the reference of the generated BO Type Object into the Workflow container Element lets say GO_1(this is of type ZBO1).This step is working fine, I can see in Workflow Technical log SWIA.

Now using this GO_1 workflow container element, in next Activity step, I have called the ZBO1 method M1.this is also working fine, I can see in Log that same Reference variable GO_1 is being used with the same key fields values. NO issue till this point.

My requirement is to set the ZBO1 attribute Atr1 inside the method M1, so that after calling the ZBO1 method M1 from workflow, I would be able to use the Atr1 using the GO_1 ( I mean I want to use Atr1 value inside the workflow using the GO_1).

in nutshell, using the GO_1(of Type ZBO1) workflow container element inside the workflow, I would be able to access all the ZBO1 attributes. (In Technical log of workflow, I should see all the attributes values gets populated for GO_1).

I have already gone through the existing Threads in this regards but not getting the idea.

please suggest me some steps to follow.

Regards,

Jagesh

Accepted Solutions (0)

Answers (4)

Answers (4)

pokrakam
Active Contributor
0 Kudos

Hi Jagesh,

If you are new to BOR I would recommend bypassing it altogether and use ABAP Objects. That way you use the same skills and techniques as regular ABAP and don't need to learn two ways to do the same thing.

Regards,

Mike

jagesh_lakdawala
Active Participant
0 Kudos

Hi Mark,

I can understand your point of view; I would like to take this as learning opportunity for me so please give me some reference links/document from where I can get the concept of BOR so that I can use it in real work.

please help.

Thanks & Regards,

Jagesh

pokrakam
Active Contributor
0 Kudos

Hello Jagesh,

I'm Mike by the way, not Mark.

You misunderstood. What I meant was if you are new to BOR, don't spend too much time on it. Rather learn ABAP Objects. They are both used in Workflow, both do the same thing.

BOR Objects are the older technology and are specific to workflow, but ABAP Objects are used in almost all of SAP ERP. If you can code in ABAP you can understand BOR.

The Workflow book is a good resource. CL_SWF_FORMABSENC is a good example. And there are Jocelyn's excellent Blogs right here on SCN:

Why use ABAP OO with Workflow? - ABAP Development - SCN Wiki

Regards,

Mike

0 Kudos

Hi Jagesh,

Can u show the binding screen shot between the task and the method?

It  seems you are passing the instance to the method correctly but not receiving it back from the method after changing the same.

Thanks and Regards,

Vikram

jagesh_lakdawala
Active Participant
0 Kudos

Hi Mike,

sorry I wrongly used your name.

so from your reply, I  understood that ABAP BO is the older concept and hence new concept ABAP OO is to be used within the workflow.

ok I will follow this approach, so far I was using the concept like, inside the workflow Template, from each single step I used to call the BO Type method and this BO method internally calls the custom FM and custom class method for actual logic implementation.

so I nee to change this in such a way that from the single step task, I would have called ABAP OO class method directly and in this way can avoid the use of the custom BO Type.

Thanks for your guidance.

Regards,

Jagesh

pokrakam
Active Contributor
0 Kudos

Correct, but you must make sure your OO classes implement IF_WORKFLOW. Please read Jocelyn's blogs if not clear.

mathewzdavis
Active Participant
0 Kudos

Hi Jagesh,

I havn't tested but can you try this:

lv_obj-Attribute = value


swc_set_element container 'GO_1' lv_obj



Regards

jagesh_lakdawala
Active Participant
0 Kudos

Hi Mathew,

This is not working.

@Rick, can you please advise me on this requirement

your reply is helpful to me.

Regards,

Jagesh

mathewzdavis
Active Participant
0 Kudos

Hi jagesh,

To get object attribute use the following code

DATA lv_obj TYPE swc_object.

DATA lv_atr type atr1.


swc_get_element container 'GO_1' lv_obj.

swc_get_property lv_obj 'Atr1' lv_atr.



To set object attribute


swc_set_property lv_obj 'Atr1' lv_atr.

jagesh_lakdawala
Active Participant
0 Kudos

Hi Mathew,

when I am using the SWC_SET_PROPERTY macro inside the BO method then I am getting the syntax error as show below.

I also tried to access the attribute directly as "OBJECT-Attribute_name" inside the BO method and assigned a value to it. in this case when I run the BO method in test mode from SWO1 then I can see the value in this attribute perfectly, however when I execute the workflow and then when I check the Technical log in SWIA for the steps then I don't see any value inside the BO Reference variable (workflow container as shown below).

former_member185167
Active Contributor
0 Kudos

Can't say I've ever heard of swc_set_property.

Usually for each attribute you will have something like:

GET_PROPERTY  COLOUR CHANGING CONTAINER.

data: lv_colour(6) type c.

lv_colour = 'red'.

SWC_SET_ELEMENT CONTAINER 'Colour' lv_colour.

END_PROPERTY.

(I'm just typing this in, haven't tested it)

jagesh_lakdawala
Active Participant
0 Kudos

Hi Rick,

exactly, even I am getting the syntax error.

hope I will get some clue on my requirement.

Regards,

Jagesh

anjan_paul
Active Contributor
0 Kudos

HI,

  It is correct, if you want to set the attribute, then you have to create custom method in BO to set the attibute.

Just try to check the program for your attribute in SWO1. You will find the code populate the attribute ie only read

jagesh_lakdawala
Active Participant
0 Kudos

Hi,

I would like to know the below points.

(1)how to get/set the BO Type attribute inside the BO method itself.

(2)what coding is to be done inside the BO method so that I can access all BO attributes inside my workflow subsequent steps through GO_1 as mentioned above.

please go through my post again Anjan.

Thanks for your reply.

Regards,

Jagesh

anjan_paul
Active Contributor
0 Kudos

Hi,

    Every Attribute generally select value from database. So you have to use a method to update the database from method , so that attribute   are populated from database.