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

Error Message Behaves Differently in exits

Former Member
0 Likes
10,510

Hi gurus,

  My client want a pop-up screen while user click on save. My t code is f-48. While pop-up appears user must ans should choose one option from pop-up(Radio buttons). If the user doesn't choose any option you need to raise a message 'please choose one option from pop-up'. I done all things my enhancement name is F180A001. But while i display message like this Message ''please choose one option from pop-up'' type 'E'. This error message gives a pop-up with 'exit' while i am clicking forcibly t code come out.  For this i give message type 'i' and use leave screen.

My code is

TYPE-POOLS : WCTP1.
DATA I_SEL TYPE WCTP1_RADIO_TYPE.

CALL FUNCTION 'WCFW_POPUP_RADIO'
   EXPORTING
    I_TITLE        = 'BUTTONS'
    I_TXT1         = 'TEXT1'
    I_TXT2         = 'TEXT2'
    I_TXT3         = 'TEXT3'
    I_TXT4         = 'TEXT4'
    I_TXT5         = 'TEXT5'
    I_TXT6         = 'TEXT6'
     I_CHOICE       = '1'
  IMPORTING
    E_CHOICE       = I_SEL
* EXCEPTIONS
*   ERROR          = 1
*   OTHERS         = 2
           .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

IF SY-UCOMM = 'CANC'.

   CLEAR : DOC_HEAD_TAB ,DOC_ITEM_TAB ,RELATION_TAB.


MESSAGE 'PLEASE CHOOSE ANY MATERIAL ON POP-UP' TYPE 'E'.
ENDIF.

below screen is the error.




1 ACCEPTED SOLUTION
Read only

GauthamV
Active Contributor
0 Likes
8,133

Try function module POPUP_DISPLAY_MESSAGE.

Regards,

Gautham.

26 REPLIES 26
Read only

GauthamV
Active Contributor
0 Likes
8,134

Try function module POPUP_DISPLAY_MESSAGE.

Regards,

Gautham.

Read only

Former Member
0 Likes
8,133

Ya works fine Gautham Thanks a lot. But can you please give me clarity why error message display like this in exits. Till now i never face this situation.

Read only

Former Member
0 Likes
8,133

Hi Srinivas,

messages behave differently depending on the context.
Details are described in the online (F1) documentation for keyword  MESSAGE under 'Behavior of Messages'.

In the current case the 'E' message has ben converted into an 'A' message.

Regards,
  Johannes

Read only

Former Member
0 Likes
8,133

Hello Srinivas,

   For this you can use,

  Message 'Please choose one option from pop-up' type 'E' display like 'I'.

Read only

8,133

No i already used but it behaves same like what i post in image..

Read only

Former Member
0 Likes
8,133

If you don't want this message in pop-up,you can treat this message as Error msg display like Succes message.

Message ' ' type 'E' display like 'S'.     

Read only

0 Likes
8,133

No not working

Suresh Rajasekar.
Read only

Former Member
0 Likes
8,133

Use TYPE 'S' and DISPLAY LIKE 'E'.

LEAVE LIST PROCESSING.

Read only

0 Likes
8,133

Read only

RaymondGiuseppi
Active Contributor
0 Likes
8,133

As Sureshont' execute a true error message, try something like


DO.

  CALL FUNCTION 'WCFW_POPUP_RADIO'

    EXPORTING

      i_title = 'BUTTONS'

      i_txt1  = 'TEXT1'

      i_txt2  = 'TEXT2'

      i_txt3  = 'TEXT3'

      i_txt4  = 'TEXT4'

      i_txt5  = 'TEXT5'

      i_txt6  = 'TEXT6'

      i_choice = '1'

    IMPORTING

      e_choice = i_sel

    EXCEPTIONS

      error   = 1

      OTHERS  = 2.

  IF i_sel EQ 'C'.

    MESSAGE 'You didn''t select any option - Same player shoot again' TYPE 'S' DISPLAY LIKE 'E'.

  ELSE.

    EXIT.

  ENDIF.

ENDDO.

Or build your own pop-up.

Regards,

Raymond

Read only

0 Likes
8,133

Hi

Raymond Giuseppi thanks for your replay,

if i write above logic the transaction continue. But in my scenario transaction must stop at save level( dont update in DB).

Read only

0 Likes
8,133

Hello

You shall find then correct exit/badi where the method/function module gives you an option to validate. If you will throw error in this exit it will stop everything with only option to exit the tcode.

Nabheet

Read only

0 Likes
8,133

