ALV Leave to screen problem

Dear Friends,
i have interactive ALV so their flow as follows
1. When i execute the program Load ALV (i named it ALV1)
2. When  double click - another ALV displayed (I named it as ALV2)
3. In the ALV2, there is a button to add data (suppose there are two records)
4. When click on Add button, Screen is appear to enter data and also there is a Save button
5. When click on the save button, data saved to Table and ALV2 refreshed (now there are three records)
6. When I click on the Back button (tools) its come to ALV2 previous position (ALV2 with two records)
my problem is, when click on the BACK button it must comes to ALV1
not to ALV2 previous position
how can i code this in the back button.
I already used LEAVE TO SCREEN 0
I hope, you will clear my doubt
Thanks in Advanced

HI,
In the PAI of second screen(where you display ALV2)
IF Sy-ucomm EQ 'SAVE'.
" If you are calling the second screen using the call screen <second screen>
" then replace this with these statements
SET SCREEN <>second_screen>.
LEAVE SCREEN
ENDIF

Similar Messages

  • Leave to screen 0 does not branch to initialization event (ALV)

    Hi All,
    I'm new at this forum thing so be gentle. I have created the standard custom control in a new screen, setup the field catalog and other parameters and when I call the screen and do the :
      IF g_custom_container IS INITIAL.
        CREATE OBJECT g_custom_container
           EXPORTING
              container_name = 'ZTMR_EVAL_GRID'.
        CREATE OBJECT g_grid
           EXPORTING
             i_parent = g_custom_container.
        CLEAR wa_disvariant.
        wa_disvariant-report = sy-repid.
        CALL METHOD g_grid->set_table_for_first_display
          EXPORTING
            is_variant      = wa_disvariant
            i_save          = 'A'
            is_layout       = wa_layout
          CHANGING
            it_outtab       = detail_tab[]
            it_fieldcatalog = itab_fldcat
            it_sort         = itab_sort.
        CREATE OBJECT event_receiver.
        SET HANDLER event_receiver->handle_top_of_page FOR g_grid.
      ENDIF.
    , everything works great. The problem occurs when hit the BACK button in my PAI module, it returns to the line after the CALL SCREEN XXX, ENDFORM, PERFORM output_alv_grid_report and then branches to :
    FUNCTION hrpy_process_fire_event in the source code of LHRST1U01 in the main program SAPLHRST1.
    It does this instead of branching to the INITIALIZATION event (selection-screen) which is what it's supposed to do?
    Any help would be greatly appreciated - Thanks in advance,
    Jim

    hi,
    REPORT  ZTEST1234_ALV_TOP    MESSAGE-ID ZZ                           .
    DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
    DATA: L_VALID TYPE C,
          V_FLAG,
          V_DATA_CHANGE,
          V_ROW TYPE LVC_S_ROW,
          V_COLUMN TYPE LVC_S_COL,
          V_ROW_NUM TYPE LVC_S_ROID.
    "The Below Definitions Must.....
    DATA:
    * Reference to document
           DG_DYNDOC_ID       TYPE REF TO CL_DD_DOCUMENT,
    * Reference to split container
           DG_SPLITTER          TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
    * Reference to grid container
           DG_PARENT_GRID     TYPE REF TO CL_GUI_CONTAINER,
    * Reference to html container
           DG_HTML_CNTRL        TYPE REF TO CL_GUI_HTML_VIEWER,
    * Reference to html container
           DG_PARENT_HTML     TYPE REF TO CL_GUI_CONTAINER.
    "up to here
    *       CLASS lcl_event_handler DEFINITION
    CLASS LCL_EVENT_HANDLER DEFINITION .
      PUBLIC SECTION .
        METHODS:
    **Hot spot Handler
        HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
                          IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
    **Double Click Handler
        HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                                         IMPORTING E_ROW E_COLUMN ES_ROW_NO,
        TOP_OF_PAGE FOR EVENT TOP_OF_PAGE              "event handler
                             OF CL_GUI_ALV_GRID
                             IMPORTING E_DYNDOC_ID.
    ENDCLASS.                    "lcl_event_handler DEFINITION
    *       CLASS lcl_event_handler IMPLEMENTATION
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
    *Handle Hotspot Click
      METHOD HANDLE_HOTSPOT_CLICK .
        CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
        V_ROW  = E_ROW_ID.
        V_COLUMN = E_COLUMN_ID.
        V_ROW_NUM = ES_ROW_NO.
        MESSAGE I000 WITH V_ROW 'clicked'.
      ENDMETHOD.                    "lcl_event_handler
    *Handle Double Click
      METHOD  HANDLE_DOUBLE_CLICK.
      ENDMETHOD.                    "handle_double_click
      METHOD TOP_OF_PAGE.                   "implementation
    * Top-of-page event
        PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
      ENDMETHOD.                            "top_of_page
    ENDCLASS.                    "LCL_EVENT_HANDLER IMPLEMENTATION
    *&             Global Definitions
    DATA:      G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
                G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler
    DATA: OK_CODE LIKE SY-UCOMM,
          SAVE_OK LIKE SY-UCOMM,
          G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST',
          GS_LAYOUT TYPE LVC_S_LAYO.
    *- Fieldcatalog for First and second Report
    DATA: IT_FIELDCAT  TYPE  LVC_T_FCAT,
          X_FIELDCAT TYPE LVC_S_FCAT,
          LS_VARI  TYPE DISVARIANT.
    *                START-OF_SELECTION
    START-OF-SELECTION.
      DATA:BEGIN OF  ITAB OCCURS 0,
           VBELN LIKE LIKP-VBELN,
           POSNR LIKE LIPS-POSNR,
           CELLCOLOR TYPE LVC_T_SCOL, "required for color
           DROP(10),
           END OF ITAB.
      SELECT VBELN
             POSNR
             FROM LIPS
             UP TO 20 ROWS
             INTO CORRESPONDING FIELDS OF TABLE ITAB.
    END-OF-SELECTION.
      IF NOT ITAB[] IS INITIAL.
        <b>CALL SCREEN 100.</b>
      ELSE.
        MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
      ENDIF.
    *&      Form  CREATE_AND_INIT_ALV
    *       text
    FORM CREATE_AND_INIT_ALV .
      DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
      "attention.....from here
      "split your container here...into two parts
      "create the container
      CREATE OBJECT G_CUSTOM_CONTAINER
               EXPORTING CONTAINER_NAME = G_CONTAINER1.
      "this is for top of page
    * Create TOP-Document
      CREATE OBJECT DG_DYNDOC_ID
                       EXPORTING STYLE = 'ALV_GRID'.
    * Create Splitter for custom_container
      CREATE OBJECT DG_SPLITTER
                 EXPORTING PARENT  = G_CUSTOM_CONTAINER
                           ROWS    = 2
                           COLUMNS = 1.
    * Split the custom_container to two containers and move the reference
    * to receiving containers g_parent_html and g_parent_grid
      "i am allocating the space for grid and top of page
      CALL METHOD DG_SPLITTER->GET_CONTAINER
        EXPORTING
          ROW       = 1
          COLUMN    = 1
        RECEIVING
          CONTAINER = DG_PARENT_HTML.
      CALL METHOD DG_SPLITTER->GET_CONTAINER
        EXPORTING
          ROW       = 2
          COLUMN    = 1
        RECEIVING
          CONTAINER = DG_PARENT_GRID.
      "you can set the height of it
    * Set height for g_parent_html
      CALL METHOD DG_SPLITTER->SET_ROW_HEIGHT
        EXPORTING
          ID     = 1
          HEIGHT = 5.
      "from here as usual..you need to specify parent as splitter part
      "which we alloted for grid
      CREATE OBJECT G_GRID
             EXPORTING I_PARENT = DG_PARENT_GRID.
    * Set a titlebar for the grid control
      CLEAR GS_LAYOUT.
      GS_LAYOUT-GRID_TITLE = TEXT-003.
      GS_LAYOUT-ZEBRA = SPACE.
      GS_LAYOUT-CWIDTH_OPT = 'X'.
      GS_LAYOUT-NO_ROWMARK = 'X'.
      GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
      CALL METHOD G_GRID->REGISTER_EDIT_EVENT
        EXPORTING
          I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
      CREATE OBJECT G_HANDLER.
      SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
      SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
      SET HANDLER G_HANDLER->TOP_OF_PAGE FOR G_GRID.
      DATA: LS_CELLCOLOR TYPE LVC_S_SCOL. "required for color
      DATA: L_INDEX TYPE SY-TABIX.
      "Here i am changing the color of line 1,5,10...
      "so you can change the color of font conditionally
      LOOP AT ITAB.
        L_INDEX = SY-TABIX.
        IF L_INDEX = 1 OR L_INDEX = 5 OR L_INDEX = 10.
          LS_CELLCOLOR-FNAME = 'VBELN'.
          LS_CELLCOLOR-COLOR-COL = '6'.
          LS_CELLCOLOR-COLOR-INT = '0'.
          LS_CELLCOLOR-COLOR-INV = '1'.
          APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
          MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
          LS_CELLCOLOR-FNAME = 'POSNR'.
          LS_CELLCOLOR-COLOR-COL = '6'.
          LS_CELLCOLOR-COLOR-INT = '0'.
          LS_CELLCOLOR-COLOR-INV = '1'.
          APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
          MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
        ENDIF.
      ENDLOOP.
    * setting focus for created grid control
      CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
        EXPORTING
          CONTROL = G_GRID.
    * Build fieldcat and set editable for date and reason code
    * edit enabled. Assign a handle for the dropdown listbox.
      PERFORM BUILD_FIELDCAT.
      PERFORM  SET_DRDN_TABLE.
    * Optionally restrict generic functions to 'change only'.
    *   (The user shall not be able to add new lines).
      PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
    **Vaiant to save the layout
      LS_VARI-REPORT      = SY-REPID.
      LS_VARI-HANDLE      = SPACE.
      LS_VARI-LOG_GROUP   = SPACE.
      LS_VARI-USERNAME    = SPACE.
      LS_VARI-VARIANT     = SPACE.
      LS_VARI-TEXT        = SPACE.
      LS_VARI-DEPENDVARS  = SPACE.
    **Calling the Method for ALV output
      CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
          IS_VARIANT           = LS_VARI
          IS_LAYOUT            = GS_LAYOUT
          I_SAVE               = 'A'
        CHANGING
          IT_FIELDCATALOG      = IT_FIELDCAT
          IT_OUTTAB            = ITAB[].
      "do these..{
    * Initializing document
      CALL METHOD DG_DYNDOC_ID->INITIALIZE_DOCUMENT.
    * Processing events
      CALL METHOD G_GRID->LIST_PROCESSING_EVENTS
        EXPORTING
          I_EVENT_NAME = 'TOP_OF_PAGE'
          I_DYNDOC_ID  = DG_DYNDOC_ID.
      "end }
    * Set editable cells to ready for input initially
      CALL METHOD G_GRID->SET_READY_FOR_INPUT
        EXPORTING
          I_READY_FOR_INPUT = 1.
    ENDFORM.                               "CREATE_AND_INIT_ALV
    *&      Form  EXCLUDE_TB_FUNCTIONS
    *       text
    *      -->PT_EXCLUDE text
    FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
    * Only allow to change data not to create new entries (exclude
    * generic functions).
      DATA LS_EXCLUDE TYPE UI_FUNC.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
    ENDFORM.                               " EXCLUDE_TB_FUNCTIONS
    *&      Form  build_fieldcat
    *       Fieldcatalog
    FORM BUILD_FIELDCAT .
      DATA: L_POS TYPE I.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
      X_FIELDCAT-FIELDNAME = 'VBELN'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-NO_ZERO    = 'X'.
      X_FIELDCAT-OUTPUTLEN = '10'.
      X_FIELDCAT-HOTSPOT = 'X'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Item'(025).
      X_FIELDCAT-FIELDNAME = 'POSNR'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '5'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Drop'(025).
      X_FIELDCAT-FIELDNAME = 'DROP'.
      X_FIELDCAT-TABNAME = 'IT_FINAL'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '5'.
      X_FIELDCAT-EDIT = 'X'.
      X_FIELDCAT-DRDN_HNDL = '1'.
      X_FIELDCAT-DRDN_ALIAS = 'X'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
    ENDFORM.                    " build_fieldcat
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'MAIN100'.
      SET TITLEBAR 'MAIN100'.
      IF G_CUSTOM_CONTAINER IS INITIAL.
    **Initializing the grid and calling the fm to Display the O/P
        PERFORM CREATE_AND_INIT_ALV.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  SET_DRDN_TABLE
    *       text
    FORM SET_DRDN_TABLE.
      DATA:LT_DRAL TYPE LVC_T_DRAL,
            LS_DRAL TYPE LVC_S_DRAL.
      LOOP AT ITAB .
    * First listbox (handle '1').
        IF SY-INDEX = 1.
          LS_DRAL-HANDLE = '1'.
          LS_DRAL-VALUE =  ' '.
          LS_DRAL-INT_VALUE =  ' '.
        ELSE.
          LS_DRAL-HANDLE = '1'.
          LS_DRAL-VALUE =  ITAB-POSNR.
          LS_DRAL-INT_VALUE =  ITAB-POSNR.
        ENDIF.
        APPEND LS_DRAL TO LT_DRAL.
      ENDLOOP.
    **Setting the Drop down table for Reason Code
      CALL METHOD G_GRID->SET_DROP_DOWN_TABLE
        EXPORTING
          IT_DROP_DOWN_ALIAS = LT_DRAL.
    ENDFORM.                               " set_drdn_table
    *&      Form  EVENT_TOP_OF_PAGE
    *       text
    *      -->DG_DYNDOC_ID  text
    FORM EVENT_TOP_OF_PAGE USING   DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT.
      "this is more clear.....check it
      "first add text, then pass it to comentry write fm
      DATA : DL_TEXT(255) TYPE C.  "Text
    * Populating header to top-of-page
      CALL METHOD DG_DYNDOC_ID->ADD_TEXT
        EXPORTING
          TEXT      = 'Test Report'
          SAP_STYLE = CL_DD_AREA=>HEADING.
    * Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
      CLEAR : DL_TEXT.
    * Move program ID
      CONCATENATE 'Program Name :' SY-REPID
             INTO DL_TEXT SEPARATED BY SPACE.
    * Add Program Name to Document
      PERFORM ADD_TEXT USING DL_TEXT.
    * Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
      CLEAR : DL_TEXT.
    * Move User ID
      CONCATENATE 'User ID :' SY-UNAME INTO DL_TEXT SEPARATED BY SPACE
    * Add User ID to Document
      PERFORM ADD_TEXT USING DL_TEXT.
    * Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
      CLEAR : DL_TEXT.
    * Move Client
      CONCATENATE 'Client :' SY-MANDT INTO DL_TEXT SEPARATED BY SPACE.
    * Add Client to Document
      PERFORM ADD_TEXT USING DL_TEXT.
    * Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
      CLEAR : DL_TEXT.
    * Move date
      WRITE SY-DATUM TO DL_TEXT.
      CONCATENATE 'Date :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.
    * Add Date to Document
      PERFORM ADD_TEXT USING DL_TEXT.
    * Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
      CLEAR : DL_TEXT.
    * Move time
      WRITE SY-UZEIT TO DL_TEXT.
      CONCATENATE 'Time :' DL_TEXT INTO DL_TEXT SEPARATED BY SPACE.
    * Add Time to Document
      PERFORM ADD_TEXT USING DL_TEXT.
    * Add new-line
      CALL METHOD DG_DYNDOC_ID->NEW_LINE.
    * Populating data to html control
      PERFORM HTML.
    ENDFORM.                    " EVENT_TOP_OF_PAGE
    *&      Form  ADD_TEXT
    *       To add Text
    FORM ADD_TEXT USING P_TEXT TYPE SDYDO_TEXT_ELEMENT.
    * Adding text
      CALL METHOD DG_DYNDOC_ID->ADD_TEXT
        EXPORTING
          TEXT         = P_TEXT
          SAP_EMPHASIS = CL_DD_AREA=>HEADING.
    ENDFORM.                    " ADD_TEXT
    *&      Form  HTML
    *       text
    FORM HTML.
      DATA : DL_LENGTH  TYPE I,                           " Length
             DL_BACKGROUND_ID TYPE SDYDO_KEY VALUE SPACE. " Background_id
    * Creating html control
      IF DG_HTML_CNTRL IS INITIAL.
        CREATE OBJECT DG_HTML_CNTRL
             EXPORTING
                  PARENT    = DG_PARENT_HTML.
      ENDIF.
    * Reuse_alv_grid_commentary_set
      CALL FUNCTION 'REUSE_ALV_GRID_COMMENTARY_SET'
        EXPORTING
          DOCUMENT = DG_DYNDOC_ID
          BOTTOM   = SPACE
        IMPORTING
          LENGTH   = DL_LENGTH.
    * Get TOP->HTML_TABLE ready
      CALL METHOD DG_DYNDOC_ID->MERGE_DOCUMENT.
    * Set wallpaper
      CALL METHOD DG_DYNDOC_ID->SET_DOCUMENT_BACKGROUND
        EXPORTING
          PICTURE_ID = DL_BACKGROUND_ID.
    * Connect TOP document to HTML-Control
      DG_DYNDOC_ID->HTML_CONTROL = DG_HTML_CNTRL.
    * Display TOP document
      CALL METHOD DG_DYNDOC_ID->DISPLAY_DOCUMENT
        EXPORTING
          REUSE_CONTROL      = 'X'
          PARENT             = DG_PARENT_HTML
        EXCEPTIONS
          HTML_DISPLAY_ERROR = 1.
      IF SY-SUBRC NE 0.
        MESSAGE I999 WITH 'Error in displaying top-of-page'(036).
      ENDIF.
    ENDFORM.                    " HTML
    Regards
    Vijay

  • Problems by holding the typed Values in Fields by using "LEAVE TO SCREEN"

    Hello Experts,
    I have created a Dynpro  with many field.
    Some Fields are Fields without searchhelps and a part of this Fields have searchhelps.
    One of this Field has a special function.
    It is a Field where you can choose a key value ( an ID number) about the searchhelp.
    After choosing I get the other values for this ID-Number in the returnparameter of the Searchhelp function
    ( values like name, surname ....)
    I set this return values  to the Fieldvariables in the PBO.
    For jumping to PBO I use "Leave to Screen" to the same screen.
    But the Problem is I can not hold the values wich I have typed before  in the Dynpro Fields (Field without serachhelps).
    After using the Field with the Searchhelp (for ID)  the Fields with typed Value go away.
    Please Hel me . Thanx in Advance
    Cetin

    Hi,
    In SE80 double click on your Screen Number and go to the Attributes Tab and Select Hold Data Check box,
    The Help Obtained from F1 Help is as follows, Kindly note this is Copied from F1 Help provided by Standard SAP,
    You too can Check it out
    "SAP Says --->
    If you activate this option, the following functions are supported for
    the screen at runtime:
    System -> User profile -> Hold data
                            -> Set data
                            -> Delete data
    The Hold data function allows you to hold onto any entries you have made
    on the screen. When the screen is next processed (even in a different
    mode), the system then automatically redisplays the data in the input
    fields.
    If the option is not activated, these functions are ineffective at
    screen runtime.
    The "Hold Data" option is not supported for include screens
    (subscreens). The automatic insertion of held data is exclusively
    controlled by the main screen.
    Cheerz
    Ram

  • Problem in syntax :- LEAVE TO SCREEN 0

    Hi Experts,
    I created a main program in se38.
    I called a screen 100(that is module pool program).
    in that i called dialog box. If i press ok in the dialog box i should come to screen 100
    but it is gooing to screen 1000 that is main program.
    Syntax i writen in dialog box is LEAVE TO SCREEN 0.
    plz reply as soon as possible.

    Hi,
    You should use CALL SCREEN '0100'.  It will take you to 100 screen.
    or
    You can use LEAVE TO SCREEN '0100'. It will LEAVE the current screen and take you to the screen 100.
    With Regards,
    Rupinder

  • Reg: Alv and selection-screen

    Hi,
    I created a ALV report,
    I gave the user provision delete rows and dispalyed the new list without the deleted rows( one row at a time)
    when i deleted few rows and when i press the back button i am getting all the rows deleted, but i want to jump directly to selection screen
    please help me how to jump to selection screen after pressing the back button
    i tried set screen 0     leave to screen 0 but of no use,
    please help in this regard
    thnx

    Hi learner,
    After deleting a row in ur internal tab u hav to refresh the display to remove dat row from display rite .....how r u doing it...??
    Are u calling the ALV FM again... if ur doin so !! its a wrong way and der lies de problem....
    check the sample code below in which if u double click on a row dat row gets deleted and the screen is refreshed.....also if u click back it goes to the selection-screen and not the previous alv display with deleted rows......
    TYPE-POOLS: slis.
    PARAMETERS rows TYPE i DEFAULT 20.
    DATA: itab        TYPE TABLE OF mara      WITH HEADER LINE,
          ls_layout   TYPE slis_layout_alv.
    START-OF-SELECTION.
      SELECT * UP TO rows ROWS
      FROM   mara
      INTO   CORRESPONDING FIELDS  OF TABLE itab.
      ls_layout-colwidth_optimize = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_structure_name        = 'MARA'
          is_layout               = ls_layout
          i_callback_program      = sy-repid
          i_grid_title            = 'Double click on a row'
          i_callback_user_command = 'EVENT_HANDLER'
        TABLES
          t_outtab                = itab[].
    *&      Form  event_handler
    FORM event_handler  USING r_ucomm     TYPE sy-ucomm
                              rs_selfield TYPE slis_selfield.
      CLEAR  itab.
      DELETE itab INDEX rs_selfield-tabindex.
      MOVE 'X'   TO rs_selfield-refresh .                 " this automatically refreshes the display
    ENDFORM.                    "event_handler
    Cheers,
    jose.

  • Leave to screen 0 is not working

    Hi Guys
    I made an alv oops.
    The container screen is 100. in the pai of 100 when i say
    case ok_code
    when 'BACK'.
    leave to screen 0.
    endcase.
    IT DOES NOT GO TO THE STANDARD SELECTION SCREEN!!. I am at the end of my wits , can someone help??
    Thanks a lot for taking a view
    regds
    sameer

    Check this Sample code using Docking container. In case of docking container no need of custom container required on screen.
    REPORT  ztest_oo_a.
    DATA: it_flight TYPE sflight_tab1.
    DATA: dock TYPE REF TO cl_gui_docking_container,
          grid TYPE REF TO cl_gui_alv_grid.
    parameters: p_carrid type sflight-carrid.
    SELECT *
      FROM sflight
      INTO TABLE it_flight
      UP TO 20 ROWS.
    CALL SCREEN 100.
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'SATR'.
      CREATE OBJECT dock
        EXPORTING
          repid     = sy-repid
          dynnr     = '100'
          extension = '1500'
        EXCEPTIONS
          cntl_error                  = 1
          cntl_system_error           = 2
          create_error                = 3
          lifetime_error              = 4
          lifetime_dynpro_dynpro_link = 5
          OTHERS                      = 6
      IF sy-subrc ne  0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
      CREATE OBJECT grid EXPORTING i_parent = dock.
      CALL METHOD grid->set_table_for_first_display
        EXPORTING
          i_structure_name              = 'SFLIGHT'
        CHANGING
          it_outtab                     = it_flight
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4.
      IF sy-subrc ne 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE user_command_0100 INPUT.
      CASE sy-ucomm.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Flow Logic
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0100.
    PROCESS AFTER INPUT.
    MODULE USER_COMMAND_0100.

  • Full Screen problem opening PDF on PC projector

    Using Flash CS3 on Mac - creating both Mac and PC projector files to go on a CD presentation
    Ok I have come across the following problem.
    When the CD is inserted the presentation starts automatically (on PC) and gives a list of PDFs which can be opened using EXEC fscommand. All works fine with the Mac version but on the PC version the Flash projector opens in Full Screen Mode and runs ok until I choose to open a PDF, then the presentation changes to Windowed Mode!!!
    Is there any way to stop the PC version of the projector leaving Full Screen Mode when a PDF is selected
    Any help would be appreciated

    hi Hordika,
    Thanks for Posting!
    Try Checking with Background Programs.
    Try Following a Clean Boot Procedure
    http://support.microsoft.com/kb/929135
    Hope this helps
    Cheers!
    Did someone help you today? Press the star on the left to thank them with a Kudo!
    If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.
    Follow @LenovoForums on Twitter!

  • Leave to screen 0 acts different

    I have coded OLE automation to create a spreadsheet from the report program. When the spreadsheet is done, it automatically saves it and the control comes to the list output screen of the program. When I hit Back(F3)from here, instead of going back to the SAP/USER menu, it gives me a blue screen. When I commented the OLE automation part, the back arrow takes me right . Can anybody explain me why is this happening? I appreciate your help.
    I opened a thread 4/5 days back for the same issue, but then I thought this was happening because I was using the selection-screen begin/end of screen. But I have strong evidence now that this is happening only when the OLE automation part is on. 
    Thanks
    Anupama

    Hi ,
    I have free statements for all the objects. here is the code for the call selection screen 99.
    start-of-selection.
        call selection-screen 99.
        if sy-subrc eq 0.
          perform get_companies.
          perform get_licenses.
          perform get_bps.
          perform display_output_summ.
          perform prepare_excel_sheet.
        else.
          leave to screen 0.
        endif.
    The last subroutine prepare_excel_sheet is the one when commented out, I have no problem. That is the subroutine, where I do all the OLE automation. Thank you  all for your  help.

  • Regarding the screen problem in 'back' command

    Hi Experts,
      I am doing project on data scrambling an using the ldb PNP . currently i am facing one problem regarding the' BACK'.
    i am calling one screen program in main  program. when i am  clicking on back button  from screen program ,the control flow back to the main program and the rest of the lines of the main program gets executed.
    i want the control must  go back to the default selection screen.
      i have tried using leave to screen 0,leave program and exit.But these command are not working as per the requirement.
    thanks in advance.

    Hai,
           Please check the fct code for BACK button. if the fctcode is exist then use the following code.
            if sy-ucomm = 'BACK'.       " USE CAPITAL LETTERS ONLY
                 LEAVE TO SCREEN 0.

  • CALL SELECTION SCREEN problem

    Hello!
    I have a problem. In my riport I have a selection screen (1000), a main screen (2000), and a screen (400) this is called inside a loop, to fill some datas when you hit the print button.
      CLEAR L_TOTAL.
      SORT LT_EBAN BY BNFPO.
      LOOP AT LT_EBAN.
        GT_ITEM2-FIELD01 = SY-TABIX.
        GT_ITEM2-FIELD02 = LT_EBAN-MATNR.
    *---Part name, Type, Maker
        SPLIT LT_EBAN-TXZ01 AT ',' INTO GT_ITEM2-FIELD03 GT_ITEM2-FIELD04 GT_ITEM2-FIELD05.
         CONCATENATE GT_ITEM2-FIELD03 '/' GT_ITEM2-FIELD04 INTO DESCR.
         ITEM = LT_EBAN-BNFPO.
         CALL SCREEN 400 STARTING AT 20 7 ENDING AT 60 18.
    *---Machine
        GT_ITEM2-FIELD06 = ST_400-MACHINE.
    After this, i could not use the LEAVE TO SCREEN 0, because it's not going back to secreen '2000' , I'm getting a blank 400 screen.
    Thatswhy I used CALL SCREEN '2000', and it's fine.
    But in the case of the Selection screen (1000) something is wrong.
    On the screen 2000 I using this logic.
    MODULE EXIT_2000 INPUT.
      CASE OK_CODE.
        WHEN 'BACK' OR 'EXIT'.
          CLEAR OK_CODE.
           CALL SELECTION-SCREEN '1000'.
           LEAVE PROGRAM.
        WHEN 'CANC'.
          PERFORM EXIT_PROGRAM.
          LEAVE PROGRAM.
      ENDCASE.
      CLEAR OK_CODE.
    ENDMODULE.                 " exit_2000  INPUT
    With this logic, the program is going to the SELECTION-SCREEN, when I hit the back button, and when we are already on the SELECTION-SCREEN, it's leaving the program. This is also ok.
    But when I hit the back button, and on the SELECTION-SCREEN I want to run the program again, it's not going to the program logic, it's jumping to this CALL SELECTION-SCREEN '1000', and leaving of course.
    START-OF-SELECTION.
      PERFORM DSP1_PROC.
      IF GT_DISPLAY[] IS INITIAL.
        MESSAGE S208(00) WITH 'No data.'.
        EXIT.
      ENDIF.
      IF S_RET = '1'.
        MESSAGE I208 WITH 'Document not found'.
        S_RET = ' '.
      ELSE.
        S_RET = ' '.
        CALL SCREEN '2000'.
      ENDIF.
    So my question is, that the above logic, when I running the program first time It's working good, at the START-OF-SELECTION, but when I trying to runnig from the SELECTION-SCREEN "second time", from the   START-OF-SELECTION it's jumping to the CALL SELECTION-SCREEN '1000'. How can I avoid this. I want that from the  START-OF-SELECTION, never go to the CALL SELECTION-SCREEN '1000'.
    Thank You
    Edited by: Roland on Dec 5, 2011 11:27 AM

    Hi Max!
    Yeah, I was thinking the same, that the problem is with that loop.
    But I don't know, how can I solved in a different way, because when we hit the print button, we getting all the items from a table, and we starting looping on them. In the loop we passing the values to a GT_ITEM table, later this table is connected with an excell, so it will be printed out in an excell form.
    So I have to call this screen so many times, how many items we have. Sometimes just 1, sometimes 4, 6, 9, and so on.
    For this items I have to add 2 more fields, wich are uploaded by the user. ( The other fields are coming from the table)
    So if I going out from the loop after the CALL SCREEN 400, I think the next item wont be get the values. Or maybe any of them, because this is before the APPEND GT_ITEM. So this methode wont be called, no data would be in the table, nothing will be printed.
    *-Item
      SELECT BNFPO MATNR TXZ01 MENGE MEINS ERNAM PREIS BEDNR EBELN EBELP
        INTO CORRESPONDING FIELDS OF TABLE LT_EBAN
        FROM EBAN
       WHERE BANFN  =  GT_DISPLAY-BANFN
         AND LOEKZ  =  ' '.
      CLEAR L_TOTAL.
      SORT LT_EBAN BY BNFPO.
      LOOP AT LT_EBAN.
        GT_ITEM2-FIELD01 = SY-TABIX.
        GT_ITEM2-FIELD02 = LT_EBAN-MATNR.
    *---Part name, Type, Maker
        SPLIT LT_EBAN-TXZ01 AT ',' INTO GT_ITEM2-FIELD03 GT_ITEM2-FIELD04 GT_ITEM2-FIELD05.
         CONCATENATE GT_ITEM2-FIELD03 '/' GT_ITEM2-FIELD04 INTO DESCR.
         ITEM = LT_EBAN-BNFPO.
         CALL SCREEN 400 STARTING AT 20 7 ENDING AT 60 18.
    *---Machine
        GT_ITEM2-FIELD06 = ST_400-MACHINE.
    *---Using Qty
        WRITE ST_400-USING UNIT LT_EBAN-MEINS TO GT_ITEM2-FIELD08.
    *---Now Stock
        CLEAR L_LABST.
        SELECT SUM( LABST ) INTO L_LABST
          FROM ZMM0460T
         WHERE MATNR = LT_EBAN-MATNR
           AND WERKS = '3A10'.
        WRITE L_LABST UNIT LT_EBAN-MEINS TO GT_ITEM2-FIELD09.
        WRITE LT_EBAN-MENGE UNIT LT_EBAN-MEINS TO GT_ITEM2-FIELD10.
        IF NOT LT_EBAN-EBELN IS INITIAL.
          CLEAR LS_EKPO.
          SELECT SINGLE NETPR WAERS PEINH
            INTO CORRESPONDING FIELDS OF LS_EKPO
            FROM EKPO AS A INNER JOIN EKKO AS B ON A~EBELN EQ B~EBELN
           WHERE A~EBELN = LT_EBAN-EBELN
             AND A~EBELP = LT_EBAN-EBELP.
          IF LS_EKPO-WAERS <> 'HUF'.
            CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
              EXPORTING
                DATE             = SY-DATUM
                FOREIGN_AMOUNT   = LS_EKPO-NETPR
                FOREIGN_CURRENCY = LS_EKPO-WAERS
                LOCAL_CURRENCY   = 'HUF'
              IMPORTING
                LOCAL_AMOUNT     = LS_EKPO-NETPR.
          ENDIF.
          IF LS_EKPO-PEINH IS INITIAL. LS_EKPO-PEINH = 1. ENDIF.
          LT_EBAN-PREIS = LS_EKPO-NETPR / LS_EKPO-PEINH.
        ENDIF.
        WRITE LT_EBAN-PREIS CURRENCY 'HUF' TO GT_ITEM2-FIELD11.
        CONDENSE GT_ITEM2-FIELD11.
        CONCATENATE GT_ITEM2-FIELD11 'Ft' INTO GT_ITEM2-FIELD11
          SEPARATED BY SPACE.
        L_NETWR = LT_EBAN-MENGE * LT_EBAN-PREIS.
        WRITE L_NETWR CURRENCY 'HUF' TO GT_ITEM2-FIELD12.
        CONDENSE GT_ITEM2-FIELD12.
        CONCATENATE GT_ITEM2-FIELD12 'Ft' INTO GT_ITEM2-FIELD12
          SEPARATED BY SPACE.
        L_TOTAL = L_TOTAL + L_NETWR.
    *---Unit
        SELECT SINGLE UNIT INTO GT_ITEM2-FIELD13
          FROM ZMM0500T
         WHERE PERNR = LT_EBAN-BEDNR.
    *---Name
        SELECT SINGLE SNAME INTO GT_ITEM2-FIELD14
          FROM PA0001
         WHERE PERNR = LT_EBAN-BEDNR
           AND ENDDA = '99991231'.
    *---Append
        GT_ITEM2-CNTR01 = ''.
        APPEND GT_ITEM2. CLEAR: GT_ITEM2, ST_400, DESCR, ITEM.
      ENDLOOP.
      GT_ITEM2-FIELD11 = 'Total'.
      WRITE L_TOTAL CURRENCY 'HUF' TO GT_ITEM2-FIELD12.
      CONDENSE GT_ITEM2-FIELD12.
      CONCATENATE GT_ITEM2-FIELD12 'Ft' INTO GT_ITEM2-FIELD12
        SEPARATED BY SPACE.
      GT_ITEM2-CNTR01 = 'B'.
      APPEND GT_ITEM2. CLEAR GT_ITEM2.
    ANy idea?
    Thank You
    Edited by: Roland on Dec 5, 2011 1:36 PM
    Edited by: Roland on Dec 5, 2011 1:50 PM

  • Error in Leave Request screen

    Hi All,
    Particular group of employess are facing problem in accessing leave request screen in the portal. They are getting the following error.
    *********Error**************
    "There are no customizing settings for absence type".
    Please guide me in resolving this.
    Thanks,
    Steffler.

    Hi,
    Can you check if the absence is correctly maintained, also make sure absence which were available earlier are customised correctly and not delimited or removed.
    Check t-code "PTARQ" .
    Hope the tasks are set to "General Task"
    SPRO> Time Management>Web Application>Leave Request(new)>Link Absence types and workflow templates.
    Regards
    Puneet

  • Sample prg how to use leave to screen

    hi,
    I am working on reports , BDC call transaction, application server or the presentation server has to be choosen, the problem is that i need to have the error message in the same screen where the file is entered.
    I tried giving leave to screen it not working.

    Hi anitha,
    1. I don't know whether i understood u r question.
    2. issue message of type S , or I
       and then write
      LEAVE LIST-PROCESSING.
    regards,
    amit m.

  • When loading video or tv shows it is taking as long as 14 hours plus - if I leave the loading screen it doesn't continue to load? So you have to wait without leaving the screen for 14 hours?

    When loading video or tv shows it is taking as long as 14 hours plus - if I leave the loading screen it doesn't continue to load? So you have to wait without leaving the screen for 14 hours? Unfortunately - I've been reading that this lengthy download problem is quite common - although I thought I saw where someone had loaded videos the day before and then had them to watch later. So, my first rental - I downloaded it overnight - then we go to watch it tonight and it proceeds to start loading again...saying it will be ready in 14 hours and 21 minutes!!! Am I doing something wrong here? If anyone has advice - I would greatly appreciate it. This is the first apple product that I am disappointed with

    When loading video or tv shows it is taking as long as 14 hours plus - if I leave the loading screen it doesn't continue to load? So you have to wait without leaving the screen for 14 hours? Unfortunately - I've been reading that this lengthy download problem is quite common - although I thought I saw where someone had loaded videos the day before and then had them to watch later. So, my first rental - I downloaded it overnight - then we go to watch it tonight and it proceeds to start loading again...saying it will be ready in 14 hours and 21 minutes!!! Am I doing something wrong here? If anyone has advice - I would greatly appreciate it. This is the first apple product that I am disappointed with

  • ALV and custom screens

    I have a program that displays a report using the ALV. I added a status and a few butttons. The user can then choose one of the buttons and go to a subsequent screen (0200). But since the original ALV display isn't a screen I created, I can't return to it from screen 0200.  How can I use both, the ALV and custom screens?

    >>You have to code this as an exit command in the PAI of screen 200.
    can you erlaborate? what should I put after back, exit, cancel? See below. You see I cheated and repeated my initial performs to rebuild the ALV screen..  You can also see the other things I tried.
    MODULE USER_COMMAND_0200 INPUT.
      If sy-ucomm = 'BACK' or
         sy-ucomm = 'EXIT' or
         sy-ucomm = 'CANCEL'.
         PERFORM GET_COCKPIT_SCREEN.
         PERFORM DISPLAY_COCKPIT_SCREEN.
         SET SCREEN 100. LEAVE SCREEN.
         LEAVE TO SCREEN 0500.    "screen # of AVL program

  • Modify generated leave approval screen

    I need to add a checkbox to the leave approval screen so that the manager can indicate if supporting documention has been sighted.
    Task TS20000193 usea BO FORM-HTMLPROCESS to call program SAPMWS2000081H with transaction code WS20000081.
    I tried copying the program and includes but there are more includes that are generated from I don't know where.
    What is the correct/best way to modify screen 150 in this program?
    Is there another way of going about it?

    Hi Neil,
    I probably shouldn't say this but... here's one exception to the rule about modifying SAP standard. Just change it. Make sure you have a backup available.
    a) It's hellishly complex to copy as there are a lot of little objects that interact & it's quite nasty code with individual tasks hardcoded. seen. Some OSS notes even recommend changing bits of code when you change the WF tasks.
    b) Any difficulties you may experience due to modding the standard will be less than the difficulties due to copying.
    c) That incarnation of leave request has reached the end of it's life. The ECC6 version has been completely rewritten form scratch and shares no common elements with it whatsoever, so upgrade problems are also not a factor.
    d) Because it's been around for some time I don't imagine there will be too many patches, which aren't that difficult to resolve anyway.
    Cheers,
    Mike

