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.

Similar Messages

  • Kludge to make less, vim et al. leave the screen uncluttered enjoy!

    I have written a script which leaves the screen uncluttered when finishing less.
    This script is written for bash in the "good old terminal", but works well with
    iTerm too. I wrote this script because less is opposite of more as less is so
    much more as more is so much less.
    I hope you will use this script and reap the rewards of using less while reading
    textfiles, gaining from less's features, avoiding the cluttering which may have
    made you disliking using less. You can make a copy of the script and modify and wrap
    the script around any other characterbased program which clutters your terminal screen.
    The script works by beeing placed in your ~/bin which I assume is before
    /usr/bin in your $PATH where the binary less resides. You must modify the paths
    in the script if they are different from that. (both the binary less, the script,
    and the kludge.scr)
    The script installs an interrupthandler which are triggered by changing the
    windowsize. The interupthandler figures out what it must do to preserve
    your screen when you exit less, and just does so, except for four characters
    to the extreme left on one line. (wich may well be part of your prompt).
    The interrupthandler gets its work done, by calling a kludge which are
    relatively referenced in the script from your homefolder, -presumes ~/bin
    - YOU MUST EDIT THE SCRIPT OTHERWISE. The configuration is like it is because
    that is what it takes to make the correct things happen in bash.
    I think this could have been accomplished much easier using another shell,
    but most people uses bash, especially newcomers, and they deserve to have
    it as easy as possible, while reaping the productivity gains laying dormant
    in the Unix core, so I hope you will share the script with you liberally,
    if you think it is worth the time and the work it takes to "install" it.
    I hope you will give this script a try, as to make less work comfortably for you,
    I have included an environment variable with all settings I like in less, which
    you may modify.
    Less was the first program I had that made me think "wow" back in 1986, beeing used
    to the "more" command, - which was, and is so much less than less. You can for instance
    invoke BBedit with a file you are viewing in less by pressing "v" if you have BBedit
    specified in the $EDITOR variable. You can pipe some text to the clipboard.
    Or you can pipe some lines out of a document you are viewing in less and into
    a file while viewing, you can load it with multiple files, and search them all,
    a programemer can make less work with tagfiles; you can have less create a logfile
    of what you read and, you can even scroll backwards. All in all less is a very handy
    tool which I think everybody would gain from using,in opposite to more.
    Especially when it leaves the screen uncluttered.
    Great care have been taken in order to make this kludge work properly.
    Still I MAKE ABSOLUTELY NO WARRANTIES ABOUT WHATSOEVER AND ANYTHING.
    -USE IT AT YOUR OWN RISK.
    You may do whatever you wish to do with it, aside from selling it alone, but you
    are free to do whatever that you please with it, aside from distributing
    malfunctioning copies or incomplete copies or tinker with the Copyright notice
    in the scripts.
    -------------------------------------------------- here comes the kludge for less - sends with you a tar as well. 8859 - encoded I think.
    #! /bin/bash
    # Less - lets us keep our screen nice even after resize, having used less or any other
    # character based program - like vim, which may leave an unorderly screen.
    # The fact that programs do clutter up the screen is because they probably didn't figure
    # that we one day would be able to resize our terminals when they specified the standards at
    # Ansi back in the 60's.
    # Installing : put it together with "kludge.bash" in your $HOME/bin folder ( ~/bin ).
    # its intended to work with the bash shell under MacOsX, the binary less is supposed
    # to reside in /usr/bin, if it isnt; ("which less" reveals where), adjust the path.
    # less - to be placed in the ~/bin folder is the wrap around less to make it behave
    # Copyright 2008 Tommy Bollman Public Domain. -No WARRANTIES ABOUT WHAT SO EVER-
    # Please do modify it for other programs which need helps with its cleanup as well.
    # ~ is an expansion for your home directory aka /Users/John\ Doe
    # Please document your version properly if you are posting it, relieving others.
    export LESS=" -I -r -f -J -S -g -M -x 4"
    # -I ignore case when searching
    # -r "raw" do not preparate ctrl-chars,
    # -f force open special files (may be binary) BEWARE OF ANSISEQUENCES.
    # -J show status column
    # -S chop long lines.
    # -g highlight on last hit in the search.
    # -M Most Verbose status column...
    # -x 4 tabspacing = 4
    # -------------------------------------- the screen handling starts here.................
    ORIGLINES=$LINES
    ESC=`printf "\e"`
    ScreenRedraw_off=`echo -n "$ESC""[8m"`
    ScreenRedraw_on=`echo -n "$ESC""[0m"`
    function OkayScreen()
    export PS1="" # Turns off the prompt to avoid cluttering..
    echo -n ${ScreenRedraw_off}
    CURLINES=`bash -i < ~/bin/kludge.bash `
    # ^^^^^^^^^^^ NB! the path where kludge.bash should be placed.
    if [ $CURLINES -gt $ORIGLINES ] ; then
    TO_SKIP="$(expr "$CURLINES" '-' "$ORIGLINES")"
    if [ $TO_SKIP -lt 3 ] ; then
    TO_SKIP="$(expr "$TO_SKIP" '-' '2')"
    else
    TO_SKIP="$(expr "$TO_SKIP" '-' '1')"
    fi
    tput cuu 1 #cursor up one line
    echo -n ${ScreenRedraw_on}
    echo -n "\$####" #restores an erased '$' making only 3 chars disappear.
    # ^ $ = prompt - $PS1. .(I have just a dollar here but if yours is longer,
    # you can add the first four if it's static, and you'll loose nothing!!)
    echo -n ${ScreenRedraw_off}
    tput cud $TO_SKIP # move cursor to where it should be.
    echo -n ${ScreenRedraw_on}
    echo # activate the cli at correct position.
    else
    tput cuu 2
    echo ${ScreenRedraw_on}
    fi
    trap OkayScreen SIGWINCH
    /usr/bin/less $@
    # ^^^^^^^^ NB! The path where the BINARY less is installed.
    trap '' SIGWINCH
    -------------------------------------------------------------------------------- and here is the kludge wich makes it all work!
    #! /bin/bash
    # kludge.scr - to be placed in the ~/bin folder is the inner workings of the bash script named less
    # Copyright 2008 Tommy Bollman
    PS1=""
    shopt -s checkwinsize
    echo $LINES
    ----><---------------------- EOF.

    I have written a script which leaves the screen uncluttered when finishing less.
    This script is written for bash in the "good old terminal", but works well with
    iTerm too. I wrote this script because less is opposite of more as less is so
    much more as more is so much less.
    I hope you will use this script and reap the rewards of using less while reading
    textfiles, gaining from less's features, avoiding the cluttering which may have
    made you disliking using less. You can make a copy of the script and modify and wrap
    the script around any other characterbased program which clutters your terminal screen.
    The script works by beeing placed in your ~/bin which I assume is before
    /usr/bin in your $PATH where the binary less resides. You must modify the paths
    in the script if they are different from that. (both the binary less, the script,
    and the kludge.scr)
    The script installs an interrupthandler which are triggered by changing the
    windowsize. The interupthandler figures out what it must do to preserve
    your screen when you exit less, and just does so, except for four characters
    to the extreme left on one line. (wich may well be part of your prompt).
    The interrupthandler gets its work done, by calling a kludge which are
    relatively referenced in the script from your homefolder, -presumes ~/bin
    - YOU MUST EDIT THE SCRIPT OTHERWISE. The configuration is like it is because
    that is what it takes to make the correct things happen in bash.
    I think this could have been accomplished much easier using another shell,
    but most people uses bash, especially newcomers, and they deserve to have
    it as easy as possible, while reaping the productivity gains laying dormant
    in the Unix core, so I hope you will share the script with you liberally,
    if you think it is worth the time and the work it takes to "install" it.
    I hope you will give this script a try, as to make less work comfortably for you,
    I have included an environment variable with all settings I like in less, which
    you may modify.
    Less was the first program I had that made me think "wow" back in 1986, beeing used
    to the "more" command, - which was, and is so much less than less. You can for instance
    invoke BBedit with a file you are viewing in less by pressing "v" if you have BBedit
    specified in the $EDITOR variable. You can pipe some text to the clipboard.
    Or you can pipe some lines out of a document you are viewing in less and into
    a file while viewing, you can load it with multiple files, and search them all,
    a programemer can make less work with tagfiles; you can have less create a logfile
    of what you read and, you can even scroll backwards. All in all less is a very handy
    tool which I think everybody would gain from using,in opposite to more.
    Especially when it leaves the screen uncluttered.
    Great care have been taken in order to make this kludge work properly.
    Still I MAKE ABSOLUTELY NO WARRANTIES ABOUT WHATSOEVER AND ANYTHING.
    -USE IT AT YOUR OWN RISK.
    You may do whatever you wish to do with it, aside from selling it alone, but you
    are free to do whatever that you please with it, aside from distributing
    malfunctioning copies or incomplete copies or tinker with the Copyright notice
    in the scripts.
    -------------------------------------------------- here comes the kludge for less - sends with you a tar as well. 8859 - encoded I think.
    #! /bin/bash
    # Less - lets us keep our screen nice even after resize, having used less or any other
    # character based program - like vim, which may leave an unorderly screen.
    # The fact that programs do clutter up the screen is because they probably didn't figure
    # that we one day would be able to resize our terminals when they specified the standards at
    # Ansi back in the 60's.
    # Installing : put it together with "kludge.bash" in your $HOME/bin folder ( ~/bin ).
    # its intended to work with the bash shell under MacOsX, the binary less is supposed
    # to reside in /usr/bin, if it isnt; ("which less" reveals where), adjust the path.
    # less - to be placed in the ~/bin folder is the wrap around less to make it behave
    # Copyright 2008 Tommy Bollman Public Domain. -No WARRANTIES ABOUT WHAT SO EVER-
    # Please do modify it for other programs which need helps with its cleanup as well.
    # ~ is an expansion for your home directory aka /Users/John\ Doe
    # Please document your version properly if you are posting it, relieving others.
    export LESS=" -I -r -f -J -S -g -M -x 4"
    # -I ignore case when searching
    # -r "raw" do not preparate ctrl-chars,
    # -f force open special files (may be binary) BEWARE OF ANSISEQUENCES.
    # -J show status column
    # -S chop long lines.
    # -g highlight on last hit in the search.
    # -M Most Verbose status column...
    # -x 4 tabspacing = 4
    # -------------------------------------- the screen handling starts here.................
    ORIGLINES=$LINES
    ESC=`printf "\e"`
    ScreenRedraw_off=`echo -n "$ESC""[8m"`
    ScreenRedraw_on=`echo -n "$ESC""[0m"`
    function OkayScreen()
    export PS1="" # Turns off the prompt to avoid cluttering..
    echo -n ${ScreenRedraw_off}
    CURLINES=`bash -i < ~/bin/kludge.bash `
    # ^^^^^^^^^^^ NB! the path where kludge.bash should be placed.
    if [ $CURLINES -gt $ORIGLINES ] ; then
    TO_SKIP="$(expr "$CURLINES" '-' "$ORIGLINES")"
    if [ $TO_SKIP -lt 3 ] ; then
    TO_SKIP="$(expr "$TO_SKIP" '-' '2')"
    else
    TO_SKIP="$(expr "$TO_SKIP" '-' '1')"
    fi
    tput cuu 1 #cursor up one line
    echo -n ${ScreenRedraw_on}
    echo -n "\$####" #restores an erased '$' making only 3 chars disappear.
    # ^ $ = prompt - $PS1. .(I have just a dollar here but if yours is longer,
    # you can add the first four if it's static, and you'll loose nothing!!)
    echo -n ${ScreenRedraw_off}
    tput cud $TO_SKIP # move cursor to where it should be.
    echo -n ${ScreenRedraw_on}
    echo # activate the cli at correct position.
    else
    tput cuu 2
    echo ${ScreenRedraw_on}
    fi
    trap OkayScreen SIGWINCH
    /usr/bin/less $@
    # ^^^^^^^^ NB! The path where the BINARY less is installed.
    trap '' SIGWINCH
    -------------------------------------------------------------------------------- and here is the kludge wich makes it all work!
    #! /bin/bash
    # kludge.scr - to be placed in the ~/bin folder is the inner workings of the bash script named less
    # Copyright 2008 Tommy Bollman
    PS1=""
    shopt -s checkwinsize
    echo $LINES
    ----><---------------------- EOF.

  • ESS Leave request screen giving a critical Error in production server

    Friends,
    We are in a critical face of ESS implemetation.
    We are doing an ESS MSS implementation for country grouping 99.
    When we moved our changes to production server after succesful testing in quality, getting the following Critical error for Leave Request Screen.
    java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
         at java.util.ArrayList.RangeCheck(ArrayList.java:512)
         at java.util.ArrayList.get(ArrayList.java:329)
         at com.sap.aii.proxy.framework.core.JcoBaseList.get(JcoBaseList.java:272)
         at com.sap.aii.proxy.framework.core.AbstractList.get(AbstractList.java:230)
         at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCList.get(DynamicRFCList.java:281)
         at com.sap.tc.webdynpro.progmodel.context.Node$ModelElementList.getElement(Node.java:2543)
         at com.sap.tc.webdynpro.progmodel.context.Node.getElementAtInternal(Node.java:621)
    Other areas like personal Info & who is who are working fine.
    Leave request was working fine in Development and Quality servers and it never worked in Production server.
    It worked fine with same config, with same master data and same employee & org structure in quality server.
    We tried the following things:
    1. Checked and confirmed the sequence of transports for configs and Developments to Quality and Production.
    Even compared the table level entries and ABAP codings B/n dev and Production. All are same.
    2. Moved the workflow changes to production and activated the same. No change found after that.
    3. Gave SAP all authorization in R/3 and full authorization from portal side as well.
    4. Assigned the userid to different employees and checked the masterdata of employees.
    5. Checked the note 1388426.Every thing mentioned in the note is there in the system.
    6. Verified Rule groups and WEBMO feature are correct and same as in quality.
    As our go live date is very near, request your help .Thanks in advance for your help.
    Regards,

    Customisation of Leave request is mising in your system, please check the rule group using PTARQ.

  • IPOD and white screen asking in different languages

    Hello everyone
    My ipod has been acting up for the pass few months and now i have had enough.
    When my ipod is connected to my fm tuner, when it is time to take the tuner off, it gives me a white screen saying in different languages to connect to computer and restore. I have restored my ipod about 20 times in the past months. I work on linux and have a vitual windows xp
    is my ipod broken or what

    Hopefully the battery has leak after long disused.
    Recharge the iPod battery for at least 4 hours, normally it would take 30 minutes of recharge before the screen comes to live.
    Disconnect the iPod, safely, after charging.
    If your battery is good and can recharge fully.
    Hard Reset the iPod - Press Menu and Center button simultaneously for about 10 secs till the Apple logo comes ON.
    Select your preferred language.
    Connect your iPod back to the Mac, and see if it is recognised by iTunes or Finder
    Good Luck! and you will need it when syncing your iPod.
    Here is the Apple Support Article for reference
    http://support.apple.com/kb/TS1410

  • 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

  • Home screen bookmark icons different on IPad 2

    I have a question that I hope someone can answer, I've been trying to add bookmarks to my home screen, but their icons are just a snap shot of the web page. I have the same icon on my iPhone home screen, and the icon automatically change to an actual icon.
    Is there a reason why these icons would be acting differently between the iPhone and the iPad??
    Thanks

    I've contacted both companies and they state that it has to do with the ipad recognizing the icon, and that it has nothing to do with the web site design, any other suggestions?
    Thanks

  • What is the diffrence of 'call screen 100' and 'leave to screen 100'

    Thank u

    hi,
    You can insert a screen sequence. This adds another layer to a stack.
    You insert a screen sequence using the CALL SCREEN <nnnn> statement.
    Note: Layers created in this way must be removed afterwards. You can do this by setting the next screen
    statically or dynamically to the initial value (0) an the end of the inserted screen sequence.
    To interrupt processing of the current screen and branch to a new screen (or sequence of screens), use
    the CALL SCREEN <nnnn> statement. The screen <nnnn> must belong to the same program.
    In the program, the system constructs a stack. The stack has to be destroyed before the end of the
    program.
    To return to the statement following the CALL SCREEN statement, you can use either SET SCREEN 0.
    LEAVE SCREEN. or LEAVE TO SCREEN 0. The screen that called the other screen is then processed
    further.
    If you use the above statements outside a call chain, the program terminates, and control returns to the
    point from which it was called. You can also terminate a program using the ABAP statement LEAVE
    PROGRAM.
    To interrupt processing of the current screen and branch to a new screen (or sequence of screens), use
    the CALL SCREEN <nnnn> statement. The screen <nnnn> must belong to the same program.
    In the program, the system constructs a stack. The stack has to be destroyed before the end of the program.
    To return to the statement following the CALL SCREEN statement, you can use either SET SCREEN 0.
    LEAVE SCREEN. or LEAVE TO SCREEN 0. The screen that called the other screen is then processed
    further.
    To specify the next screen and leave the current screen in a single step, use the LEAVE TO SCREEN <nnnn> statement.
    Hope this helps, DO reward.
    Edited by: Runal Singh on Apr 3, 2008 3:11 PM

  • 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.

  • 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

  • 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

  • My iPhones screen turns in different colors then keeps shutting down

    my iPhones screen turns in different colors then keeps shutting down

    did you get this problem repaired if so how ?

  • How to leave full-screen view in Acrobat LE on HTC Touch Diamond?

    Hello
    I have entered full-screen mode in Adobe Acrobat LE on my HTC Touch Diamond, but I cannot leave full-screen mode. There is nowhere on the screen that gives me a button to leave full-screen mode?!
    I have tried using the buttons below the touch-screen but I have found nothing that works.
    How do I leave full-screen mode??

    Hello again.
    Well I have tried almost everything with the stylus: Zoom operations (rotations), tapping the screen, pressing and holding, double tapping... nothing allows me to exit fullscreen nor get any on-screen menus to appear!
    I must admit that I am very new to the HTC Touch Diamond so maybe I am being stupid, but I really can't find any way of getting any menus or anything else to show up once I have entered full-screen viewing. My only option is to exit Acrobat by pressing the back button below the touch screen, and then I of course leave Acrobat completely.
    Please tell me how exactly I must use the stylus to exit fullscreen?
    Thank you :-)

  • Leave to screen 0 with error message

    Hi experts,
    how can I break the execution and leave the to the initial screen with an error message?

    Hi,
    you can use LEAVE SCREEN or LEAVE TO SCREEN n
    and for the message, you can use
    MESSAGE ID mid TYPE mtype NUMBER num.
    where mtype is 'E' or 'A'
    Read the documentation for these instructions.

  • 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

  • Leave to screen

    Hi All,
    I have the requirement where i need to give error msg then i have to go the last screen.
    I am implementing a customer exit in i check for vendor if it is initial then i have to give error msg and then i have to go the first screen(whose screen no is 200) of  the transaction (qm02).
    code i have written is
    If lifnum is initial.
    Message e110(z01) with 'no vendor'.
    leave to screen 200.
    endif.
    This is not working,can anybody help in this regard
    Thanks,
    Priya.

    hi
    Is the Screen 200 of ur Program the first screen of QM02? If yes you can again goto QM02 by doing a call transaction after giving following code.
      MESSAGE i000(z0) WITH 'Test'.
    *  STOP.
      LEAVE TO TRANSACTION 'QM02'.
      WRITE 'HI'.
    or
      MESSAGE i000(z0) WITH 'Test'.
    *  STOP.
      LEAVE TO SCREEN '200'.
      WRITE 'HI'.
    Hope That Helps
    Anirban M.

Maybe you are looking for