Doesn't your version return a 'C' in i_sel field, in my system it does, so user is catch in a DO/ENDDO loop til he selects one value. If this is not the case add a check on suy-subrc too.

Regards,

Raymond

Read only

0 Likes
8,133

Hi Raymond Giuseppi could you please give few more brief details for your explanation.

Read only

0 Likes
8,133

Raymond, It does work as you mentioned, but interestingly the message doesn't show up giving an illusion that the click never happened. When you click the tick button it just proceeds. This behavior is only observed in exit 001 for me but in exit 002 things seem to work just fine. Can't seem to find a logical explanation for that at the moment.

Read only

0 Likes
8,133

In one case the Exit is executed in the PAI of a modal dynpro and not in the other case. So you may be required to generate a amodal/pop-up dynpro to display the error.

Read only

0 Likes
8,133

But i put a BREAK-POINT Statement in both EXIT_SAPLF048_001 , EXIT_SAPLF048_002 but only EXIT_SAPLF048_001 triggered. Thats why i done my work with EXIT_SAPLF048_001. But i didnt understand how your system triggered EXIT_SAPLF048_002 .

Read only

0 Likes
8,133

Did you try putting a break point in function module COBL_CUSTOMER_EXIT_PAI and try?

Read only

Former Member
0 Likes
8,133

Hi  nabheet madan

  I choose best Exit among the Sap provide. . Its strange for me.

Read only

0 Likes
8,133

Hello Srinivas

You shall try for FI validation where you can raise error message or search for BTE.

Thanks

Nabheet

Read only

Former Member
0 Likes
8,133

You will not be able to achieve that in the customer exit 'EXIT_SAPLF048_001' as this exit is called from a function module from which will convert any error message raised within it to an abend message which results in termination of the transaction. (F1 help on MESSAGE will not help in this case as the behavior of the error message is programmatically changed to deviate from the standard behavior, so don't go by the SAP keyword help documentation in this case).

Instead you can use the below code in the exit 'EXIT_SAPLF048_002' to achieve the functionality you want. (BU is the function code for Post). Assuming that you don't have to pass anything back in the other exit.



IF sy-ucomm EQ 'BU'

  DO.

    CALL FUNCTION 'WCFW_POPUP_RADIO'

      EXPORTING

        i_title = 'BUTTONS'

        i_txt1  = 'TEXT1'

        i_txt2  = 'TEXT2'

        i_txt3  = 'TEXT3'

        i_txt4  = 'TEXT4'

        i_txt5  = 'TEXT5'

        i_txt6  = 'TEXT6'

        i_choice = '1'

      IMPORTING

        e_choice = i_sel

      EXCEPTIONS

        error   = 1

        OTHERS  = 2.

    IF i_sel EQ 'C'.

      MESSAGE 'You didn''t select any option - Same player shoot again' TYPE 'S' DISPLAY LIKE 'E'.

    ELSE.

      EXIT.

    ENDIF.

  ENDDO.

ENDIF.

Read only

0 Likes
8,133

hi EXIT_SAPLF048_002 is not triggered. Thats why i choose EXIT_SAPLF048_001.

Read only

0 Likes
8,133

Hi Srinivas,

can Try Following as suggested by coder X


But in place of 'S' Use 'I' it will give a pop up message and if u press on ok button your process will continue .



    IF i_sel EQ 'C'.

      MESSAGE 'You didn''t select any option - Same player shoot again' TYPE 'I' DISPLAY LIKE 'E'.

    ELSE.

Best Regards.

Read only

0 Likes
8,133

I checked in the system and EXIT_SAPLF048_002 gets called before EXIT_SAPLF048_001. You can set a break point in the function module COBL_CUSTOMER_EXIT_PAI and check if the control stops there. If it does, just debug a little further and you will notice 002 being called.

See attached screenshot

Read only

0 Likes
8,133

Hi Coder X,

Sorry for late replay. Ya i observe 002 is called in COBL_CUSTOMER_EXIT_PAI but the problem is flg_ci_exists = 'Y' in COBL_CUSTOMER_EXIT_PAI here i am unable to check 002 fm. See attachment.



Read only

0 Likes
8,133

Definitely not the best solution, but the exit will be called if you just add a dummy field to the customer include CI_COBL found in the structure BAPICOBL_CI. (May be you can just add ZZDUMMY of type CHAR01). You can use this as a last option if you really don't have any other Exit or BADI.

Alternatively, consider using an implicit enhancement in the subroutine where they handle the user commands or perform before save checks. This is definitely a better solution than the above. (Hint: Include:MF05AI10_PAI_ANFANG, Form:PAI_PAI_ANFANG)