‎2004 Sep 13 4:11 PM
hi,all
BALW_BAPIRETURN_GET, BALW_BAPIRETURN_GET2,how to use them. what case and which will be used.
Plz give me some sample and description.
thanks in advance.
Kevin
Some code. i don't it is right ?
&----
*& Form SET_RETURN_MESSAGE
&----
This routine is used for setting the BAPI return message.
The routine is a standard routine for BAPIs that handles the message
structure for the BAPIRETURN structure. It has been copied from the
BAPI Company Code Getlist
----
-->P_MESSAGE text
<--P_RETURN text
----
FORM set_return_message USING value(p_message) LIKE message
CHANGING p_return LIKE bapireturn.
CHECK NOT message IS INITIAL.
CALL FUNCTION 'BALW_BAPIRETURN_GET'
EXPORTING
type = p_message-msgty
cl = p_message-msgid
number = p_message-msgno
par1 = p_message-msgv1
par2 = p_message-msgv2
par3 = p_message-msgv3
par4 = p_message-msgv4
LOG_NO = ' '
LOG_MSG_NO = ' '
IMPORTING
bapireturn = p_return
EXCEPTIONS
OTHERS = 1.
ENDFORM. " SET_RETURN_MESSAGE
&----
*& Form SET_RETURN_MESSAGETABLE
&----
----
-->P_MESSAGETABLE text
<--P_RETURN text
----
FORM set_return_messaGetable
USING
value(p_message) LIKE messagetable
CHANGING
prs_return LIKE bapiret2.
CHECK NOT message IS INITIAL.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
type = p_message-mstty
cl = p_message-mstid
number = p_message-mstno
par1 = p_message-mstv1
par2 = p_message-mstv2
par3 = p_message-mstv3
par4 = p_message-mstv4
LOG_NO = p_message-log_no
LOG_MSG_NO = p_message-log_msg_no
parameter = p_message-parameter
row = p_message-row
field = p_message-field
IMPORTING
bapiret2 = prs_return
EXCEPTIONS
OTHERS = 1.
ENDFORM. " SET_RETURN_MEGTABLE
‎2004 Sep 13 4:25 PM
Hi Kevin,
If you are writing a new function module that you have a message returned back from this new function in a format of BAPIRETURN or BAPIRET2, then you can use those function modules to format your return message. Otherwise, I don't think you will need to use it at all.
‎2004 Sep 13 4:42 PM
YES, i have define an function module, one of parameter is
TABALES messagetable like bapiret2.
another is RETURN like BAPIRETURN.
like below
*"----
""Local interface:
*" IMPORTING
*" REFERENCE(ORDER_HEADER_IN) LIKE VBAK STRUCTURE VBAK
*" REFERENCE(CALENDER_ID) LIKE SCAL-FCALID
*" EXPORTING
*" REFERENCE(RETURN) LIKE BAPIRETURN STRUCTURE BAPIRETURN
*" TABLES
*" ORDER_ITEMS_TAB STRUCTURE VBAPVB
*" MESSAGETABLE STRUCTURE BAPIRET2
*"----
but, above is return struture ,nor internal table. right?
how to add all message to MESSAGETABLE, and the last message save into RETURN
‎2004 Sep 13 5:02 PM
Kevin,
Looking at your codes, MESSAGETABLE is an internal table. You are doing it correctly. Now when you faced with any kind of messages in your function module, you can call those function modules to convert the message you have into the internal table MESSAGETABLE.
For example in your code, you call a function module that can return an exceptions
CALL FUNCTION 'ANY_FUNCTION'
EXPORTING
PARA1 = lv_para1
PARA2 = lv_para2
IMPORTING
PARA3 = lv_para3
PARA4 = lv_para4
EXCEPTIONS
ERROR1 = 1
ERROR2 = 2.
Then, you should consolidate the exceptions from this function module calls into your messagetable.
IF SY-SUBRC ne 0.
CLEAR MESSAGETABLE.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
TYPE = sy-msgty
CL = sy-msgid
NUMBER = sy-msgno
PAR1 = sy-msgv1
PAR2 = sy-msgv2
PAR3 = sy-msgv3
PAR4 = sy-msgv4
IMPORTING
RETURN = messagetable.
APPEND messagetable.
ENDIF.
You should do this for all function modules call, message statements and any kind of messages you want to return to the calling program.
‎2004 Sep 13 5:13 PM
Thanks for your help.
i got it.
Do you have MSN , Could you like chatting with me.
I am from SAP China.
thanks again,
Kevin,
‎2004 Sep 13 5:34 PM
I don't have MSN. I have Yahoo but not at my current customer site. You can post your question here and I will answer as much as I can.
‎2004 Sep 13 5:47 PM
thank you very much
i will sleep.
My email : xiaoyao76320@163.com
Could you send me a mail ,using mailbox you use frequently.
thanks again,
Best Regards,
Kevin,