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

Regarding Module Pool's Cancel button

Former Member
0 Likes
2,496

Hi Guys,

Please help me I have created on Module Pool and now this module pool is called through a a UserExit .

now the thing is if i cancel button which is placed on my popup screen then it is still going into the output which is wrong it should show up the previous screen.

My code for the Sy-ucomm = cancel is


IF SY-UCOMM = 'CANC'.
    SET SCREEN 0.
    LEAVE SCREEN.
  ENDIF.
Can you please provide me some code by which i can go to the previous screen.

22 REPLIES 22
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
2,099

How is this module pool being called? And when the user clicks cancel, you want to go back to the original caller, right? You can try LEAVE PROGRAM.

Reagrds,

Rich Heilman

Read only

0 Likes
2,099

Thanks Rich,

But the thing is I donot want to leave the program I was to stick to the main screen once the user clicks the <b>CANC</b> buttons.

Leave program exit from the program.

Read only

0 Likes
2,099

What main screen? The main screen of your custom module pool? I'm confused.

Regards,

Rich Heilman

Read only

0 Likes
2,099

Nops actually My Main screen is TCode: IW52. and from there i am callling my Module Pool Program through userexit.

So when the user clicks on the cancel button of my module pool it should come to the main screen (TCode: IW52).

Read only

0 Likes
2,099

How are you calling the module pool program in the user exit? And please post the code of the module pool program.

Regards,

Rich Heilman

Read only

0 Likes
2,099

Have you chcked my earlier post? Is 'CANC' defined as an exit command? This will keep it from going through the PBO.

Rob

Read only

0 Likes
2,099

I am calling the Module pool through User exit and inside user exit i am calling FM which calls my screen.

Userexit -> FM -> ModulePool

here is the code :



*----------------------------------------------------------------------*
***INCLUDE LZRMA_NOTIFO01 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&      Module  STATUS_0150  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE STATUS_0150 OUTPUT.

*  SET PF-STATUS SY-DYNNR.
*
*  SET TITLEBAR SY-DYNNR.

ENDMODULE.                 " STATUS_0150  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  CUA_STATUS  OUTPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE CUA_STATUS OUTPUT.

*  SET PF-STATUS SY-DYNNR.
*
*  SET TITLEBAR SY-DYNNR.

ENDMODULE.                 " CUA_STATUS  OUTPUT
*&---------------------------------------------------------------------*
*&      Module  EXIT_SCREEN  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE EXIT_SCREEN INPUT.
  DATA:      C_FCODE_ABBR   LIKE SY-PFKEY  VALUE 'ABBR' .
break-point.
  CASE OK-CODE.
    WHEN C_FCODE_ABBR.
*-- Abbrechen
*   Daten zurücknehmen
      CLEAR RQM01.
*      RAISE CANCEL.
      set screen 0.
      LEAVE TO SCREEN 0.
        call transaction 'QM01'.
  ENDCASE.
 IF SY-UCOMM = 'CANC'. "  Here is the SY-UCOMM Where i have to handle the CANC BUTTON
*    SET SCREEN 0.
*    LEAVE SCREEN.
   LEAVE PROGRAM.
  ENDIF.

ENDMODULE.                 " EXIT_SCREEN  INPUT
*&---------------------------------------------------------------------*
*&      Module  CHECK_NOTIF_NO  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE CHECK_NOTIF_NO INPUT.
*----------------------------------------------------------------------------*
*& Below condition checks if the user enter a Notification Num and Porduction
*  Order Then Message comees Please enter a Prod Order or RMA Notif Num only
*  Process cannot accept both.
*&---------------------------------------------------------------------------*
  IF NOT VIQMEL-QMNUM IS INITIAL.
    IF NOT RQM01-FERTAUFNR IS INITIAL.
      MESSAGE E904(QM).    "  Please enter a Prod order or RMA Notif Num only.
                              "  Process can't accept both
    ENDIF.
  ENDIF.
