‎2007 Dec 18 11:01 AM
Hi,
I have created a BAPI using SWO1 and also i have released that funtional module..
Now can u tell me how to use this BAPI,,
Should we call this using a ABAP program or can we use this object from other systems i mean java or ....
Or else can we use this object from other SAP systems...???????
‎2007 Dec 18 11:08 AM
Hi,
yes u can use the bapi in ur program and also it can be called by other systems also..Bapi's are meant for that purpose only
Check this report.This report uses the service BAPI BapiService.MessageGetDetail(), to display the short text and the long text of error messages.
\*----
*
\* read a message short and long text using the BAPI *
BAPI_MESSAGE_GETDETAIL of the object BapiService. *
\*----
*
\* Data declaration
DATA : MY_ID LIKE BAPIRET2-ID,
MY_NUMBER LIKE BAPIRET2-NUMBER,
MY_TEXTFORMAT LIKE BAPITGA-TEXTFORMAT,
MY_MESSAGE_V1 LIKE BAPIRET2-MESSAGE_V1,
MY_MESSAGE LIKE BAPIRET2-MESSAGE,
MY_RETURN TYPE BAPIRET2.
DATA BEGIN OF MY_TEXT OCCURS 1.
INCLUDE STRUCTURE BAPITGB.
DATA END OF MY_TEXT.
\* Enter values in object
MOVE 'FI' TO MY_ID. "message id of message to read
MOVE '024' TO MY_NUMBER. "message number of message to read
MOVE 'ASC' TO MY_TEXTFORMAT. "text format, here ASCII
MOVE '0001' TO MY_MESSAGE_V1. "text to fill into message
*BAPI call
CALL FUNCTION 'BAPI_MESSAGE_GETDETAIL'
EXPORTING
ID = MY_ID
NUMBER = MY_NUMBER
\* LANGUAGE = SY-LANGU
TEXTFORMAT = MY_TEXTFORMAT
MESSAGE_V1 = MY_MESSAGE_V1
\* MESSAGE_V2 =
\* MESSAGE_V3 =
\* MESSAGE_V4 =
IMPORTING
MESSAGE = MY_MESSAGE
RETURN = MY_RETURN
TABLES
TEXT = MY_TEXT
.
\* Print results
WRITE : / 'Input' COLOR 5.
WRITE : / 'my_id...........:', MY_ID.
WRITE : / 'my_number.......:', MY_NUMBER.
WRITE : / 'my_textformat...:', MY_TEXTFORMAT.
WRITE : / 'my_message_v1...:', MY_MESSAGE_V1.
WRITE : / 'Output' COLOR 5.
WRITE : / 'my_message........:', MY_MESSAGE.
WRITE : / 'my_return.........:', MY_RETURN.
WRITE : / 'Text output' COLOR 5.
LOOP AT MY_TEXT.
WRITE : / MY_TEXT.
ENDLOOP.
check the below link
http://www.sapdev.co.uk/java/jco/bapi_jco.pdf
http://help.sap.com/saphelp_46c/helpdata/en/13/931d0ac87411d1ad0b080009b0fb56/content.htm
Regards
Pavan
‎2007 Dec 18 11:08 AM
Hi,
yes u can use the bapi in ur program and also it can be called by other systems also..Bapi's are meant for that purpose only
Check this report.This report uses the service BAPI BapiService.MessageGetDetail(), to display the short text and the long text of error messages.
\*----
*
\* read a message short and long text using the BAPI *
BAPI_MESSAGE_GETDETAIL of the object BapiService. *
\*----
*
\* Data declaration
DATA : MY_ID LIKE BAPIRET2-ID,
MY_NUMBER LIKE BAPIRET2-NUMBER,
MY_TEXTFORMAT LIKE BAPITGA-TEXTFORMAT,
MY_MESSAGE_V1 LIKE BAPIRET2-MESSAGE_V1,
MY_MESSAGE LIKE BAPIRET2-MESSAGE,
MY_RETURN TYPE BAPIRET2.
DATA BEGIN OF MY_TEXT OCCURS 1.
INCLUDE STRUCTURE BAPITGB.
DATA END OF MY_TEXT.
\* Enter values in object
MOVE 'FI' TO MY_ID. "message id of message to read
MOVE '024' TO MY_NUMBER. "message number of message to read
MOVE 'ASC' TO MY_TEXTFORMAT. "text format, here ASCII
MOVE '0001' TO MY_MESSAGE_V1. "text to fill into message
*BAPI call
CALL FUNCTION 'BAPI_MESSAGE_GETDETAIL'
EXPORTING
ID = MY_ID
NUMBER = MY_NUMBER
\* LANGUAGE = SY-LANGU
TEXTFORMAT = MY_TEXTFORMAT
MESSAGE_V1 = MY_MESSAGE_V1
\* MESSAGE_V2 =
\* MESSAGE_V3 =
\* MESSAGE_V4 =
IMPORTING
MESSAGE = MY_MESSAGE
RETURN = MY_RETURN
TABLES
TEXT = MY_TEXT
.
\* Print results
WRITE : / 'Input' COLOR 5.
WRITE : / 'my_id...........:', MY_ID.
WRITE : / 'my_number.......:', MY_NUMBER.
WRITE : / 'my_textformat...:', MY_TEXTFORMAT.
WRITE : / 'my_message_v1...:', MY_MESSAGE_V1.
WRITE : / 'Output' COLOR 5.
WRITE : / 'my_message........:', MY_MESSAGE.
WRITE : / 'my_return.........:', MY_RETURN.
WRITE : / 'Text output' COLOR 5.
LOOP AT MY_TEXT.
WRITE : / MY_TEXT.
ENDLOOP.
check the below link
http://www.sapdev.co.uk/java/jco/bapi_jco.pdf
http://help.sap.com/saphelp_46c/helpdata/en/13/931d0ac87411d1ad0b080009b0fb56/content.htm
Regards
Pavan