BAPI and ABAP objects
Why BAPI is not integrated with ABAP objects? In general, BAPI is more in the macro level and ABAP objects in the micro. I think that the technical reason is that BAPI can be used from outside of R/3. The method this is based on is RFC and therefore all the BAPIs are function modules whereas methods of ABAP objects are not.
Object Oriented BAPI access Some standard ABAP Object classes encapsulating business objects from the BOR (since BAPI's are the API's of business objects). I don't believe there are many (any) provided by SAP. However, you can create your own wrapper classes calling methods of business objects using dedicated FM's starting with SWO_... Here is a small example: REPORT ybkpf_swo_test. *----------------------------------------------------------------------*
PUBLIC SECTION. TYPES BEGIN OF ac_doc_key.
CLASS-METHODS get
METHODS display. PRIVATE SECTION. DATA key TYPE
ac_doc_key.
ENDCLASS.
"LCL_ACCOUNTING_DOCUMENT
*----------------------------------------------------------------------*
METHOD get. DATA:
CREATE OBJECT r_object. r_object->key-company_code =
i_company_code.
objtype = 'BKPF'.
CALL FUNCTION 'SWO_CREATE'
ENDMETHOD. "lcl_accounting_document METHOD display. DATA :
CALL FUNCTION 'SWO_INVOKE'
ENDMETHOD. "display ENDCLASS. "LCL_ACCOUNTING_DOCUMENT IMPLEMENTATION PARAMETERS p_bukrs TYPE bkpf-bukrs.
DATA :
*----------------------------------------------------------------------*
ac_document = lcl_accounting_document=>get(
ac_document->display( ).
Fast Links:
SAP Certification, Functional, Basis Administration and ABAP Programming Reference Books ABAP Programming Tips
Best regards,
All the site contents are Copyright © www.erpgreat.com
and the content authors. All rights reserved.
|