Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

BAPI Encapsulation Into Class

FabioPagoti
Active Contributor
0 Likes
595

Hi OO Gurus,

i need to develop a report which calls a BAPI a few times to create documents. Depending on the type of document to be created, the parameters given to the BAPI will change.

My question is:

Is there any way of encapsulate a BAPI into an ABAP Class instead of transforming importing/exporting/tables parameters from BAPI into attibutes of the new class and create methods to handle this data? I mean a easier way...

Considering a class which encapsulates BAPIs data, each instance would represent a document and my report would just matter with how to fill class' attributes and call the mehod which calls the BAPI itself.

Thanks!

1 ACCEPTED SOLUTION
Read only

naimesh_patel
Active Contributor
0 Likes
528

I guess, you have to code the class to achieve this functionality. If you don't want to have Set methods, you declare your attributes as public so, you can set them directly. After setting them, you can call the method which calls the BAPI.

Regards,

Naimesh Patel

4 REPLIES 4
Read only

Former Member
0 Likes
528

BAPIs are already encapsulated by a class and declared as an API method in BOR. If you goto BAPI transaction, you can see the BO and the method for a BAPI.

That's the diffrence between a RFC and BAPI. BAPIs are declared as API methods in BOR.

Read only

0 Likes
528

Sorry Satyajit, i couldn't understand it very well..

i don't want just to encapsulate BAPI call... but encapsulate its parameters into classes attributes. My report would be responsible just to invoke set methods according to the requirement and the class would be responsible to keep this data in its attributes AND encapsulate BAPI call itself.

Another thing.. in BAPI transaction i could not find anything related to this class.

ThankS!

Read only

naimesh_patel
Active Contributor
0 Likes
529

I guess, you have to code the class to achieve this functionality. If you don't want to have Set methods, you declare your attributes as public so, you can set them directly. After setting them, you can call the method which calls the BAPI.

Regards,

Naimesh Patel

Read only

0 Likes
528

Thanks Patel! Any other answer?