2007 Sep 13 6:31 PM
Hi all,
Is it possible to call methods from the Business Object BUS2032.
If so, how can it be done??
Regards,
2007 Sep 13 7:52 PM
Hello Marvin
"Methods" of business objects are no class methods in technical terms. They are just semantic definitions.
If you call transaction SWO1 and display your business "object" (which is no object in the OO-sense) BUS2032 then you see "method" <b>SalesOrder.ChangeFromData</b>.
Double-click on the method name and switch to the tabstrip <b>ABAP</b>. There you see that this "method" is implemented by the BAPI<b> BAPI_SALESORDER_CHANGE</b>.
Regards
Uwe
Hi all,
Is it possible to call methods from the Business Object BUS2032.
If so, how can it be done??
Regards,
2007 Sep 13 7:52 PM
Hello Marvin
"Methods" of business objects are no class methods in technical terms. They are just semantic definitions.
If you call transaction SWO1 and display your business "object" (which is no object in the OO-sense) BUS2032 then you see "method" <b>SalesOrder.ChangeFromData</b>.
Double-click on the method name and switch to the tabstrip <b>ABAP</b>. There you see that this "method" is implemented by the BAPI<b> BAPI_SALESORDER_CHANGE</b>.
Regards
Uwe
2007 Sep 13 7:57 PM
Hello Marvin
If you look at <b>BUS2012 </b>(<i>Purchase order</i>) its methods are implemented by BAPI_PO_... BAPIs.
The corresponding classes (available >= 6.20) are <b>CL_PO_HEADER_HANDLE_MM</b> (Header) and <b>CL_PO_ITEM_HANDLE_MM</b> (Item).
Regards
Uwe
2007 Sep 14 12:39 AM
Hi Marv,
you sure can. Here is an extract from the SAP Help. I found it at http://help.sap.com/saphelp_46c/helpdata/en/c5/e4ad71453d11d189430000e829fbbd/frameset.htm
<b>Programmed Method Call</b>
Call (fictitious) method Print of object type VBAK (sales document). The method receives the parameters Paperformat and Printertype as input.
* Call method Print of object type VBAK
***************************************************
* Data declarations
***************************************************
DATA: VBAK_REF TYPE SWC_OBJECT.
SWC_CONTAINER CONTAINER.
* Create object reference to sales document
*************************************************
SWC_CREATE_OBJECT VBAK_REF 'VBAK' <KeySalesDoc>
* Fill input parameters
***************************************************
SWC_CREATE_CONTAINER CONTAINER.
SWC_SET_ELEMENT CONTAINER 'Paperformat' 'A4'.
SWC_SET_ELEMENT CONTAINER 'Printertype' 'Lineprinter'.
* Call Print method
***************************************************
SWC_CALL_METHOD VBAK_REF 'Print' CONTAINER.
* Error handling
IF SY-SUBRC NE 0.
.....
ENDIF.Cheers
Graham
2007 Sep 17 1:55 PM
Hi there --this is of course technically correct -- however I would where possible try and avoid the use of BO's. If you can find (or create) a genuine class then you can then use "proper" OO.
The concept of a BO was to allow for some limited type of "pseudo object" coding before ABAP supported a relatively powerful and full OO set.
Cheers
Jimbo
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |