Top Banner
Business Object Builder Transaction SWO1
27

Business Object in SAP

Oct 25, 2015

Download

Documents

eng_khalidseif
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Business Object in SAP

Business Object Builder

Transaction SWO1

Page 2: Business Object in SAP

Business Object Builder

• Transaction SWO1.– You can create a new object type– You can create a Subtype of an existing object

type

Page 3: Business Object in SAP

SWO1 (Create Subtype)

Page 4: Business Object in SAP

All fields are Mandatory

Page 5: Business Object in SAP

Assign a Package

Page 6: Business Object in SAP

Object Created

Page 7: Business Object in SAP

ZBUS2089 created

• ZBUS2089 will inherit all the properties of this Super type BUS2089.

• Attributes, Methods and Events of super type are available in ZBUS2089.

• Attributes, Methods and Events added in ZBUS2089 will not be available in BUS2089.

Page 8: Business Object in SAP

Create a new Method

Page 9: Business Object in SAP

Say No

Page 10: Business Object in SAP

Create with function module

• This will allow you to enter the Function module name and will create the code for the method for you.

• However, you can add your additional code to it.

• BAPI’s can also be added to a object type with the help of this feature.

Page 11: Business Object in SAP

Enter Details and Continue

Page 12: Business Object in SAP

Select and click Program Button.

Page 13: Business Object in SAP

Enter The codeBEGIN_METHOD SEND_MAIL_TO_NOTES CHANGING CONTAINER. DATA: l_ln like pa0105-usrid_long, l_trip_tot(20) type c, l_msg(500) type c.

DATA: OBJCONT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE, RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE, OBJHEAD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE, DOC_CHNG LIKE SODOCCHGI1, ENTRIES LIKE SY-TABIX, l_pernr like pa0105-pernr, l_trip_total like PTRV_SHDR-TRIP_TOTAL, l_sub(60) type c, l_body1(100) type c, l_body2(100) type c, l_body3(100) type c, l_body4(100) type c, l_body5(100) type c. swc_get_element container 'PersonnelNumber' l_pernr. swc_get_element container 'TotalCosts' l_trip_total. swc_get_element container 'Subject' l_sub. swc_get_element container 'Bodytxt1' l_body1. swc_get_element container 'Bodytxt2' l_body2. swc_get_element container 'Bodytxt3' l_body3. swc_get_element container 'Bodytxt4' l_body4. swc_get_element container 'Bodytxt5' l_body5. select usrid_long up to 1 rows into l_ln from pa0105 where pernr = l_pernr and SUBTY = '0010' and endda = '99991231'. endselect.

Contd.

Page 14: Business Object in SAP

Code continued DOC_CHNG-OBJ_NAME = 'WF e-mail'. DOC_CHNG-OBJ_DESCR = l_sub. DOC_CHNG-SENSITIVTY = 'P'. concatenate l_body1 l_body2 l_body3 l_body4 l_body5 into l_msg separated by space. condense l_msg. OBJHEAD = l_sub. APPEND OBJHEAD. OBJCONT = l_msg. APPEND OBJCONT. DESCRIBE TABLE OBJCONT LINES ENTRIES. READ TABLE OBJCONT INDEX ENTRIES. DOC_CHNG-DOC_SIZE = ( ENTRIES - 1 ) * 255 + STRLEN( OBJCONT ). CLEAR RECLIST. RECLIST-RECEIVER = l_ln. RECLIST-express = 'X'. RECLIST-REC_TYPE = 'U'. APPEND RECLIST.

* Send the document CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1' EXPORTING DOCUMENT_TYPE = 'RAW' DOCUMENT_DATA = DOC_CHNG PUT_IN_OUTBOX = 'X' TABLES OBJECT_HEADER = OBJHEAD OBJECT_CONTENT = OBJCONT RECEIVERS = RECLIST EXCEPTIONS TOO_MANY_RECEIVERS = 1 DOCUMENT_NOT_SENT = 2 OPERATION_NO_AUTHORIZATION = 4 OTHERS = 99. endif. END_METHOD.

Page 15: Business Object in SAP

Code for method

• Check

• Save

• Generate

Page 16: Business Object in SAP

Go Back and Select Parameters Button

Page 17: Business Object in SAP

Create Parameters

Page 18: Business Object in SAP

Say No

Page 19: Business Object in SAP

Create an Import parameter without any Data type reference

Page 20: Business Object in SAP

Parameters created

Page 21: Business Object in SAP

Check and Save Object Type to release the method

Page 22: Business Object in SAP

Implement the method First

Page 23: Business Object in SAP

Then Release

Page 24: Business Object in SAP

Now implement the Object type

Page 25: Business Object in SAP

Release the Object type

Page 26: Business Object in SAP

The Subtype of an Object Type is created

Page 27: Business Object in SAP

To create a new Object Type

• Select Create from Menu Object type and enter details. Keep Super type blank for a new object type.

• Add methods, attributes and events to the new object type.

• Implement method, attributes and events and then release them.

• Finally, implement and release the Object type.