*&---------------------------------------------------------------------------*
*& If Production order is entered, then check if the Order type is 'AES1' or *
*&  'AES3'AES2,AES4, AES5, AES6,ICSO, PM01, PM02, RMA, SM01, SM02, ZEXR,
*&   Message flashes ' Please enter only enter RMA Notif Number.       *
*&---------------------------------------------------------------------------*
  data: v_dauat like afpo-dauat.
  SELECT SINGLE DAUAT INTO V_DAUAT FROM AFPO WHERE AUFNR = RQM01-FERTAUFNR.
  if sy-subrc = 0.
    IF V_DAUAT = 'AES1' OR V_DAUAT = 'AES3' OR
       V_DAUAT = 'AES2' OR V_DAUAT = 'AES4' OR
       V_DAUAT = 'ICSO' OR V_DAUAT = 'PM01' OR
       V_DAUAT = 'PM01' OR V_DAUAT = 'RMA' OR
       V_DAUAT = 'SM01' OR V_DAUAT = 'SM02' OR V_DAUAT = 'ZEXR'..
      MESSAGE E905(QM).    " Please Only enter a RMA Notif Number.
    ENDIF.
  endif.

ENDMODULE.                 " CHECK_NOTIF_NO  INPUT
*&---------------------------------------------------------------------*
*&      Module  FEAUF_SAAUF_CHECK  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE FEAUF_SAAUF_CHECK INPUT.
  OK-CODE = SY-UCOMM.
*Added by CChauhan
  IF VIQMEL-QMNUM IS INITIAL.
*& End of Addition by CChauhan
    IF  NOT RQM01-FERTAUFNR IS INITIAL
    AND ( NOT RQM01-VERID IS INITIAL
         OR NOT RQM01-RM_WERKS IS INITIAL
         OR NOT RQM01-RM_MATNR IS INITIAL ).
*   only production order or manufacturing version meaningfully
      MESSAGE E902(QM).
    ENDIF.
*Added by CChauhan
  ENDIF.
*& End of Addition by CChauhan
ENDMODULE.                 " FEAUF_SAAUF_CHECK  INPUT
*&---------------------------------------------------------------------*
*&      Module  FEAUF_FEPOS_CHECK  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE FEAUF_FEPOS_CHECK INPUT.
  IF VIQMEL-QMNUM = ''.
    IF      RQM01-FERTAUFNR = ''
    AND RQM01-FERTVORNR <> ''.
      MESSAGE E903(QM).
    ENDIF.
  ENDIF.
  IF SY-UCOMM = 'CANC'.
    LEAVE SCREEN.
  ENDIF.

ENDMODULE.                 " FEAUF_FEPOS_CHECK  INPUT
*&---------------------------------------------------------------------*
*&      Module  FAUF_LESEN  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE FAUF_LESEN INPUT.
*& Added by CChauhan  Date: 01/23/2007
*& Execute further if RMa_Notif(VIQMEL-QMNUM)ield is blank.
 IF VIQMEL-QMNUM IS INITIAL.
*&End by CChauhan     Date: 01/23/2007
    PERFORM FAUF_LESEN USING RQM01-FERTAUFNR
                             RQM01-FERTVORNR
                    CHANGING CAUFV
                             AFVC.
*   Belegdaten an Qualitätsmeldung übergeben
    PERFORM FAUF_TO_QMEL USING CAUFV
                               AFVC
                      CHANGING RQM01.
*& Added by CChauhan  Date: 01/23/2007
ENDIF.
*&End by CChauhan     Date: 01/23/2007
ENDMODULE.                 " FAUF_LESEN  INPUT
*&---------------------------------------------------------------------*
*&      Form  FAUF_LESEN
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_RQM01_FERTAUFNR  text
*      -->P_RQM01_FERTVORNR  text
*      <--P_CAUFV  text
*      <--P_AFVC  text
*----------------------------------------------------------------------*
FORM FAUF_LESEN USING VALUE(P_AUFNR) LIKE RQM01-FERTAUFNR
                      VALUE(P_VORNR) LIKE RQM01-FERTVORNR
             CHANGING VALUE(P_CAUFV) LIKE CAUFV
                      VALUE(P_AFVC)  LIKE AFVC .

  CALL FUNCTION 'QMHL_HELP_FAUF'
    EXPORTING
      I_AUFNR             = P_AUFNR
      I_VORNR             = P_VORNR
      I_FOLGE             = G_FOLGE
    IMPORTING
      E_CAUFV             = P_CAUFV
      E_AFVC              = P_AFVC
    EXCEPTIONS
      ORDER_NOT_FOUND     = 1
      OPERATION_NOT_FOUND = 2
      OTHERS              = 3.

  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.

