Skip to Content
Author's profile photo Chaudhury Sourya Prakash Dash

Call SAP Business Object Methods in your report Program using Macros

This blog is to explain how better we can reuse already coded business object methods. We navigate to Business Object explorer (Transaction Code SWO1) to explore all available business objects both standard and custom , Module wise , we see there are a lot of potential methods and attributes encapsulated based on business cases that can be reused.

Let us execute a business object method through SWO1 and later write  a program to call the method.

Execute a Business Object

Step-1 Go to transaction SWO1 and search a business Object

BO1.png

Step-2 Let  us  instantiate the BO (BUS0019) by passing key fields

BO2.png

   Click on OK the BO will get instantiated with its attributes value getting populated according to the key fields.

BO3.png

Step-3 Execute the edit method , for the edit dialog to be open and allowing user to update  values.

BO4.png

Program to call the method with Business Object Instantiation

*&———————————————————————*

*& Report  ZSAMPLE_BO_INSTANTAITION

*& Demo Use of BUS0019

*&———————————————————————*

REPORT  ZSAMPLE_BO_INSTANTAITION.
include <cntn01>.

                            “Data Declaration-key

data:begin of objkey,
        id type t500p-persa,
        personnelsubarea type t001p-btrtl,
      end of objkey.

                         “Data declaration of object

data:zbus0019 type swc_object.

SWC_CONTAINER CONTAINER.

                           “Now fill the value of key

objkey-id = ‘AR01’.
objkey-personnelsubarea = ‘0001’.

swc_create_object zbus0019 ‘BUS0019’ objkey.        “Instantiate Business Object

SWC_CALL_METHOD zbus0019 ‘Edit’ CONTAINER.

After Execution of this program it opens the edit dialog for Personnel area and subarea.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.