Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Message not returning in BAPI

Former Member
0 Likes
1,541

Hi,

Can i use BAPIRETURN for return parameter (export) in BAPI function module?.

I am not receiving either Success or Error message.

Please see the code below.



 DATA: L_WERKS TYPE WERKS_D.
    SELECT SINGLE WERKS FROM T001W INTO L_WERKS WHERE WERKS EQ BAPI_IMPORT_MC-PLANT.
    IF SY-SUBRC <> 0.
      CLEAR MESSAGE.
      MESSAGE-MSGTY = 'E'.
      MESSAGE-MSGID = 'ZMS'.
      MESSAGE-MSGNO = '001'.
      MESSAGE-MSGV1 = BAPI_IMPORT_MC-PLANT.

      PERFORM RETURN_BAPI_MESSAGE USING MESSAGE CHANGING RETURN.
      IF 1 = 2.
        MESSAGE E001(ZMS).
      ENDIF.
      CHECK RETURN IS INITIAL.
* remaining code.
ENDIF.

FORM RETURN_BAPI_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
    IMPORTING
      BAPIRETURN = P_RETURN
    EXCEPTIONS
      OTHERS     = 1.


ENDFORM.                    " RETURN_BAPI_MESSAGE

Thanks,

Sri

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,076

> FORM RETURN_BAPI_MESSAGE USING VALUE(P_MESSAGE) LIKE MESSAGE

> CHANGING P_RETURN LIKE BAPIRETURN.

>

> CHECK NOT MESSAGE IS INITIAL.

Check not p_message is initial or CHECK NOT MESSAGE IS INITIAL ?

--

Reddy

5 REPLIES 5
Read only

Former Member
0 Likes
1,077

> FORM RETURN_BAPI_MESSAGE USING VALUE(P_MESSAGE) LIKE MESSAGE

> CHANGING P_RETURN LIKE BAPIRETURN.

>

> CHECK NOT MESSAGE IS INITIAL.

Check not p_message is initial or CHECK NOT MESSAGE IS INITIAL ?

--

Reddy

Read only

0 Likes
1,076

It is

CHECK NOT P_MESSAGE IS INITIAL.

Any idea?.

Read only

0 Likes
1,076

debug the prog whether the FM: BALW_BAPIRETURN_GET is exicuted or not?

--

Reddy

Read only

0 Likes
1,076

Yes,It is executing.but not returning.

Read only

Former Member
0 Likes
1,076

Earlier Message class created with three characters,now i had created it again with only two characters.Now it is solved.