on 08-20-2009 5:21 PM
Hello Everybody,
I am creating the BAPI with the following code, but I see the error as specified below -
"Specified GetDetail BAPI Wrapper violates BAPI"
This is the code I have in the BAPI wrapper-
FUNCTION ZBAPI_CUST_GETDETAIL.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(BAPIKUNNR) LIKE BAPI1007-CUSTOMER
*" EXPORTING
*" VALUE(RETURN1) LIKE BAPIRETURN STRUCTURE BAPIRETURN
*" TABLES
*" ZBAPI_ORDERS STRUCTURE ZBAPI_ORDERS
*"----------------------------------------------------------------------
DATA : T_VBAK LIKE VBAK OCCURS 0 WITH HEADER LINE,
T_VBAP LIKE VBAP OCCURS 0 WITH HEADER LINE.
SELECT * FROM VBAK INTO TABLE T_VBAK WHERE KUNNR = BAPIKUNNR.
IF NOT T_VBAK[] IS INITIAL.
SELECT * FROM VBAP INTO TABLE T_VBAP FOR ALL ENTRIES IN T_VBAK WHERE VBELN = T_VBAK-VBELN.
IF SY-SUBRC EQ 0.
RETURN1-TYPE = 'S'.
RETURN1-MESSAGE = 'Data retrieved sucessfully'.
ENDIF.
ENDIF.
LOOP AT T_VBAP.
ZBAPI_ORDERS-VBELN = T_VBAP-VBELN.
ZBAPI_ORDERS-POSNR = T_VBAP-POSNR.
ZBAPI_ORDERS-MATNR = T_VBAP-MATNR.
ZBAPI_ORDERS-ARKTX = T_VBAP-ARKTX.
ZBAPI_ORDERS-KUNNR = BAPIKUNNR.
APPEND ZBAPI_ORDERS.
CLEAR ZBAPI_ORDERS.
ENDLOOP.
ENDFUNCTION.
Can someone tell me where am I going wrong? Please help me.
Thanks,
Sneha Singh.
Hi Sneha,
You can have bapi return parameter as exporting parameter itself. But your parameter name should be 'RETURN' not 'RETURN1'. And also parameter type should be 'BAPIRET2' not 'BAPIRETURN'.
For more details about bapi wrapper signature see the following link
Regards,
Dhana
Edited by: Dhanasekhar Karuppanan on Aug 21, 2009 5:54 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can also refer to the sample BAPIwrappers in middleware:
go to SE80-> give FUNCTION GROUP name as SDOE_SAMPLE_BAPIWRAPPERS
this contains example of all type of bapiwrappers.
Regards,
rohit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Sneha,
the signature you have provided has bapiret as exporting parameter but actually it should be a tables parameter and exporting parameter will be the work area of root node and importing will be the key fields for te root.
you can refer to this:
function sdoe_contact_getdetail.
*"----
""Local Interface:
*" IMPORTING
*" VALUE(MANDT) TYPE SDOE_PERSON-MANDT OPTIONAL
*" VALUE(PERSNUMBER) TYPE SDOE_PERSON-PERSNUMBER OPTIONAL
*" EXPORTING
*" VALUE(PERSON) TYPE SDOE_PERSON
*" TABLES
*" ADDRESS STRUCTURE SDOE_ADDRESS
*" E_MAIL STRUCTURE SDOE_E_MAIL
*" RETURN STRUCTURE BAPIRET2
*"----
data: lds_return like bapiret2.
clear return.
select single *
from sdoe_person
into person
where persnumber = persnumber.
if sy-subrc <> 0.
- Person not found (Persnumber = &)
lds_return-message_v1 = persnumber.
call function 'BALW_BAPIRETURN_GET2'
exporting
type = 'E'
cl = 'SDOE_SAMPLE_BAPI'
number = '005'
par1 = lds_return-message_v1
importing
return = lds_return.
append lds_return to return.
exit.
endif.
select *
from sdoe_address
into table
address
where persnumber = persnumber.
select *
from sdoe_e_mail
into table
e_mail
where persnumber = persnumber.
endfunction.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sneha,
Check Vinod's reply in following thread:
Chintan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.