ENDFORM.                    " FAUF_LESEN
*&---------------------------------------------------------------------*
*&      Form  FAUF_TO_QMEL
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_CAUFV  text
*      -->P_AFVC  text
*      <--P_RQM01  text
*----------------------------------------------------------------------*
FORM FAUF_TO_QMEL USING VALUE(P_CAUFV) LIKE CAUFV
                        VALUE(P_AFVC)  LIKE AFVC
               CHANGING       P_RQM01  LIKE RQM01.

* zunächst Berechtigung für Meldungsart/Werk prüfen
  PERFORM CHECK_QAUT_QMEL USING SY-TCODE
                                TQ80-QMART
                                P_CAUFV-WERKS.
* Materialnummer des Fertigprodukts ermitteln
  SELECT * FROM AFPO
  WHERE AUFNR = P_CAUFV-AUFNR.
* Materialnummer steht in der ersten Auftragsposition
    EXIT.
  ENDSELECT.
  IF SY-SUBRC IS INITIAL.
*   Materialnummer übernehmen
    P_RQM01-MATNR  = AFPO-MATNR.
    IF NOT AFPO-MATNR IS INITIAL.
      PERFORM MATERIAL_CHECK USING AFPO-MATNR.
    ENDIF.

*   Charge
    P_RQM01-CHARG     =  AFPO-CHARG.
*--- Lieferantencharge bestimmen
    IF NOT P_RQM01-CHARG IS INITIAL.
      SELECT SINGLE * INTO MCHA FROM MCHA
              WHERE MATNR =  P_RQM01-MATNR
              AND   WERKS =  P_RQM01-MAWERK
              AND   CHARG =  P_RQM01-CHARG.
      IF SY-SUBRC EQ 0.
        MOVE MCHA-LICHA TO P_RQM01-LICHN.
      ENDIF.
    ENDIF.


    P_RQM01-LGORTCHAR =  AFPO-LGORT.
  ENDIF.

  P_RQM01-MAWERK    =  P_CAUFV-WERKS.
  IF NOT AFPO-MATNR IS INITIAL
    AND  NOT P_CAUFV-WERKS IS INITIAL.
    PERFORM MATERIAL_WERK_CHECK USING AFPO-MATNR
                                      P_CAUFV-WERKS.
  ENDIF.

* Revisionsstand
  P_RQM01-REVLV     =   P_CAUFV-REVLV.

* reklamierte Menge
  P_RQM01-RKMNG     =   P_CAUFV-GAMNG - P_CAUFV-GASMG.
  P_RQM01-BZMNG     =   P_CAUFV-GAMNG - P_CAUFV-GASMG.
  P_RQM01-MGEIN     =   P_CAUFV-GMEIN.

* Arbeitsplatz
  P_RQM01-ARBPL = P_AFVC-ARBID.

* eindeutiger Schluessel fuer Vorgang
  P_RQM01-FERTAUFPL = P_AFVC-AUFPL.
  P_RQM01-PNLKN     = P_AFVC-APLZL.

* Info über automatische Datenübernahme
  MESSAGE S026(QM) WITH P_CAUFV-AUFNR RQM01-FERTVORNR.

ENDFORM.                    " FAUF_TO_QMEL
*&---------------------------------------------------------------------*
*&      Form  CHECK_QAUT_QMEL
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_SY_TCODE  text
*      -->P_TQ80_QMART  text
*      -->P_P_CAUFV_WERKS  text
*----------------------------------------------------------------------*
FORM CHECK_QAUT_QMEL USING VALUE(P_TCODE)
                           VALUE(P_QMART)
                           VALUE(P_WERK).

  CHECK NOT P_WERK IS INITIAL.

  MOVE-CORRESPONDING RQM01 TO H_VIQMEL.
  CALL FUNCTION 'QAUT_QMEL'
    EXPORTING
      I_WERKS  = P_WERK
      I_QMART  = P_QMART
      I_TCODE  = P_TCODE
      I_VIQMEL = H_VIQMEL.

ENDFORM.                    " CHECK_QAUT_QMEL
*&---------------------------------------------------------------------*
*&      Form  MATERIAL_CHECK
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_AFPO_MATNR  text
*----------------------------------------------------------------------*
FORM MATERIAL_CHECK USING  VALUE(P_MATNR).

*-- lokale Daten
  DATA : BEGIN OF L_DUMMY_TAB OCCURS 0,
           DUMMY(1),
         END   OF L_DUMMY_TAB.

