However it's really easy to get the attribute from the BOR itself using very simple coding.
Most people shy away from this since a BOR is usually used in SAP workflow and most abap developers haven't had a lot of exposure to OO programming or SAP workflow.
Anyway here's sample code to return an Attribute of a BOR.
program zzreadbor. * Get an attribute of a business object. parameters: p_busobj(10) type c default 'BUSISM007', "IS Media customer p_key(70) type c, p_attr(32) type c default 'Xmediacustomer'. data: i_objtype TYPE swo_objtyp, i_objkey TYPE swo_typeid, i_element TYPE swo_verb. DATA object TYPE swo_objhnd. DATA verb TYPE swo_verb. DATA return TYPE swotreturn. DATA lt_container TYPE STANDARD TABLE OF swcont. data line type swcont. i_objtype = p_busobj. i_element = p_attr. i_objkey = p_key. * instantiate the business object. I.e give it a key and create it. CALL FUNCTION 'SWO_CREATE' EXPORTING objtype = i_objtype objkey = i_objkey IMPORTING object = object. * return attribute. CALL FUNCTION 'SWO_INVOKE' EXPORTING access = 'G' object = object verb = i_element IMPORTING return = return verb = verb TABLES container = lt_container. * the attribute value is returned in field line-value. IF return-code = 0. loop at lt_container into line. write: / line-value. endloop. endif.* The above example will return an 'X' if the customer is an IS Media customer or blank otherwise. Other good business objects to use are sales docs (header / line items), invoices, Info types etc etc.
You can also call methods this way as well -- change the access to 'C' in the SWO_INVOKE and pass the parameters to the method. Method name is in VERB. A bit more complex as in the case of Supertypes you need to find the program -- will post an example later --however to start with even the attributes are useful since on "Instantiation" of the BOR you have access to ALL the attribites of that BOR.
Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP MM SD Consultant
Contact : serkurumsal@yandex.com
Social Plugin