on 02-29-2008 5:13 AM
what is bapis and badis can you send me briefly about this
Hi
I am sending a program in regard to creation of bapis.Hopefully it may help.
Regards
Gaurav
&----
*& Report ZDEFAULT2 *
*& *
&----
*& *
*& *
&----
REPORT ZDEFAULT2.
**HEADER SECTION
PARAMETERS: p_auart TYPE auart OBLIGATORY.
PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
PARAMETERS: p_spart TYPE vtweg OBLIGATORY.
PARAMETERS: p_bstnk TYPE bstnk OBLIGATORY.
PARAMETERS: p_bstdk TYPE bstdk OBLIGATORY.
PARAMETERS: p_ship TYPE kunnr OBLIGATORY.
**ITEM SECTION
PARAMETERS: p_item TYPE posnr OBLIGATORY.
PARAMETERS: p_matnr TYPE matnr OBLIGATORY.
PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.
DATA: v_vbeln LIKE vbak-vbeln.
************************************************************************
DATA DECLARATION FOR THE FUNCTION MODULE FORMAT_MESSAGE ********
************************************************************************
DATA: msgid TYPE sy-msgid.
DATA: msgno TYPE sy-msgno.
DATA: msgv1 TYPE sy-msgv1.
DATA: msgv2 TYPE sy-msgv2.
DATA: msgv3 TYPE sy-msgv3.
DATA: msgv4 TYPE sy-msgv4.
DATA: msg(50).
DATA: HEADER LIKE BAPISDHD1.
DATA: I_PARTNERS LIKE BAPIPARNR OCCURS 1 WITH HEADER LINE.
DATA: I_ITEM LIKE BAPISDITM OCCURS 10 WITH HEADER LINE.
DATA: I_SCHEDULE LIKE BAPISCHDL OCCURS 10 WITH HEADER LINE.
DATA: RETURN LIKE BAPIRET2 OCCURS 1 WITH HEADER LINE.
order header values
HEADER-DOC_TYPE = p_auart.
HEADER-SALES_ORG = p_vkorg.
HEADER-DISTR_CHAN = p_vtweg.
HEADER-DIVISION = p_spart.
HEADER-PURCH_NO_C = p_bstnk.
HEADER-PURCH_DATE = p_bstdk.
order item level data
I_ITEM-ITM_NUMBER = p_item.
I_ITEM-MATERIAL = p_matnr.
I_SCHEDULE-ITM_NUMBER = p_item.
I_SCHEDULE-REQ_QTY = p_menge.
I_PARTNERS-PARTN_ROLE = 'AG'. " Soldto
I_PARTNERS-PARTN_NUMB = p_ship.
APPEND: I_ITEM,
I_SCHEDULE,
I_PARTNERS.
CLEAR: I_ITEM,
I_SCHEDULE,
I_PARTNERS.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
ORDER_HEADER_IN = HEADER
IMPORTING
SALESDOCUMENT = v_vbeln
TABLES
RETURN = RETURN
ORDER_ITEMS_IN = I_ITEM
ORDER_PARTNERS = I_PARTNERS
ORDER_SCHEDULES_IN = I_SCHEDULE.
*****loop at return.
*****write:/ return-message.
*****endloop.
LOOP AT return.
************************************************************************
CALLING THE FUNCTION MODULE FORMAT_MESSAGE TO DISPLAY VARIOUS MESSAGES
************************************************************************
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
id = sy-msgid
lang = '-D'
no = sy-msgno
v1 = sy-msgv1
v2 = sy-msgv2
v3 = sy-msgv3
v4 = sy-msgv4
IMPORTING
msg = msg
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
************************************************************************
TO GIVE THE COLOR TO THE ERROR AND SUCCESS MESSAGES **********
************************************************************************
IF SY-SUBRC EQ 0.
FORMAT COLOR 5.
ELSEIF SY-SUBRC NE 0.
FORMAT COLOR 6.
ENDIF.
WRITE: / return-msgtyp , return-msgnr.
WRITE: / msg.
write:/ return-message.
ENDLOOP.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Bapi is used to create the Database Entries :
Running BAPI directly hits the Database..for eg PO is created by running Tcode ME21n and the changes are reflected in the ReleVANT TABLES..
LIKE ekko AND ekpo so on ..
But running BAPI is direct way..when u pass all the header and item details..
Whereas BADi is provided in the SAP code just like Customer Exits..
to adjust the User Requirement .
BAdi is Object Oriented
BAPI
BAPI Programming guide: -
http://help.sap.com/saphelp_nw04/helpdata/en/e0/9eb2370f9cbe68e10000009b38f8cf/frameset.htm
BAPI user guide: -
http://help.sap.com/saphelp_46c/helpdata/en/7e/5e115e4a1611d1894c0000e829fbbd/frameset.htm
BAPI STEP BY STEP PROCEDURE: -
http://www.sap-img.com/abap/bapi-step-by-step-guidance.htm
Example:-
http://www.erpgenie.com/abap/bapi/example.htm
PDF download: -
for BAPI's
http://www.sappoint.com/abap/bapiintro.pdf
http://www.sappoint.com/abap/bapiprg.pdf
http://www.sappoint.com/abap/bapiactx.pdf
http://www.sappoint.com/abap/bapilst.pdf
http://www.sappoint.com/abap/bapiexer.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDAPII/CABFAAPIINTRO.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFABAPIREF/CABFABAPIPG.pdf
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCFESDE8/BCFESDE8.pdf
http://www.planetsap.com/Bapi_main_page.htm
http://www.topxml.com/sap/sap_idoc_xml.asp
http://www.sapdevelopment.co.uk/
http://www.sapdevelopment.co.uk/java/jco/bapi_jco.pdf
http://www.sap-img.com/bapi.htm
http://www.sap-img.com/abap/bapi-conventions.htm
http://www.planetsap.com/Bapi_main_page.htm
http://www.sapgenie.com/abap/bapi/index.htm
Checkout !!
http://searchsap.techtarget.com/originalContent/0,289142,sid21_gci948835,00.html
http://techrepublic.com.com/5100-6329-1051160.html#
BADI
There are two steps in User Exit creation.
1} Identify the User Exit suitable for the requirement and that is available in the system:
Code SE18 is used to Identify the BADI available.
Look for the string 'CL_EXITHANDLER' in the standard program. This is a class which has a method 'GET_INSTANCE' which is used to trigger BADI's from the Standard Program. The interface parameter for this static method 'EXIT_NAME' is used to pass the BADI to the method.
Open Standard Program and do a global search 'CL_EXITHANDLER'.
SE18 > give the BADI name found through above search.
CUSTOMER_ADD_DATA > which has a method SAVE_DATA.
2} Implement the User Exit identified through above process.
T.Code SE19 is used to Implement BADI.
SE19 > give the implementation name > Give the Definition name as CUSTOMER_ADD_DATA and the Short Text.
Check these blogs 2 find a BADI:
How To Define a New BAdI Within the Enhancement Framework (Some Basics About the BAdI,BAdI Commands in ABAP,
When to Use a BAdI?)
/people/thomas.weiss/blog/2006/04/03/how-to-define-a-new-badi-within-the-enhancement-framework--part-3-of-the-series
How to implement a BAdI And How to Use a Filter
/people/thomas.weiss/blog/2006/04/18/how-to-implement-a-badi-and-how-to-use-a-filter--part-4-of-the-series-on-the-new-enhancement-framework
Introducing Business Add-Ins
How to implement BAdi in Enhancement Framework
Business Add-Ins
http://help.sap.com/saphelp_47x200/helpdata/en/ee/a1d548892b11d295d60000e82de14a/frameset.htm
BAdI: Customer-Defined Functions in the Formula Builder
http://help.sap.com/saphelp_nw04/helpdata/en/04/f3683c05ea4464e10000000a114084/content.htm
Difference Between BADI and User Exits
http://www.sap-img.com/abap/difference-between-badi-and-user-exits.htm
To Use BADI - Business Add In you need to Understand ABAP OO Interface Concept
http://www.sap-img.com/abap/business-add-in-you-need-to-understand-abap-oo-interface-concept.htm
Reward if useful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
BAPI Programming guide: -
http://help.sap.com/saphelp_nw04/helpdata/en/e0/9eb2370f9cbe68e10000009b38f8cf/frameset.htm
BAPI user guide: -
http://help.sap.com/saphelp_46c/helpdata/en/7e/5e115e4a1611d1894c0000e829fbbd/frameset.htm
BAPI STEP BY STEP PROCEDURE: -
http://www.sap-img.com/abap/bapi-step-by-step-guidance.htm
Example:-
http://www.erpgenie.com/abap/bapi/example.htm
PDF download: -
Reward points...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.