Maybe you are looking for

  • ORACLE.FDK.ServerError while creating document and assigning category

    Hi, I try tro create a new Document in Content Services and assigning an existing category here is the code snippet: public static Item createDocumentWithCategory(Item parent, Item category) throws FdkException, RemoteException // get the Manager ins

  • O/R mapping tool generates bad descriptors for CMP2.0

    The O/R tool has many problems with EJB-CMP 2.0. It generates bad ejb-jar.xml (misses the <cmr-field-type> tag, has the same relationship field included in both the <entity> tag and the <relationships> tag). The worst part is that is generates bad To

  • Nokia 8800 Sapphire Arte - Desperately want 1!

    Not sure if I am posting in the right place but I would like some advice please... End of last year I looked into buying a Nokia 8800 Sapphire Arte and found a good deal with Orange. However as I was going abroad for a couple of months and wouldn't b

  • PanelGroup disappears on page

    Hi, I have a page with a panelGroup containing a selectOneRadio. The page is part of a wizard. On first visit of the page the page shows as expected. When the user then cancels the wizard after the next page the panelGroup disappears. The application

  • How to Track IP Address on audit

    Hi, Anyone can help me??In production database one generic account with DBA privs,performing DML activities.But we do know who is performing it.Can anyone knows how to track IP address with the Userid.