* Prüfung nur, falls Materialnummer und Werk gefüllt
  CHECK NOT P_MATNR IS INITIAL.

* Verprobung auf MARA-Segment
  MOVE C_MARA_SEGMENT TO MTCOM-KENNG.
  MOVE P_MATNR        TO MTCOM-MATNR.
  TABLES: MTCOR.
  CALL FUNCTION 'MATERIAL_READ'
    EXPORTING
      SCHLUESSEL           = MTCOM
    IMPORTING
      MATDATEN             = MARA
      RETURN               = MTCOR
    TABLES
      SEQMAT01             = L_DUMMY_TAB
    EXCEPTIONS
      ACCOUNT_NOT_FOUND    = 01
      BATCH_NOT_FOUND      = 02
      FORECAST_NOT_FOUND   = 03
      LOCK_ON_ACCOUNT      = 04
      LOCK_ON_MATERIAL     = 05
      LOCK_ON_PLANT        = 06
      LOCK_ON_SALES        = 07
      LOCK_ON_SLOC         = 08
      LOCK_SYSTEM_ERROR    = 09
      MATERIAL_NOT_FOUND   = 10
      PLANT_NOT_FOUND      = 11
      SALES_NOT_FOUND      = 12
      SLOC_NOT_FOUND       = 13
      SLOCNUMBER_NOT_FOUND = 14
      SLOCTYPE_NOT_FOUND   = 15
      TEXT_NOT_FOUND       = 16
      UNIT_NOT_FOUND       = 17.

  CASE SY-SUBRC.
    WHEN C_RC00.
*       alles o.k.
      RQM01-MATKL = MARA-MATKL.
      RQM01-PRDHA = MARA-PRDHA.
    WHEN C_RC10.
      MESSAGE E005(QM) WITH P_MATNR.
  ENDCASE.
* Beim Material sitzt Loeschvormerkung.
  IF NOT MTCOR-LVORM IS INITIAL.
    MESSAGE W008(M3).
  ENDIF.

ENDFORM.                    " MATERIAL_CHECK
*&---------------------------------------------------------------------*
*&      Form  MATERIAL_WERK_CHECK
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_AFPO_MATNR  text
*      -->P_P_CAUFV_WERKS  text
*----------------------------------------------------------------------*
FORM MATERIAL_WERK_CHECK USING VALUE(P_MATNR)
                               VALUE(P_WERK).
*-- local data
  DATA : BEGIN OF L_DUMMY_TAB OCCURS 0,
           DUMMY(1),
         END   OF L_DUMMY_TAB.

* Examination only, if materials number and work filled
  CHECK (    NOT P_MATNR IS INITIAL
         AND NOT P_WERK  IS INITIAL ).

* Checking on MARC segment
  MOVE C_MARC_SEGMENT TO MTCOM-KENNG.
  MOVE P_MATNR        TO MTCOM-MATNR.
  MOVE P_WERK         TO MTCOM-WERKS.

  CALL FUNCTION 'MATERIAL_READ'
    EXPORTING
      SCHLUESSEL           = MTCOM
    IMPORTING
      MATDATEN             = MARC
    TABLES
      SEQMAT01             = L_DUMMY_TAB
    EXCEPTIONS
      ACCOUNT_NOT_FOUND    = 01
      BATCH_NOT_FOUND      = 02
      FORECAST_NOT_FOUND   = 03
      LOCK_ON_ACCOUNT      = 04
      LOCK_ON_MATERIAL     = 05
      LOCK_ON_PLANT        = 06
      LOCK_ON_SALES        = 07
      LOCK_ON_SLOC         = 08
      LOCK_SYSTEM_ERROR    = 09
      MATERIAL_NOT_FOUND   = 10
      PLANT_NOT_FOUND      = 11
      SALES_NOT_FOUND      = 12
      SLOC_NOT_FOUND       = 13
      SLOCNUMBER_NOT_FOUND = 14
      SLOCTYPE_NOT_FOUND   = 15
      TEXT_NOT_FOUND       = 16
      UNIT_NOT_FOUND       = 17.

  CASE SY-SUBRC.
    WHEN C_RC00.
*       alles o.k.
      RQM01-KZDKZ = MARC-KZDKZ.
      RQM01-KZKRI = MARC-KZKRI.
    WHEN C_RC11.
      MESSAGE E004(QM) WITH P_MATNR
                            P_WERK.
    WHEN C_RC10.
      MESSAGE E005(QM) WITH P_MATNR.
  ENDCASE.

