‎2010 Jul 02 5:53 AM
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!
‎2010 Jul 02 4:36 PM
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
‎2010 Jul 02 8:21 AM
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.
‎2010 Jul 02 2:35 PM
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!
‎2010 Jul 02 4:36 PM
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
‎2010 Jul 04 12:24 AM