10-05-2005 12:50 PM
Hello,
I know that you can call the methods of business objects with BAPIs. But I want to instantiate a business object directly in the ABAP code. Does anybody have a code example for doing this?
In theory I think that I have first do define a reference variable of the objecttype of the buisness object. Than I have to call the Create-Methode of the business object and assign the returned object to the reference variable. Is this correct?
Thanks.
Regards, Lars.
10-05-2005 12:59 PM
10-05-2005 12:59 PM
10-05-2005 1:01 PM
Hello,
INCLUDE <cntn01>.
DATA: l_object type swc_object.
DATA: lv_key(70) type c.
swc_container m_container.
SWC_CREATE_OBJECT l_object 'BUS2081' lv_key.
*WHERE bus2081 is any object type
*where lv_key is the key of the object
swc_call_method l_object 'DISPLAY' m_container.
where mcontainer is the methd container
10-05-2005 1:23 PM
hai,
how do we capture the standard events in bussines objects.
like what we do the class i the class builder using
set handeler obj->method of object
cheers
10-05-2005 1:25 PM
10-05-2005 1:14 PM
Hello,
thank you for your quick responces. They helped me a lot.
Regards, Lars.
10-05-2005 1:19 PM
if this is the solution do you want to be so kind to close the message and reward points.
thx,
Peter
10-05-2005 1:29 PM
Lars,
Some more info to add to what Peter has already explained well.
If you are going to call a method that has parameters (like a Create method as you mentioned) you would need to create and populate the container as follows.
swc_container wa_container.
swc_set_element wa_container 'Element1' 'Value'.
swc_set_table wa_container 'Element2' Itab.
Also make sure you are not calling a dialog method in a background context!
Cheers,
Ramki Maley.