ENDFORM.                    " MATERIAL_WERK_CHECK
*&---------------------------------------------------------------------*
*&      Module  FCODE  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE FCODE INPUT.
*& Inserted by CC  01/24/2007
  II_VIQMEL-FERTAUFNR = RQM01-FERTAUFNR.
*& End by CC   01/24/2007
  PERFORM FCODE USING OK-CODE.
ENDMODULE.                 " FCODE  INPUT
*&---------------------------------------------------------------------*
*&      Form  FCODE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_OK_CODE  text
*----------------------------------------------------------------------*
FORM FCODE USING VALUE(P_FCODE) LIKE SY-TCODE.

  CASE P_FCODE.

    WHEN C_FCODE_ENT1.
*-- Weiter
      SET SCREEN 0.
      LEAVE SCREEN.

  ENDCASE.
  IF SY-UCOMM = 'CANC'.
    SET SCREEN 0.
    LEAVE SCREEN.
  ENDIF.

ENDFORM.                    " FCODE

Read only

0 Likes
2,099

Hey Rob,

I have already set the CANc as an Exit Command.

Thanks but it still not working....................

Read only

0 Likes
2,099

Userexit -> FM -> ModulePool

So if your userexit is calling a FM, then the function module contains the screens?, or are they in a separate program that the function module is calling?

Regards,

Rich Heilman

Read only

0 Likes
2,099

Look my FM code below It will be helpfull to sort out the problem


FUNCTION Z_SCREEN_RMA_NOTIF.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     REFERENCE(I_VIQMEL) TYPE  VIQMEL
*"  EXPORTING
*"     REFERENCE(V_RMA_NOTIF) TYPE  VIQMEL-QMNUM
*"     REFERENCE(O_VIQMEL) TYPE  VIQMEL
*"----------------------------------------------------------------------
*&Created by CChauhan   01/20/2007    DV2K954728
*& Call the Screen 150 (for Service order completion)
II_VIQMEL = I_VIQMEL.
  CALL SCREEN 9000   STARTING AT 10 7
                     ENDING   AT 50 15.

V_RMA_NOTIF = VIQMEL-QMNUM.
O_VIQMEL = II_VIQMEL.    " Exporting the updated strucure to the userexit 'ZXQQMU01'
ENDFUNCTION.

Read only

0 Likes
2,099

Ahh... yes, now we are getting somewhere, now let me see the screen flow for screen 9000 as well as the module code for each PBO and PAI.

Regards,

Rich Heilman

Read only

0 Likes
2,099

Did you try 'Leave to Screen 0'? It works for me in PO user exit.

Read only

0 Likes
2,099

Hey Kris,

Its not working.............. I have already used.

Read only

0 Likes
2,099

Here is the Screen Flow for 9000.


*&---------------------------------------------------------------------*
*& Created by  CChauhan   Date: 01/23/2007                             *
*&---------------------------------------------------------------------*
*&Screen to create a replica of the standard sreen for the Notification*
* Number with addition of one field which is RMA Notificaiton number.  *
*&---------------------------------------------------------------------*

PROCESS BEFORE OUTPUT.
*& SET THE PF STATUS.
 MODULE STATUS_0150.
* MODULE FELDAUSWAHL.
*-- CUA-Status und Titel
 MODULE CUA_STATUS.

*-- Feldauswahl
 MODULE FELDAUSWAHL.

PROCESS AFTER INPUT.
* MODULE USER_COMMAND_0150.

*-- Window leave
  MODULE EXIT_SCREEN AT EXIT-COMMAND.

*&condition for checking of the RMA Notif with Service/Prodcution No.
CHAIN.
  FIELD RQM01-FERTAUFNR.
  FIELD RQM01-FERTVORNR.
  FIELD VIQMEL-QMNUM.
  FIELD RQM01-VERID.
  FIELD RQM01-RM_WERKS.
  FIELD RQM01-RM_MATNR.
  MODULE CHECK_NOTIF_NO ON CHAIN-REQUEST.
ENDCHAIN.

MODULE USER_COMMAND_0150.
  CHAIN.
    FIELD RQM01-FERTAUFNR.
    FIELD RQM01-RM_MATNR.
    FIELD RQM01-RM_WERKS.
     MODULE FEAUF_SAAUF_CHECK ON CHAIN-REQUEST.
 ENDCHAIN.
