BOR Object or ABAP Class
Hi Experts,
We are implementing the Leave Request WF using WS12300111. The user raises a leave request from the portal.
As per the functional point of contact, they have said that this WF can be set up in the configuration in SPRO to be triggered when a leave request is raised.
When we saw the standard SAP provided WF, the steps in it are based on ABAP class. I just want to know if the approach has to be only using ABAP classes or can BOR objects be used.
We require some customizations in the sense, we need to add some custom logic to retrieve some data from some custom tables and also display the same.
Kindly let me know if we need to use ABAP classes or we can use a BOR Object.
Cheers,
Belinda Clarke
Hi Karri,
Thanks a lot for your response.
I was actually evaluating the possibilities of the same as our WF consultant is currently on leave. I was just seeing a scenario where they have used BOR Object for Travel and Expenses module. When i saw the standard WF for Leave Request WS12300111, I was seeing mainly ABAP Objects and there was no BOR objects used.
I just wanted to confirm whether we could create a BOR Object or go on with the ABAP Classes. Does the ABAP Classes involve a lot of effort? We need to actually send email notifications and add some new steps etc...so was just thinking as to which would involve more effort.
We need to actually retrieve data from table PTREQ_ATTABS and send the email notification to the concerned user whenever the leave request is approved/rejected/cancelled as shown below :
Your leave request has been approved/rejected
Name : abcde
Emp No : 123456
Type of Leave : Annual Leave
Date : 7th July to 11th July
No. of Days : 3 days
So do u imply that all of this can be done with an ABAP Class
Could you kindly guide us.
Similar Messages
-
Hi,
Can anybody say when to use BOR object and Abap class in the task with an example.
Thanks,
MugundhanThere is no any specific condition or rule that for this purpose you need to use BOR and Class , it depends on your requirement. not only the requirement but also the new techniques to make classes not just as simple way to create objects but when you use classes in the Workflows they are not simple classes but they are BUSINESS CLASSES which makes a lot of difference.
Check the blogs of [Jocelyn Dart|https://www.sdn.sap.com/irj/scn/wiki?path=/pages/viewpage.action%3fpageid=55566] -
Hi
I am using a BOR objects, but in one of my activity I am trying to use a Z class. In the method of the Z class I want to get some of the attributes of the BOR class.
I have followed the same approach ( Defining constant ) as mentioned in the blog by Jocelyn Dart.
I am able to get the Binding in the workflow but not able to get the attribute value or instantiated object in the method.
How do I get those attributes or the instance of the BOR object in the method. Am I missing something?
Thanks
DhavalHi
Well I wanted to achieve something as follows:
1) The workflow was getting triggered from an Event of the BOR. So the binding was from the event to the workflow
2) Now the second step in the workflow was a method of a Zclass in the workflow. Somehow I was not getting the key of the BOR to the class so that the class can be instiated. ( Say the PR number or PO number which triggered the event)
I am able to do it using static attribute of the class to instiate the class. I do know whether the approach is right, but somehow it resolved my issue.
1) I declared a static attribute in the class.
2) Defined a container and hold the value in the container from the event object id. ( This holds the PO number which triggered the workflow )
3) In the binding between the workflow and the task where my class was used, I passed the container to the static attribute of the class.
4) In the class method FIND_BY_LPOR, I used the static attirbue instead of LPOR-INSTID to create the object.
Thanks for you help.
Regards
Dhaval -
Hello,
I am writing method in ABAP class which I will link to the Workflow Step. I want to access values of one of the Workflow Element which is Multiline and refering to BOR Object Type. My queries are as below:
1. How should I define Importing Parameter of Method which will import values from the Workflow Element which is Multiline and refering to BOR object type.
2. If I change value of that Workflow Element (Multipline refering to BOR object type) in ABAP class method, will it be automatically reflected in Workflow Container due to binding?
Edited by: Ashwin Sonkusare on Apr 1, 2011 3:35 PMHi,
1. How should I define Importing Parameter of Method which will import values from the Workflow Element which is Multiline and refering to BOR object type.
Please create a table type same as workflow multiline element type. ( You can also use standard table if present ).
Then use this table type as the type of the import parameter of the class.
Then u can pass the multiline element of workflow to abab calss
2. If I change value of that Workflow Element (Multipline refering to BOR object type) in ABAP class method, will it be automatically reflected in Workflow Container due to binding?
If u change the Workflow Element (Multipline refering to BOR object type) in ABAP class method, then u need to update the values of the workflow multiline element through reverse binging ( binding abap class to WF ).
Thanks and regards,
SNJY -
Guys,
Not even sure if this is possible...
How do I find BOR calls in an ABAP program.
Example: BUS2088 or BUS2008 in program SAPLCOIH - for PM/CS orders).
PeteAHi Peter,
Specify your business object and the method of the BOR object in the BASIC data tab in PFTC transaction.
If you want to trigger the Workflow through and event then you will have to first link your event of the Business Object to the WorkFlow Task in Workflow Builder (TCODE PFTC) and then you can do the following :
Please refer the code below to for your information.
Data for workflow trigger
DATA: objtype LIKE swetypecou-objtype,
objkey LIKE sweinstcou-objkey,
event LIKE swetypecou-event,
event_container LIKE swcont OCCURS 0 WITH HEADER LINE.
objtype = 'ZBUS1001'. "Material [sub object of BUS1001]
MOVE v_wfmatnr TO objkey. "V_WFMATNR is material number
event = 'CreatePLMMaterial'."Custom Event defined in
ZBUS1001 [Tcode SWO1]
REFRESH event_container.
*Following are the Event parameters required in the *Workflow
swc_set_element event_container 'Attachment' v_wfattachment.
swc_set_element event_container 'Material' v_wfmatnr.
swc_set_element event_container 'TisGroup' v_wftisgroup.
swc_set_element event_container 'SchDate' v_schdate.
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
objtype = objtype
objkey = objkey
event = event
TABLES
event_container = event_container
EXCEPTIONS
objtype_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
COMMIT WORK.
Please reward some points if it helps you.
Regards,
Amit M. Mishra -
How to Handle Business Object event in ABAP class
Hello Everybody,
I wanted to know if it was possible to reference BOR objects in ABAP class and handle BOR events in ABAP Objects.
Thanks in advance.Hi,
Catch the et_VALIDATE event, when InnerEvent = False and ItemChanged = True.
If pVal.EventType = BoEventTypes.et_VALIDATE Then
If pVal.InnerEvent = False And pVal.ItemChanged Then
'TODO Your code here...
End If
End If
Regards,
Vítor Vieira -
Binding ABAP Class Attribute with BUS2038 in a Standard WF task
Hi,
I need help as mentioned in the subject line.
In my standard task I am capturing event for BUS2038. In the General tab I have a ABAP class which has implemented IF_WORKFLOW. From BUS2038 I just need notification number.
Since my source is a BO and my target is a class. How do I make this conversion and pass the data to my class?
I know there are several solution but none have solved my concern.
Thanks,
Sridhar Karra.Hi,
If you want to access teh attributes of the BOR inside a class emthod then you have to make use of teh MACROS.
1. include INCLUDE CNTN01_SWC in the class local macros section. and in the type groupsof the class include SWC0.
2. Now if you know the key of the BOR instance then create a BOR object inside the class method as below
DATA lo_object TYPE SWC0_OBJECT.
SWC0_CREATE_OBJECT lo_object '<BUSXXXX>' '<Key of the BOR>.
the above line will create the instance of the bor inside the class method
now inorder to access the attributes of the BOR use the below code
DATA lv_notif_no TYPE <type of the notification>.
SWC0_GET_PROPERTY lo_object '<ATTRIBUTE NAME> lv_notif
In this way you can access the BOR attributes inside a class method.
Regards
Pavan
Edited by: Pavan Bhamidipati on Dec 15, 2011 11:01 PM -
Macro swc_set_objectkey in ABAP Class
Hello,
I want to use macro swc_set_objectkey in ABAP class. macro swc_set_objectkey is present in include <object>. I can not include <object> in ABAP class because it gives syntax error "You may only define classes, interfaces, or types in a CLASS-POOL". Can you please let me know what should be done in this case ?
Edited by: Ashwin Sonkusare on Apr 6, 2011 1:55 PMHi Rick,
Is possible to use macros in abap classes ,
review link
http://help.sap.com/saphelp_nw70/helpdata/en/c5/e4b130453d11d189430000e829fbbd/frameset.htm
Regards.
maopacheco. -
Include in ABAP class for Workflow
Hi,
In order to use BOR macros inside ABAP class, (From SAP help) came to know that we need to use include <cntn02> .
How to add this include to ABAP class for workflow?
Regds,
AkshayHi Akshay,
Slight difference, I said "keeping the class clean of BOR <i>code</i>". By all means use BO's in the class: basically create a ZCL_MATERIAL, and use BUS1001 as an attribute (I use a naming convention BO_* for these). As long as it's the right type (SIBFLPORB I think - no system handy right now), and the key values are populated correctly the system will instantiate it as necessary. So in WF I can refer to ZCL_MATERIAL.BO_MATERIAL whenever I need any of the BO's functionality.
You are correct though, creating a proper business class which you can instantiate such as material does involve a fair bit of effort and coding to set up. e.g. my last project I ended up creating one ZBOR subtype because all I needed was one new attribute - definitely not worthwhile creating a new class for. (USR01.zEmailAddress for what it's worth).
I've said before somewhere, it's not without pain, so if you're under time pressure etc, then it may be better to do whatever's quickest. There's nothing wrong with using BOR macros, it will still work for quite a few versions. I just meant to say that pure class(y) code is a preferred way to go if it makes sense to do so. This is not always the case.
Hope that helps,
Mike -
ASUG Presentation - April 2007 - Do you have the ABAP Classes presentation?
Hi all,
does anyone have a copy of the ASUG presentation that supported the session:
"Classy Workflows: Moving from Business Objects to ABAP Classes - practical examples, and case studies, for using ABAP Classes in Workflow applications".
Can you please send it to [email protected]
Much thanks and regards,
CristianaHi there
In Captivate, try opening the preferences by pressing Shift+F8 and navigating to the Project > Start and End and clearing the Auto Play option. Re-publish and re-insert into the PowerPoint and see if that helps.
Cheers... Rick
Helpful and Handy Links
Begin learning Captivate 5 moments from now! $29.95
Captivate Wish Form/Bug Reporting Form
Adobe Certified Captivate Training
SorcererStone Blog
Captivate eBooks -
Hi all.
I am wondering whether anyone ever use workflow in transaction MM41.
Does SAP provide standard BOR or ABAP Class for transaction MM41.
I know there is BUS1001006 but this only get triggers from MM01.
Does user exit or BADI is the only way to trigger workflow from MM41?
ThanksHello,
It might help if you said what MM41 was.
As usual, turn on the event trace (SWELS), create and save something in your chosen transaction and then check the event trace (SWEL) for any events.
regards
Rick Bakker
hanabi technology -
ALV using ABAP Classes and Objects
Hi All,
I am trying to print the values in my internal table using ALV, using ABAP classes and objects. Here the title for columns are picked based on the title specified in the data element. I want to set the title of my columns by my own. how to achieve this ?. Please provide me a sample code if possible.
thanks & regards,
Navneeth.KHello Navneeth
The following sample report shows how to build and modify a fieldcatalog (routine <b>BUILD_FIELDCATALOG_KNB1</b>).
*& Report ZUS_SDN_ALVGRID_EVENTS
REPORT zus_sdn_alvgrid_events.
DATA:
gd_okcode TYPE ui_func,
gt_fcat TYPE lvc_t_fcat,
go_docking TYPE REF TO cl_gui_docking_container,
go_grid1 TYPE REF TO cl_gui_alv_grid.
DATA:
gt_knb1 TYPE STANDARD TABLE OF knb1.
PARAMETERS:
p_bukrs TYPE bukrs DEFAULT '2000' OBLIGATORY.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING
e_row_id
e_column_id
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_hotspot_click.
* define local data
DATA:
ls_knb1 TYPE knb1,
ls_col_id TYPE lvc_s_col.
READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row_id-index.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
CASE e_column_id-fieldname.
WHEN 'KUNNR'.
SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
WHEN 'ERNAM'.
* SET PARAMETER ID 'USR' FIELD ls_knb1-ernam.
* NOTE: no parameter id available, yet simply show the priciple
CALL TRANSACTION 'SU01' AND SKIP FIRST SCREEN.
WHEN OTHERS.
* do nothing
ENDCASE.
* Set active cell to field BUKRS otherwise the focus is still on
* field KUNNR which will always raise event HOTSPOT_CLICK
ls_col_id-fieldname = 'BUKRS'.
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
is_row_id = e_row_id
is_column_id = ls_col_id.
ENDMETHOD. "handle_hotspot_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = p_bukrs.
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create ALV grid
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_docking
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Set event handler
SET HANDLER:
lcl_eventhandler=>handle_hotspot_click FOR go_grid1.
* Build fieldcatalog and set hotspot for field KUNNR
PERFORM build_fieldcatalog_knb1.
* Display data
CALL METHOD go_grid1->set_table_for_first_display
CHANGING
it_outtab = gt_knb1
it_fieldcatalog = gt_fcat
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Link the docking container to the target dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* ok-code field = GD_OKCODE
CALL SCREEN '0100'.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form BUILD_FIELDCATALOG_KNB1
* text
* --> p1 text
* <-- p2 text
FORM build_fieldcatalog_knb1 .
* define local data
DATA:
ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'KNB1'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT gt_fcat INTO ls_fcat
WHERE ( fieldname = 'KUNNR' OR
fieldname = 'ERNAM' ).
ls_fcat-hotspot = abap_true.
ls_fcat-scrtext_s = '<short text>'. " short text of column
ls_fcat-scrtext_m = '<medium text>'. " medium text of column
ls_fcat-scrtext_l = '<long text>'. " longtext text of column
ls_fcat-tooltip = '...'. " ALV control: Tool tip for column header
ls_fcat-coltext = '...'. " ALV control: Column heading
MODIFY gt_fcat FROM ls_fcat.
ENDLOOP.
ENDFORM. " BUILD_FIELDCATALOG_KNB1
Regards
Uwe -
Error handling in Abap Class for SAP Workflow
Hi Experts,
I would like to know if we have an option in abap classes used in workflows to send errors to the workflow log. We can achieve this in BOR Object methods by using the EXIT_RETURN <CODE> var 1 var 2 to send the errors back to the workflow, but how is this achieved through methods from classes used in workflows.
Appreciate your quick responses,
ChaitanyaJust raise exceptions in the normal OO way. Any exception that is a subclass of CX_BO_ERROR should be automatically available in workflow. Use subclasses of CX_BO_TEMPORARY for temporary errors.
-
Is it possible to create an ABAP class that inherits from a business object in the BOR ?
If it isn't possible, is there a way to create a business object instance in an ABAP program ?
Thank you,
Elad.Hi,
You can have a look at the TRXN SE24 -> class browser. Here you will find all the Classes related to all the application components....
I think you can instantiate these classes and use...
Hope it helps...
Lokesh
Pls. reward appropriate points -
Create Attachment in workflow through ABAP Class in ECC 5.0
Hi,
Wr are using SAP ECC 5.0 and i am trying to create attachment through ABAP class.
Here in ECC 5.0, macro INCLUDE cntn01_swc is not available.
I am getting an error in declaration of SOFM object, because again SWC0_OBJECT is not available.
I've tried creating the parameter as type SOFM and of type table of SOFM but it also not working.
Can anybody help me how i can create SOFM instance in ABAP class in ECC 5.0?
Regards,
SmitHi
I am not very much sure about ECC 5.0 environment. Firstly are you looking to create a SOFM object inside any class or program or Function module , If yes then you need to include a include INCLUDE CNTN01_SWC (No arrow brackets) if this include is not available then use INCLUDE<CNTN01> then declare a variable of type SWC0_OBJECT if you are using first include or declare of type SWC_OBJECT.
Once you include any of the includes then by making use of SWC macros you can create a object
SWC0_CREATE_OBJECT <VARAIBLE> <BOR NAME> <BORKEY> for first include.
SWC_CREATE_OBJECT <VARAIBLE> <BOR NAME> <BORKEY> for second include.
Regards
Pavan
Maybe you are looking for
-
[SOLVED] Dell 1558: audio doesn't work!
Hi, the sound does not work on my Dell 1558. these are some details: [tiziano@arch64 ~]$ lspci | grep Audio 00:1b.0 Audio device: Intel Corporation 5 Series/3400 Series Chipset High Definition Audio (rev 06) 02:00.1 Audio device: ATI Technologies Inc
-
Problem downloading ML in a MacBook
Hi: I've tryed at least three times to download ML with my MacBook Air (2011) and all the times did not succeed. I've downloaded ML with my iMac with no problem, but the instalation module I've downloaded simply disapeared after installation, so I co
-
How to export some records of a table
oracle: version 2.11, right click the grid, there is a export function, i can export some records, version 3.0.04, i can't find the export function, this feature is very useful to me , but why you remove it ?
-
There is a new DSM 2.0, but where are the tech specs?
Dear SDN Community, After the upgrade of one of our Portal systems from SP15 to SP17 we see that there is an additional configuration item in the System Objects availible. The new property it technical ID is: wap.ITS.SAP_Session_Management The descri
-
Execute exe From Within Prject Folder
Hey Everyone, I have an executable file which carry's out some calculations that I have placed in my project folder. The file resides in /utilities/ImageExtracter.exe that is a folder called utilities under the root folder. I am currently executing t