‎2006 Jul 10 9:52 AM
hi friends,
i created a custom BAPI. in that business unit is import parameter. i declared return as BAPIRET2.
but i want to display error message when business unit is entered incorretly. how validate. how post error into bapireturn.
pls help.
chandu
‎2006 Jul 10 9:57 AM
Hello,
Inside the BAPI, If the check for the Businees unit with its check table. If it is a invalid value then append the message table.
try with this code:
*/ Get the type of Material In Target System
SELECT SINGLE MTART FROM MARA INTO LV_MTART
WHERE MATNR = HEADDATA-MATERIAL.
IF LV_MTART = 'FERT' OR
LV_MTART = 'HAWA'.
**/ Extend the Material with the identified material type to the target
**/ org. structure as specified in Platform Picker.
LOOP AT GT_TAR_ORG.
GT_TAR_ORG-MTART = LV_MTART.
MODIFY GT_TAR_ORG.
ENDLOOP.
ELSE.
*/ Error Message if the material type is other than FERT or HAWA
*/ Material Exist &- But not of type HAWA or FERT
MESSAGE E023(/RB04/OES_YL3) WITH HEADDATA-MATERIAL
INTO RETURN-MESSAGE.
RETURN-TYPE = 'E'.
RETURN-ID = '/RB04/OES_YL3'.
RETURN-NUMBER = '023'.
RETURN-MESSAGE_V1 = HEADDATA-MATERIAL.
RETURN-MESSAGE_V2 = SY-MSGV2.
RETURN-MESSAGE_V3 = SY-MSGV3.
RETURN-MESSAGE_V4 = SY-MSGV4.
APPEND RETURN TO RETURNMESSAGES.
ENDIF.
If useful reward the points.
Regards,
Vasanth
‎2006 Jul 10 9:59 AM
Hello
Add a Table interface to BAPI like BAPI_MATRETURN2.
Append this table by using my previous reply.
If useful reward points.
Regards,
Vasanth
‎2006 Jul 10 10:00 AM
hi,
populate the <b>BAPIRET2</b> WITH THE message id,message number,etc..to this FM.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
type = imp_msgty
cl = imp_msgid
number = imp_msgno
par1 = imp_msgv1
par2 = imp_msgv2
par3 = imp_msgv3
par4 = imp_msgv4
parameter = imp_parameter
row = imp_row
field = imp_field
IMPORTING
return = return.
APPEND return.regards
vijay
‎2006 Jul 10 10:01 AM
Hi,
If you are calling any other BAPI from your custom BAPI , pass return parameters of the BAPI to your custom BAPI or
or
fill the BAPI return table in error cases with proper messages like :
RETURN-TYPE = 'E'.
RETURN-ID = sy-msgid.
RETURN-NUMBER = sy-msgno.
RETURN-MESSAGE = 'error'.
RETURN-LOG_NO = '100'
RETURN-LOG_MSG_NO = '1'.
RETURN-MESSAGE_V1 = sy-msgv1.
RETURN-MESSAGE_V2 = sy-msgv2.
RETURN-MESSAGE_V3 = sy-msgv3.
RETURN-MESSAGE_V4 = sy-msgv4.
append RETURN.
Regards
Laxman