*-- Order item only together with order number meaningfully
CHAIN.
  FIELD RQM01-FERTAUFNR.
  FIELD RQM01-FERTVORNR.
  FIELD VIQMEL-QMNUM.
  MODULE FEAUF_FEPOS_CHECK ON CHAIN-REQUEST.
ENDCHAIN.

*-- Production order read
CHAIN.
  FIELD RQM01-FERTAUFNR.
  FIELD RQM01-FERTVORNR.
  FIELD VIQMEL-QMNUM.
  MODULE FAUF_LESEN ON CHAIN-REQUEST.
ENDCHAIN.

*-- Function code processing
FIELD OK-CODE MODULE FCODE.



Read only

0 Likes
2,099

I have implemented something very similar to this in another exit where a function module calles a modal dialog box. Here is the PAI of that screen in my function module. Works great, the dialog appears in from of the main screen and when you click cancel, the dialog box goes away and the main screen remains.



MODULE USER_COMMAND_0100 INPUT.

  SAVE_OK = OK_CODE.
  CASE OK_CODE.
    WHEN 'CANCEL'.
      SET SCREEN 0.
      LEAVE SCREEN .
    WHEN 'SAVE'.
      PERFORM UPDATE_ZBRBIN.
      SET SCREEN 0.
      LEAVE SCREEN .
  ENDCASE.


ENDMODULE.                 " USER_COMMAND_0100  INPUT

Regards,

RIch Heilman

Read only

0 Likes
2,099

Make this one change and try again.




*&---------------------------------------------------------------------*
*&      Module  EXIT_SCREEN  INPUT
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
MODULE EXIT_SCREEN INPUT.
  DATA:      C_FCODE_ABBR   LIKE SY-PFKEY  VALUE 'ABBR' .
break-point.
  CASE OK-CODE.
    WHEN C_FCODE_ABBR.
*-- Abbrechen
*   Daten zurücknehmen
      CLEAR RQM01.
*      RAISE CANCEL.
      set screen 0.
      LEAVE TO SCREEN 0.
        call transaction 'QM01'.

    when 'CANC'.         "<-- Insert

     SET SCREEN 0.       "<-- Insert
     LEAVE SCREEN.       "<-- Insert

  ENDCASE.

*No need for this.
* IF SY-UCOMM = 'CANC'. "  
*    SET SCREEN 0.
*    LEAVE SCREEN.
*   LEAVE PROGRAM.
*  ENDIF.
 
ENDMODULE.                 " EXIT_SCREEN  INPUT


Regards,

Rich Heilman

Read only

0 Likes
2,099

If that doesn't do the trick, you might have to make this change too.




*&---------------------------------------------------------------------*
*&      Form  FCODE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->P_OK_CODE  text
*----------------------------------------------------------------------*
FORM FCODE USING VALUE(P_FCODE) LIKE SY-TCODE.
 
  CASE P_FCODE.
 
    WHEN C_FCODE_ENT1.
*-- Weiter
      SET SCREEN 0.
      LEAVE SCREEN.

   when 'CANC'.           "<- INsert

      SET SCREEN 0.    "<- INsert
      LEAVE SCREEN.  "<- INsert
 
  ENDCASE.
* Comment out
* IF SY-UCOMM = 'CANC'.
*  SET SCREEN 0.
*    LEAVE SCREEN.
*  ENDIF.
 
ENDFORM.                    " FCODE


Regards,

Rich Heilman

Read only

0 Likes
2,099

Rich,

I hav already used this code but this is not working. Please find any other alternative.

Read only

0 Likes
2,099

Hi,

Can you uncomment the PF-STATUS lines in your code and check? They look commented in the PBO event.

Regards

Subramanian

Read only

Former Member
0 Likes
2,099

Hi ,

I think the 'CANC' may not be available in the Module pool program since your pop up is in the user exit the ok-code will be effected in the exit rather than the dialog program and hence it behaves in a different way, try to figure out what is the value of ok_code when it is there in the dialog program and accordingly modify the the ok_code to trigger the function code 'CANC'.

Srini

Read only

Former Member
0 Likes
2,099

In the GUI, make sure that 'CANC' is defined as an exit command.

Rob

Read only

Former Member
0 Likes
2,099

Try 'LEAVE TO SCREEN 0' . ("LEAVE to screen zero)