If i run oops alv in background, its going dump

If I run oops alv in background its going dump?
can any one suggest me to do this or to overcome
thanks and regards
setty

ALV's can be run in background if you use a docking container instead of a custom container.
Please search the forum for "ALV in background". You will find tons of threads with solutions.
Re: How to run ALV reports in batch
Sample code to have ALV Grid in Background

Similar Messages

  • Oops ALV in background mode

    Hi Experts,
    I know this topic is discussed several times but I still have a confusion.
    I have created one ALV report using custom container like the usual way. As per my understanding this report shouldn't execute in background
    but when I execute the report in background in development system, it's not throwing any error and I am able to get the spool.
    Why is this happening? Is there a possibility that if I transport the object to other system I may get error?
    Please share your thoughts.
    Thanks,
    Tiki

    This is my "common code" i use to manage CL_GUI_GRID in background without touching the output screen to define a container
    CLASS lcl_event_handler DEFINITION DEFERRED.
    DATA: gr_event_handler      TYPE REF TO lcl_event_handler.
    *---- ALV Grid instance reference
    DATA: gr_alvgrid            TYPE REF TO cl_gui_alv_grid.
    *---- Custom container instance reference
    DATA: gr_splitter_container TYPE REF TO cl_gui_splitter_container,
           gr_container          TYPE REF TO cl_gui_container.
    *---- Header container
    DATA: gr_docking_container  TYPE REF TO cl_gui_docking_container,
           gr_document           TYPE REF TO cl_dd_document.
    IN PBO
    IF sy-batch = 'X'.
    *---- Creating ALV grid within a docking container
           CREATE OBJECT gr_alvgrid
             EXPORTING
               i_parent = gr_docking_container.
         ELSE.
    *---- Creating Splitted Containers
           CREATE OBJECT gr_splitter_container
             EXPORTING
               parent  = cl_gui_container=>screen0
               rows    = 1
               columns = 1.
           CALL METHOD gr_splitter_container->set_border
             EXPORTING
               border = cl_gui_cfw=>false.
           CALL METHOD gr_splitter_container->set_row_mode
             EXPORTING
               mode = gr_splitter_container->mode_relative.
           gr_container =
             gr_splitter_container->get_container( row = 1 column = 1 ).
    *---- Creating ALV Grid instance
           CREATE OBJECT gr_alvgrid
             EXPORTING
               i_parent = gr_container.
    *---- Preparing document header
           PERFORM prepare_header.
         ENDIF.
    *-- Creating an instance for the event handler
         CREATE OBJECT gr_event_handler.
    *-- Registering handler methods to handle ALV Grid events
    *   NOTA: Qua vanno registrati eventuali metodi aggiunti per gestire
    *   altri eventi della classe CL_GUI_ALV_GRID.
         SET HANDLER gr_event_handler->handle_double_click  FOR gr_alvgrid.
         SET HANDLER gr_event_handler->handle_hotspot_click FOR gr_alvgrid.
         SET HANDLER gr_event_handler->handle_data_changed  FOR gr_alvgrid.
         SET HANDLER gr_event_handler->handle_data_changed_finished
                                                            FOR gr_alvgrid.
         SET HANDLER gr_event_handler->handle_toolbar       FOR gr_alvgrid.
         SET HANDLER gr_event_handler->handle_user_command  FOR gr_alvgrid.
    *-- Preparing layout structure
         PERFORM prepare_layout.
    *-- Preparing print structure
         PERFORM prepare_print.
    *-- Preparing field catalog
         PERFORM prepare_field_catalog.
    *-- Preparing sort criteria table
         PERFORM prepare_sort_criteria.
    *-- Prepating filter criteria table
         PERFORM prepare_filter_criteria.
    *-- Preparing function codes to exclude from the toolbar
         PERFORM prepare_toolbar_exclude.
    *-- Preparing the output for the ALV grid list
    *-- NOTE: set I_BUFFER_ACTIVE = 'X' to speed to the list display
    *-- if the ALV grid uses statically always the same field catalog
         CALL METHOD gr_alvgrid->set_table_for_first_display
           EXPORTING
    *       i_buffer_active               = 'X'
    *       i_structure_name              = 'GS_OUTTAB'
             is_variant                    = gs_variant
             i_save                        = 'A'
             i_default                     = 'X'
             is_layout                     = gs_layout
             is_print                      = gs_print
    *       IT_SPECIAL_GROUPS             =
             it_toolbar_excluding          = gt_exclude[]
    *       IT_HYPERLINK                  =
    *       IT_ALV_GRAPHICS               =
           CHANGING
             it_outtab                     = gt_outtab[]
             it_fieldcatalog               = gt_fieldcat[]
             it_sort                       = gt_sort[]
             it_filter                     = gt_filter[]
           EXCEPTIONS
             invalid_parameter_combination = 1
             program_error                 = 2
             too_many_lines                = 3
             OTHERS                        = 4.
    *-- Allows to edit the toolbar
         CALL METHOD gr_alvgrid->set_toolbar_interactive.

  • In OOPS ALV docking container gives error while execute in Background.

    When i try to use Docking container to execute OOPS ALV in background the jobs still fails with Switch framework error.
    Kindly let me know your inputs to resolve the same.
    Thank you !!

    Hello Nalini,
    Yes, it is possible to schedule background.
    data: or_doc  type ref to cl_gui_docking_container .
    if cl_gui_alv_grid=>offline( ) is initial.
        create object or_custom_container
               exporting container_name = cust_container.
      create object or_grid
             exporting i_parent = or_custom_container.
    else .
    create object or_grid
             exporting i_parent = or_doc .
    endif .
    Regards,
    Vadamalai A.
    Message was edited by: Matthew Billingham

  • Soa_server1 is RUNNING and immediate its going to FORCE_SHUTTING_DOWN

    Hi i have servers in my system when i started weblogic is starting and it is in RUNNING mode and when i try to start SOA server it is starting and RUNNING and with in seconds its going to shutting down automatically.My system name is changed at first it like infar20263 and now it changes to infar20153.after changing system name soa server is running mode also after few minutes. That is like below
    <Mar 12, 2012 4:48:58 PM IST> <Notice> <WebLogicServer> <BEA-000332> <Started We
    bLogic Managed Server "soa_server1" for domain "base1_domain" running in Develop
    ment Mode>
    <Mar 12, 2012 4:49:05 PM IST> <Notice> <WebLogicServer> <BEA-000365> <Server sta
    te changed to RUNNING>
    <Mar 12, 2012 4:49:05 PM IST> <Notice> <WebLogicServer> <BEA-000360> <Server sta
    rted in RUNNING mode>
    ====> CubeEngine load PrintInput/BPELProcess1 took 296 ms
    ====> CubeEngine load AIAReadJMSNotificationProcess/AIAReadJMSNotificationProces
    s took 31 ms
    ====> CubeEngine load AIAB2BErrorHandlerInterface/EnrichAIAFaultProcess took 32
    ms
    ====> CubeEngine load AIAErrorTaskAdministrationProcess/AIAErrorTaskAdministrati
    onProcess took 70 ms
    ====> CubeEngine load AIAAsyncErrorHandlingBPELProcess/AIAAsyncErrorHandlingBPEL
    Process took 16 ms
    ====> CubeEngine load ReloadProcess/ReloadConfigurationProcess took 1,622 ms
    SOA Platform is running and accepting requests
    e.getStackTrace()[Ljava.lang.StackTraceElement;@6a9f69d3
    e.getMessage()com.collaxa.cube.engine.types.bpel.CXMessageVariable cannot be cas
    t to java.lang.String
    <Mar 12, 2012 4:49:13 PM IST> <Notice> <WebLogicServer> <BEA-000388> <JVM called
    WLS shutdown hook. The server will force shutdown now>
    <Mar 12, 2012 4:49:13 PM IST> <Alert> <WebLogicServer> <BEA-000396> <Server shut
    down has been requested by <WLS Kernel>>
    <Mar 12, 2012 4:49:13 PM IST> <Notice> <WebLogicServer> <BEA-000365> <Server sta
    te changed to FORCE_SUSPENDING>
    [JCABindingManager] : This operation is not supported for JCA based MDB
    <Mar 12, 2012 4:49:14 PM IST> <Notice> <WebLogicServer> <BEA-000365> <Server sta
    te changed to ADMIN>
    <Mar 12, 2012 4:49:14 PM IST> <Notice> <WebLogicServer> <BEA-000365> <Server sta
    te changed to FORCE_SHUTTING_DOWN>
    <Mar 12, 2012 4:49:14 PM IST> <Notice> <Server> <BEA-002607> <Channel "Default[3
    ]" listening on fe80:0:0:0:4866:931f:9f4e:78f6:8101 was shutdown.>
    <Mar 12, 2012 4:49:14 PM IST> <Notice> <Server> <BEA-002607> <Channel "Default[1
    ]" listening on fe80:0:0:0:0:ffff:ffff:fffe:8101 was shutdown.>
    <Mar 12, 2012 4:49:14 PM IST> <Notice> <Server> <BEA-002607> <Channel "Default[4
    ]" listening on 127.0.0.1:8101 was shutdown.>
    <Mar 12, 2012 4:49:14 PM IST> <Notice> <Server> <BEA-002607> <Channel "Default[2
    ]" listening on fe80:0:0:0:0:5efe:a65:3528:8101 was shutdown.>
    <Mar 12, 2012 4:49:14 PM IST> <Notice> <Server> <BEA-002607> <Channel "Default[5
    ]" listening on 0:0:0:0:0:0:0:1:8101 was shutdown.>
    <Mar 12, 2012 4:49:14 PM IST> <Notice> <Server> <BEA-002607> <Channel "Default"
    listening on 10.101.53.40:8101 was shutdown.>
    <Mar 12, 2012 4:49:43 PM IST> <Notice> <WebLogicServer> <BEA-000378> <Server fai
    led to shutdown within the configured timeout of 30 seconds. The server process
    will exit now.>
    <Mar 12, 2012 4:49:43 PM IST> <Error> <> <BEA-000000> <cannot load libary 'stack
    dump': java.lang.UnsatisfiedLinkError: no stackdump in java.library.path
    >

    <Mar 12, 2012 4:49:13 PM IST> <Notice> <WebLogicServer> <BEA-000388> <JVM called WLS shutdown hook. The server will force shutdown now>How are you starting servers? If you are starting using command line, make sure that you are not closing the command line console after servers get started.
    Regards,
    Anuj

  • Running the alv report  in  background and sending it thro email

    hi,
          i have to run the  alv report in background and send the output through email

    Hi
    Many a times there is a requirement to display ALV Grid (not ALV List) in the background Job. I have checked the SDN Forum for the same and it has been mentioned that ALV Grid cannot be displayed in Background, but the list output of ALV is possible. So user won’t have the actual Grid interface but the List interface.
    There is a workaround to display ALV Grid in Background Job. The only restriction is you can’t schedule the job through SM36. You need to execute the transaction of the report program, fill in the selection screen data and hit Execute.
    The job would be executed in background. User will be able to see the Job Log and Job Status after executing the program. User doesn’t have to go to SM37 to view the job status/log. Once the Job Status is changed to “COMPLETED”, user can click on “DISPLAY SPOOL” to view the ALV Grid.
    Limitations:
    Can’t schedulea background job
    The session should be active until the background job is completed. If the session is closed, then user won’t be able to check the output in ALV Grid. User would be able to check the output through spool or SM37
    Advantages:
    If the spool width is greater than 255 characters, then the entire width could be seen in the output because the output is directed to an ALV Grid and not to spool
    Interface of ALV Grid is available instead of ALV List even though it’s a background job.
    Program won’t give the TIME OUT error
    Steps Required:
    1. Once you execute the program, the following screen would be displayed
    2. Click “Display Job Status” to check the Status of the Background Job
    3. Click on “Display the Job Log” to check the Log
    4. Click on “Display Job Status” to check the Job Status
    5. Click on “DISPLAY SPOOL” to check the spool content once the Job Status is changed to “COMPLETED”. Output is displayed in ALV Grid
    Programs:
    1.  Two different programs needs to be created
    ZPROGRAM_ONE: This is the 1st program, where the selection screen and all the data validations would be done. Error handling for invalid data should be done in this program.
    Once the data validation is done, this program would call the 2nd program ZPROGEAM_TWO. Build the logic to display ALV Grid in this program. The logic will only display ALV in foreground and it won’t be reflected in the spool.
    ZPROGRAM_TWO: This program would fetch all the data and do all the processing. If you want the spool output along with ALV Grid output, then build the logic in this program to display ALV Grid.
    *& Report  ZPROGRAM_ONE                                                *
    REPORT  zprogram_one                            .
    PRASHANT PATIL
    TABLES : mara,
             tsp01.
    type-pools:slis.
    TYPES : BEGIN OF t_mara,
              matnr   TYPE mara-matnr,
              ersda   TYPE mara-ersda,
              ernam   TYPE mara-ernam,
              laeda   TYPE mara-laeda,
            END OF t_mara.
    DATA : i_mara       TYPE STANDARD TABLE OF t_mara,
           wa_mara      TYPE t_mara,
           wa_index     TYPE indx,        " For Index details
           wa_index_key TYPE indx-srtfd VALUE 'PRG_ONE',
           i_jobsteplist     TYPE STANDARD TABLE OF tbtcstep, " For spool number
           wa_params         TYPE pri_params,  " To Get Print Parameters
           wa_jobhead        TYPE tbtcjob,     " To know the status of job
           wa_jobsteplist    TYPE tbtcstep,    " To know the spool
           w_jobname         TYPE tbtco-jobname,  " Job name for bckgrnd job
           w_jobcount        TYPE tbtco-jobcount, " Unique id for bckgrd job
           w_path            TYPE string,         " Upload path
           w_lsind           TYPE sy-lsind,       " Index
           wa_seltab         TYPE rsparams,
           i_seltab          TYPE STANDARD TABLE OF rsparams,
           wa_index1         TYPE indx,        " For Index details
           wa_index_key1     TYPE indx-srtfd VALUE 'PRG_TWO',
           i_fieldcat        TYPE slis_t_fieldcat_alv,
           wa_fieldcat       LIKE LINE OF i_fieldcat.
            CONSTANTS DECLARATION                                        *
    CONSTANTS :
             c_a(1) TYPE c VALUE 'A',
             c_m(1) TYPE c VALUE 'M',
             c_l(1) TYPE c VALUE 'L',
             c_c(1) TYPE c VALUE 'C',
             c_zfdr(4) TYPE c VALUE 'ZFDR',
             c_x(1)    TYPE c VALUE 'X',
             c_locl(4) TYPE c VALUE 'LOCL', " Destination is LOCAL
             c_f(1)    TYPE c VALUE 'F',   " Job Status - Failed
             c_s(1)    TYPE c VALUE 'S',
             c_p(1)    TYPE c VALUE 'P'.
    SELECTION SCREEN PARAMETERS
    SELECT-OPTIONS : s_matnr FOR mara-matnr.
    START-OF-SELECTION.
    Before the export, fill the data fields before CLUSTR
      wa_index-aedat = sy-datum.
      wa_index-usera = sy-uname.
      EXPORT s_matnr
           TO DATABASE indx(st) FROM wa_index ID wa_index_key.
    To Open the Job for background processing
      PERFORM open_job.
    To get the print parameters
      PERFORM get_print_parameters.
    Submit the job in background
      PERFORM job_submit.
    Close the background job
      PERFORM job_close.
    This is the output screen with the buttons ********
    Create 3 buttons DISPLAY SPOOL, STATUS, JOBLOG
      SET PF-STATUS 'ZS001'.
      WRITE: / 'The program is submitted in Background'.
      WRITE: / 'Press DISPLAY SPOOL to see the spool'.
      WRITE: / 'Press STATUS to see the status of the background'.
    AT USER-COMMAND.
    If user presses the 'BACK' button
      IF sy-ucomm = 'BAK'.
        IF  wa_jobhead-status = c_f OR
            wa_jobhead-status = c_a.
          LEAVE TO SCREEN 0.
        ENDIF.
      ENDIF.
    If the user presses the 'DISPLAY SPOOL' Button
      IF sy-ucomm = 'DISPLAY'.
        PERFORM display_spool.
      ENDIF.
    If the user presses the 'JOB STATUS' Button
      IF sy-ucomm = 'STATUS'.
        PERFORM display_status.
      ENDIF.
    If the user presses the 'JOB LOG' Button
      IF sy-ucomm = 'JOBLOG'.
        PERFORM display_job_log.
      ENDIF.
    *&      Form  open_job
          text
    -->  p1        text
    <--  p2        text
    FORM open_job .
    This is to Create a new job which is to be submitted in background to
    process sales order/delivery/invoice
    Here we would get a unique id ( Jobcount ) which identifies our job
    along with the job name which we have assigned to our job
      CONCATENATE sy-uname
                  sy-datum
                  sy-uzeit
                          INTO w_jobname .  " Assign unique jobname
      CALL FUNCTION 'JOB_OPEN'
       EXPORTING
      DELANFREP              = ' '
      JOBGROUP               = ' '
        jobname                = w_jobname
      SDLSTRTDT              = NO_DATE
      SDLSTRTTM              = NO_TIME
      JOBCLASS               =
      IMPORTING
       jobcount                = w_jobcount
    CHANGING
      RET                    =
    EXCEPTIONS
       cant_create_job        = 1
       invalid_job_data       = 2
       jobname_missing        = 3
       OTHERS                 = 4
      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.                    " open_job
    *&      Form  get_print_parameters
          text
    -->  p1        text
    <--  p2        text
    FORM get_print_parameters .
      DATA : l_valid TYPE c.
    This is to get the Print Parameters for the job which is to be
    submitted in background to process sales order/delivery/invoice
      CALL FUNCTION 'GET_PRINT_PARAMETERS'
       EXPORTING
      ARCHIVE_ID                   = C_CHAR_UNKNOWN
      ARCHIVE_INFO                 = C_CHAR_UNKNOWN
      ARCHIVE_MODE                 = C_CHAR_UNKNOWN
      ARCHIVE_TEXT                 = C_CHAR_UNKNOWN
      AR_OBJECT                    = C_CHAR_UNKNOWN
      ARCHIVE_REPORT               = C_CHAR_UNKNOWN
      AUTHORITY                    = C_CHAR_UNKNOWN
      COPIES                       = C_NUM3_UNKNOWN
      COVER_PAGE                   = C_CHAR_UNKNOWN
      DATA_SET                     = C_CHAR_UNKNOWN
      DEPARTMENT                   = C_CHAR_UNKNOWN
          destination                  = c_locl " LOCL
      EXPIRATION                   = C_NUM1_UNKNOWN
          immediately                  = space
      IN_ARCHIVE_PARAMETERS        = ' '
      IN_PARAMETERS                = ' '
      LAYOUT                       = C_CHAR_UNKNOWN
      LINE_COUNT                   = C_INT_UNKNOWN
      LINE_SIZE                    = C_INT_UNKNOWN
      LIST_NAME                    = C_CHAR_UNKNOWN
      LIST_TEXT                    = C_CHAR_UNKNOWN
      MODE                         = ' '
          new_list_id                  = c_x
      PROTECT_LIST                 = C_CHAR_UNKNOWN
          no_dialog                    = c_x
      RECEIVER                     = C_CHAR_UNKNOWN
      RELEASE                      = C_CHAR_UNKNOWN
      REPORT                       = C_CHAR_UNKNOWN
      SAP_COVER_PAGE               = C_CHAR_UNKNOWN
      HOST_COVER_PAGE              = C_CHAR_UNKNOWN
      PRIORITY                     = C_NUM1_UNKNOWN
      SAP_OBJECT                   = C_CHAR_UNKNOWN
      TYPE                         = C_CHAR_UNKNOWN
          user                         = sy-uname
      USE_OLD_LAYOUT               = ' '
      UC_DISPLAY_MODE              = C_CHAR_UNKNOWN
      DRAFT                        = C_CHAR_UNKNOWN
      ABAP_LIST                    = ' '
      USE_ARCHIVENAME_DEF          = ' '
      DEFAULT_SPOOL_SIZE           = C_CHAR_UNKNOWN
      PO_FAX_STORE                 = ' '
      NO_FRAMES                    = C_CHAR_UNKNOWN
       IMPORTING
      OUT_ARCHIVE_PARAMETERS       =
          out_parameters               = wa_params
       valid                        = l_valid
       EXCEPTIONS
         archive_info_not_found       = 1
         invalid_print_params         = 2
         invalid_archive_params       = 3
         OTHERS                       = 4
      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.                    " get_print_parameters
    *&      Form  job_submit
          text
    -->  p1        text
    <--  p2        text
    FORM job_submit .
    The job which we have created & the unique id ( jobcount ) which we
    have got identifies our job. Hence those parameters are passed along
    with the name of the background program "ZPROGRAM_TWO"
    The job is submitted in background.
      CALL FUNCTION 'JOB_SUBMIT'
        EXPORTING
      ARCPARAMS                         =
        authcknam                         = sy-uname
      COMMANDNAME                       = ' '
      OPERATINGSYSTEM                   = ' '
      EXTPGM_NAME                       = ' '
      EXTPGM_PARAM                      = ' '
      EXTPGM_SET_TRACE_ON               = ' '
      EXTPGM_STDERR_IN_JOBLOG           = 'X'
      EXTPGM_STDOUT_IN_JOBLOG           = 'X'
      EXTPGM_SYSTEM                     = ' '
      EXTPGM_RFCDEST                    = ' '
      EXTPGM_WAIT_FOR_TERMINATION       = 'X'
        jobcount                          = w_jobcount
        jobname                           = w_jobname
      LANGUAGE                          = SY-LANGU
        priparams                         = wa_params
        report                            = 'ZPROGRAM_TWO'
      VARIANT                           = ' '
    IMPORTING
      STEP_NUMBER                       =
       EXCEPTIONS
         bad_priparams                     = 1
         bad_xpgflags                      = 2
         invalid_jobdata                   = 3
         jobname_missing                   = 4
         job_notex                         = 5
         job_submit_failed                 = 6
         lock_failed                       = 7
         program_missing                   = 8
         prog_abap_and_extpg_set           = 9
         OTHERS                            = 10
      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.                    " job_submit
    *&      Form  job_close
          text
    -->  p1        text
    <--  p2        text
    FORM job_close .
    Once the job is submitted in background then the job is closed
      CALL FUNCTION 'JOB_CLOSE'
        EXPORTING
      AT_OPMODE                         = ' '
      AT_OPMODE_PERIODIC                = ' '
      CALENDAR_ID                       = ' '
      EVENT_ID                          = ' '
      EVENT_PARAM                       = ' '
      EVENT_PERIODIC                    = ' '
        jobcount                          = w_jobcount
        jobname                           = w_jobname
      LASTSTRTDT                        = NO_DATE
      LASTSTRTTM                        = NO_TIME
      PRDDAYS                           = 0
      PRDHOURS                          = 0
      PRDMINS                           = 0
      PRDMONTHS                         = 0
      PRDWEEKS                          = 0
      PREDJOB_CHECKSTAT                 = ' '
      PRED_JOBCOUNT                     = ' '
      PRED_JOBNAME                      = ' '
      SDLSTRTDT                         = NO_DATE
      SDLSTRTTM                         = NO_TIME
      STARTDATE_RESTRICTION             = BTC_PROCESS_ALWAYS
        strtimmed                         = c_x
      TARGETSYSTEM                      = ' '
      START_ON_WORKDAY_NOT_BEFORE       = SY-DATUM
      START_ON_WORKDAY_NR               = 0
      WORKDAY_COUNT_DIRECTION           = 0
      RECIPIENT_OBJ                     =
      TARGETSERVER                      = ' '
      DONT_RELEASE                      = ' '
      TARGETGROUP                       = ' '
      DIRECT_START                      =
    IMPORTING
      JOB_WAS_RELEASED                  =
    CHANGING
      RET                               =
       EXCEPTIONS
         cant_start_immediate              = 1
         invalid_startdate                 = 2
         jobname_missing                   = 3
         job_close_failed                  = 4
         job_nosteps                       = 5
         job_notex                         = 6
         lock_failed                       = 7
         invalid_target                    = 8
         OTHERS                            = 9
      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.                    " job_close
    *&      Form  display_spool
          text
    -->  p1        text
    <--  p2        text
    FORM display_spool .
    To Read the Job to get the spool details
      DATA : l_rqident TYPE tsp01-rqident, " Spool Number
             l_spoolno TYPE tsp01_sp0r-rqid_char.
      CLEAR : l_rqident,
              w_lsind,
              wa_jobsteplist.
      REFRESH : i_jobsteplist.
      SET PF-STATUS 'ZAR02'.
    Get the Spool Number
      CALL FUNCTION 'BP_JOB_READ'
        EXPORTING
          job_read_jobcount           = w_jobcount
          job_read_jobname            = w_jobname
          job_read_opcode             = '20'
        JOB_STEP_NUMBER             =
       IMPORTING
         job_read_jobhead            = wa_jobhead
       TABLES
         job_read_steplist           = i_jobsteplist
    CHANGING
       RET                         =
       EXCEPTIONS
         invalid_opcode              = 1
         job_doesnt_exist            = 2
         job_doesnt_have_steps       = 3
         OTHERS                      = 4
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Read the Job Step list to get the spool number
      READ TABLE i_jobsteplist INTO wa_jobsteplist INDEX 1.
      CHECK wa_jobsteplist-listident <> space.
    Spool Number
      l_rqident = wa_jobsteplist-listident.
      MOVE l_rqident TO l_spoolno.
    Check the spool in TSP01
      SELECT SINGLE * FROM tsp01 WHERE rqident = l_rqident.
      IF  sy-subrc = 0.
        LEAVE TO LIST-PROCESSING.
        CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
          EXPORTING
            spoolid       = l_spoolno
        IMPORTING
          RC            =
          STATUS        =
        PERFORM show_alv.
      ENDIF.
      w_lsind = sy-lsind.
      IF sy-lsind GE 19.
        sy-lsind = 1.
      ENDIF.
    ENDFORM.                    " display_spool
    *&      Form  show_alv
          text
    -->  p1        text
    <--  p2        text
    FORM show_alv .
    Before the import, fill the data fields before CLUSTR.
      wa_index1-aedat = sy-datum.
      wa_index1-usera = sy-uname.
    To Import the selection screen data from Calling Program
      IMPORT i_mara
      FROM DATABASE indx(st) ID wa_index_key1 TO wa_index1.
      FREE MEMORY ID wa_index_key1.
    This prepares the field-catalog for ALV.
      PERFORM prepare_fieldcatalog.
    This displays the output in  ALV format .
      PERFORM display_alv.
    ENDFORM.                    " show_alv
    *&      Form  display_status
          text
    -->  p1        text
    <--  p2        text
    FORM display_status .
    To Display the STATUS of the JOB which is exectued in background
      CLEAR : wa_jobsteplist.
      REFRESH : i_jobsteplist.
      WRITE:/ 'DISPLAYING JOB STATUS'.
      CALL FUNCTION 'BP_JOB_READ'
        EXPORTING
          job_read_jobcount           = w_jobcount
          job_read_jobname            = w_jobname
          job_read_opcode             = '20'
        JOB_STEP_NUMBER             =
       IMPORTING
         job_read_jobhead            = wa_jobhead
       TABLES
         job_read_steplist           = i_jobsteplist
    CHANGING
       RET                         =
       EXCEPTIONS
         invalid_opcode              = 1
         job_doesnt_exist            = 2
         job_doesnt_have_steps       = 3
         OTHERS                      = 4
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    To Display the status text as per the status type
      CASE wa_jobhead-status.
        WHEN 'S'. WRITE: / 'Scheduled'.
        WHEN 'R'. WRITE: / 'Released'.
        WHEN 'F'. WRITE: / 'Completed'.
        WHEN 'A'. WRITE: / 'Cancelled'.
        WHEN OTHERS.
      ENDCASE.
      IF sy-lsind GE 19.
        sy-lsind = 1.
      ENDIF.
    ENDFORM.                    " display_status
    *&      Form  display_job_log
          text
    -->  p1        text
    <--  p2        text
    FORM display_job_log .
    To display the log of the background program
      LEAVE TO LIST-PROCESSING.
      CALL FUNCTION 'BP_JOBLOG_SHOW_SM37B'
        EXPORTING
          client                    = sy-mandt
          jobcount                  = w_jobcount
          joblogid                  = ' '
          jobname                   = w_jobname
        EXCEPTIONS
          error_reading_jobdata     = 1
          error_reading_joblog_data = 2
          jobcount_missing          = 3
          joblog_does_not_exist     = 4
          joblog_is_empty           = 5
          joblog_show_canceled      = 6
          jobname_missing           = 7
          job_does_not_exist        = 8
          no_joblog_there_yet       = 9
          no_show_privilege_given   = 10
          OTHERS                    = 11.
      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.                    " display_job_log
    *&      Form  prepare_fieldcatalog
          text
    -->  p1        text
    <--  p2        text
    FORM prepare_fieldcatalog .
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname    = 'MATNR'.
      wa_fieldcat-tabname      = 'I_MARA'.
      wa_fieldcat-reptext_ddic = 'Material no.'.
      wa_fieldcat-outputlen    = '18'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname    = 'ERSDA'.
      wa_fieldcat-tabname      = 'I_MARA'.
      wa_fieldcat-reptext_ddic = 'Creation date'.
      wa_fieldcat-outputlen    = '10'.
      APPEND  wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname    = 'ERNAM'.
      wa_fieldcat-tabname      = 'I_MARA'.
      wa_fieldcat-reptext_ddic = 'Name of Person'.
      wa_fieldcat-outputlen    = '10'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname    = 'LAEDA'.
      wa_fieldcat-tabname      = 'I_MARA'.
      wa_fieldcat-reptext_ddic = ' Last Change'.
      wa_fieldcat-outputlen    = '10'.
      APPEND  wa_fieldcat TO i_fieldcat.
    ENDFORM.                    " prepare_fieldcatalog
    *&      Form  display_alv
          text
    -->  p1        text
    <--  p2        text
    FORM display_alv .
    Call ABAP List Viewer (ALV)
      call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
          it_fieldcat  = i_fieldcat
        tables
          t_outtab     = i_mara.
    ENDFORM.                    " display_alv
    •     ZPROGRAM_TWO: This is the 2nd program which would be called from program ZPROGRAM_ONE.
    *& Report  ZPROGRAM_TWO                                                *
    REPORT  zprogram_two                            .
    PRASHANT PATIL
    TABLES : mara.
    TYPE-POOLS:slis.
    TYPES : BEGIN OF t_mara,
              matnr   TYPE mara-matnr,
              ersda   TYPE mara-ersda,
              ernam   TYPE mara-ernam,
              laeda   TYPE mara-laeda,
            END OF t_mara.
    DATA : i_mara        TYPE STANDARD TABLE OF t_mara,
           wa_mara       TYPE t_mara,
           wa_index      TYPE indx,        " For Index details
           wa_index_key  TYPE indx-srtfd VALUE 'PRG_ONE',
           wa_index1     TYPE indx,        " For Index details
           wa_index_key1 TYPE indx-srtfd VALUE 'PRG_TWO',
           i_fieldcat        TYPE slis_t_fieldcat_alv,
           wa_fieldcat       LIKE LINE OF i_fieldcat.
    SELECT-OPTIONS : s_matnr FOR mara-matnr.
    Before the import, fill the data fields before CLUSTR.
    wa_index-aedat = sy-datum.
    wa_index-usera = sy-uname.
    To Import the selection screen data from Calling Program
    IMPORT s_matnr
    FROM DATABASE indx(st) ID wa_index_key TO wa_index.
    FREE MEMORY ID wa_index_key.
    SELECT matnr
           ersda
           ernam
           laeda
           FROM mara
           INTO TABLE i_mara
           WHERE matnr IN s_matnr.
    PERFORM prepare_fieldcatalog.
    PERFORM display_alv.
    Before the export, fill the data fields before CLUSTR
    wa_index1-aedat = sy-datum.
    wa_index1-usera = sy-uname.
    EXPORT i_mara
    TO DATABASE indx(st) FROM wa_index1 ID wa_index_key1.
    *&      Form  prepare_fieldcatalog
          text
    -->  p1        text
    <--  p2        text
    FORM prepare_fieldcatalog .
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname    = 'MATNR'.
      wa_fieldcat-tabname      = 'I_MARA'.
      wa_fieldcat-outputlen    = '18'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname    = 'ERSDA'.
      wa_fieldcat-tabname      = 'I_MARA'.
      wa_fieldcat-outputlen    = '10'.
      APPEND  wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname    = 'ERNAM'.
      wa_fieldcat-tabname      = 'I_MARA'.
      wa_fieldcat-outputlen    = '10'.
      APPEND wa_fieldcat TO i_fieldcat.
      CLEAR wa_fieldcat.
      wa_fieldcat-fieldname    = 'LAEDA'.
      wa_fieldcat-tabname      = 'I_MARA'.
      wa_fieldcat-outputlen    = '10'.
      APPEND  wa_fieldcat TO i_fieldcat.
    ENDFORM.                    " prepare_fieldcatalog
    *&      Form  display_alv
          text
    -->  p1        text
    <--  p2        text
    FORM display_alv .
    Call ABAP List Viewer (ALV)
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          it_fieldcat = i_fieldcat
        TABLES
          t_outtab    = i_mara.
    ENDFORM.                    " display_alv
    its possible to display ALV Grid using OO ALV. Following code can be used instead of FM.
    In the PBO, add following code
    SET PF-STATUS 'ZSTAT'.
    If program is executed in background
    CALL METHOD cl_gui_alv_grid=>offline
    RECEIVING
    e_offline = off.
    IF off IS INITIAL.
    IF container1 IS INITIAL.
    CREATE OBJECT container1
    EXPORTING
    container_name = 'CC_ALV1' .
    ENDIF.
    ENDIF.
    CREATE OBJECT g_grid1
    EXPORTING
    i_parent = container1.
    CALL METHOD g_grid1->set_table_for_first_display
    EXPORTING
    I_BUFFER_ACTIVE =
    I_BYPASSING_BUFFER =
    I_CONSISTENCY_CHECK =
    I_STRUCTURE_NAME =
    IS_VARIANT =
    i_save = 'A'
    i_default = ' '
    is_layout =
    is_print =
    IT_SPECIAL_GROUPS =
    it_toolbar_excluding =
    IT_HYPERLINK =
    IT_ALV_GRAPHICS =
    IT_EXCEPT_QINFO =
    CHANGING
    it_outtab = i_output
    it_fieldcatalog = i_fieldcatalog
    IT_SORT =
    IT_FILTER =
    EXCEPTIONS
    invalid_parameter_combination = 1
    program_error = 2
    too_many_lines = 3
    OTHERS = 4
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    Reward points if useful
    Regards
    Anji

  • Run ALV in Background JOB (DUMP)

    HI Experts,
    Before post  i have already  look at this forum and tried many solutions , im on  SAPGUI 7.20 and already creatde a doc container... so nothing has work yet...
    Im trying to run a alv report in a  scheduled JOB...!!
    Below the Dump Description and My source code...!
    Many Thanks for any help..!!!!
    DUMP.
    Short text
        Exception condition "CNTL_ERROR" raised.
    What happened?
        The current ABAP/4 program encountered an unexpected
        situation.
    What can you do?
        Note down which actions and inputs caused the error.
        To process the problem further, contact you SAP system
        administrator.
        Using Transaction ST22 for ABAP Dump Analysis, you can look
        at and manage termination messages, and you can also
        keep them for a long time.
    Error analysis
        A RAISE statement in the program "CL_GUI_CONTROL================CP" raised the
         exception
        condition "CNTL_ERROR".
        Since the exception was not intercepted by a superior
        program, processing was terminated.
        Short description of exception condition:
        For detailed documentation of the exception condition, use
        Transaction SE37 (Function Library). You can take the called
        function module from the display of active calls.
    How to correct the error
        If the error occures in a non-modified SAP program, you may be able to
        find an interim solution in an SAP Note.
        If you have access to SAP Notes, carry out a search with the following
        keywords:
    SOURCE CODE:
    DATA: gro_doc_container     TYPE REF TO cl_gui_docking_container,
            w_off                 TYPE  INT4.
      IF w_1c_container IS INITIAL.
      CALL METHOD cl_gui_alv_grid=>offline
       RECEIVING e_offline = w_off.
    IF NOT w_off is initial.
        CREATE OBJECT w_1obj_alv
                 EXPORTING i_parent = gro_doc_container .
      else.
          CREATE OBJECT w_1c_container
            EXPORTING
              container_name = c_1alv.
          CREATE OBJECT w_1obj_alv
            EXPORTING
              i_parent = w_1c_container.
        ENDIF.
        CREATE OBJECT w_event_receiver.
        SET HANDLER: w_event_receiver->handle_data_changed FOR w_1obj_alv,
                     w_event_receiver->handle_toolbar FOR w_1obj_alv,
                     w_event_receiver->handle_user_command FOR w_1obj_alv.
        CALL METHOD w_1obj_alv->register_edit_event
          EXPORTING
            i_event_id = cl_gui_alv_grid=>mc_evt_modified.
        CALL METHOD w_1obj_alv->set_table_for_first_display
          EXPORTING
            i_save               = c_a
            is_layout            = e_1layout
            is_variant           = e_1variant
            it_toolbar_excluding = is_1func
            i_structure_name     = c_1strucs1
          CHANGING
            it_outtab            = is_1pant
            it_fieldcatalog      = is_1fcat[].

    HI ,
    The ALV grid will not work in background. You need to check sy-batch (for background processing ) and write a seperate code .
    The better way of doing is to use SALV factory methods - It works both in background and foreground modes.
    Remember It will work on ECC and it doesnot support editable ALV directly.
    For Demo program  SALV_DEMO* and F4
    Hope this brings clarity and neccassary help to you.

  • Error while running a job in background

    Hi,
      I got the following error message while running the job in background.
    "Step 001 started .
    Control Framework: Fatal error - GUI cannot be reached.
    ABAP/4 processor: RAISE_EXCEPTION
    Job cancelled"
    What is the reason for this error and how to correct it?

    ALV Grid control is based on the custom controls on the screen. When the program is scheduled in background, it tries to create GUI related front-end objects and hence the error u201CFatal Error u2013 GUI cannot be reachedu201D. This type of problem is common with all the programs that use the ALV grid control to display the output.
    Solution:
    Whenever we execute this type of programs in background, we should be passing a blank docking container instead of the custom container as parent to our grid control. 
    The docking container doesnu2019t need any of the custom controls on the screen; instead it attaches an area to any or all of the four edges of the screen (top, left, right or bottom). The behavior of the areas in the container is determined by the sequence in which they are initialized. Docking Containers are attached to the screen from the inside out. This means that when you create a second container, it is attached to the edge of the screen, and the container that was already there is pushed outwards. 
    Let us modify the standard program (by taking a copy of it) to enable it to execute it in background.
    Following modifications have to be made:
    ·        Define a docking container in the program
    data: or_doc  type ref to cl_gui_docking_container .
    ·        At the time of creating a custom container, check if the program is being executed in background or foreground. If the program is scheduled in background, then create a docking container instead of custom container.
    if cl_gui_alv_grid=>offline( ) is initial.
        create object or_custom_container
               exporting container_name = c_container.
      create object or_grid
             exporting i_parent = or_custom_container.
    else .
    create object or_grid
             exporting i_parent = or_doc .
    endif . 
    Now test executing the program in background. The report would be generated.

  • Regarding making hyperlink in OOPs ALV

    Please see the following ALV Code. Its based on OOPs. There is no fieldcatalog defined in the program. In the output I want to make a hotspot on the filed VBELN & want to call T.code VA03 using SET PARAMETER ID. Please help. If I would have made it through Function Modules, It could have been easier as I can modify the fieldcatalog. Please help me urgently. Points will be rewarded.
    *& Report  ZTEST_OOPS_REPT1                                            *
    REPORT  ztest_oops_rept1                        .
    Type pool for icons - used in the toolbar
    TYPE-POOLS: icon.
    TYPE-POOLS: slis.
    TABLES: vbak.
    To allow the declaration of o_event_receiver before the
    lcl_event_receiver class is defined, decale it as deferred in the
    start of the program
    CLASS lcl_event_receiver DEFINITION DEFERRED.
    G L O B A L   I N T E R N  A L   T A B L E S
    *DATA: gi_sflight TYPE STANDARD TABLE OF sflight.
    To include a traffic light and/or color a line the structure of the
    table must include fields for the traffic light and/or the color
    TYPES: BEGIN OF st_vbak.
            INCLUDE STRUCTURE vbak.
    TYPES: END OF st_vbak.
    TYPES: tt_vbak TYPE STANDARD TABLE OF st_vbak.
    DATA: gi_vbak TYPE tt_vbak.
    *declaration for fieldcatalog
    DATA: lit_fieldcat TYPE slis_t_fieldcat_alv,
        ls_fieldcat  TYPE slis_fieldcat_alv.
    G L O B A L   D A T A
    DATA: ok_code         LIKE sy-ucomm,
        Work area for internal table
          g_wa_vbak    TYPE st_vbak,
        ALV control: Layout structure
          gs_layout       TYPE lvc_s_layo.
    Declare reference variables to the ALV grid and the container
    DATA:
      go_grid             TYPE REF TO cl_gui_alv_grid,
      go_custom_container TYPE REF TO cl_gui_custom_container,
      o_event_receiver    TYPE REF TO lcl_event_receiver.
    DATA:
    Work area for screen 200
      g_screen200 LIKE vbak.
    Data for storing information about selected rows in the grid
    DATA:
    Internal table
      gi_index_rows TYPE lvc_t_row,
    Information about 1 row
      g_selected_row LIKE lvc_s_row.
                            SELECTION-SCREEN                             *
    SELECTION-SCREEN BEGIN OF BLOCK ch1 WITH FRAME.
    SELECT-OPTIONS:  s_vbeln FOR vbak-vbeln OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK ch1.
    C L A S S E S
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS:
         handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
           IMPORTING
             e_object e_interactive,
         handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
           IMPORTING e_ucomm.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
          CLASS lcl_event_receiver IMPLEMENTATION
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_toolbar.
    Event handler method for event toolbar.
        CONSTANTS:
    Constants for button type
          c_button_normal           TYPE i VALUE 0,
          c_menu_and_default_button TYPE i VALUE 1,
          c_menu                    TYPE i VALUE 2,
          c_separator               TYPE i VALUE 3,
          c_radio_button            TYPE i VALUE 4,
          c_checkbox                TYPE i VALUE 5,
          c_menu_entry              TYPE i VALUE 6.
        DATA:
            ls_toolbar  TYPE stb_button.
      Append seperator to the normal toolbar
        CLEAR ls_toolbar.
        MOVE c_separator TO ls_toolbar-butn_type..
        APPEND ls_toolbar TO e_object->mt_toolbar.
      Append a new button that to the toolbar. Use E_OBJECT of
      event toolbar. E_OBJECT is of type CL_ALV_EVENT_TOOLBAR_SET.
      This class has one attribute MT_TOOLBAR which is of table type
      TTB_BUTTON. The structure is STB_BUTTON
        CLEAR ls_toolbar.
        MOVE 'CHANGE'        TO ls_toolbar-function.
        MOVE  icon_change    TO ls_toolbar-icon.
        MOVE 'Change flight' TO ls_toolbar-quickinfo.
        MOVE 'Change'        TO ls_toolbar-text.
        MOVE ' '             TO ls_toolbar-disabled.
        APPEND ls_toolbar    TO e_object->mt_toolbar.
      ENDMETHOD.                    "handle_toolbar
      METHOD handle_user_command.
      Handle own functions defined in the toolbar
        CASE e_ucomm.
          WHEN 'CHANGE'.
            PERFORM change_flight.
           LEAVE TO SCREEN 0.
        ENDCASE.
      ENDMETHOD.                    "handle_user_command
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    S T A R T - O F - S E L E C T I O N.
    START-OF-SELECTION.
      SET SCREEN '100'.
    *&      Module  USER_COMMAND_0100  INPUT
    MODULE user_command_0100 INPUT.
      CASE ok_code.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  STATUS_0100  OUTPUT
    MODULE status_0100 OUTPUT.
      SET PF-STATUS 'ZTEST_ALV'.
      SET TITLEBAR 'ZTEST_ALV'.
      DATA:
      For parameter IS_VARIANT that is sued to set up options for storing
      the grid layout as a variant in method set_table_for_first_display
        l_layout TYPE disvariant,
      Utillity field
        l_lines TYPE i.
    After returning from screen 200 the line that was selected before
    going to screen 200, should be selected again. The table gi_index_rows
    was the output table from the GET_SELECTED_ROWS method in form
    CHANGE_FLIGHT
      DESCRIBE TABLE gi_index_rows LINES l_lines.
      IF l_lines > 0.
        CALL METHOD go_grid->set_selected_rows
          EXPORTING
            it_index_rows = gi_index_rows.
        CALL METHOD cl_gui_cfw=>flush.
        REFRESH gi_index_rows.
      ENDIF.
    Read data and create objects
      IF go_custom_container IS INITIAL.
      Read data from datbase table
        PERFORM get_data.
      Create objects for container and ALV grid
        CREATE OBJECT go_custom_container
          EXPORTING container_name = 'ALV_CONTAINER'.
        CREATE OBJECT go_grid
          EXPORTING
            i_parent = go_custom_container.
      Create object for event_receiver class
      and set handlers
        CREATE OBJECT o_event_receiver.
        SET HANDLER o_event_receiver->handle_user_command FOR go_grid.
        SET HANDLER o_event_receiver->handle_toolbar FOR go_grid.
      Layout (Variant) for ALV grid
        l_layout-report = sy-repid. "Layout fo report
    Setup the grid layout using a variable of structure lvc_s_layo
      Set grid title
        gs_layout-grid_title = 'SALES ORDER'.
      Selection mode - Single row without buttons
      (This is the default  mode
        gs_layout-sel_mode = 'B'.  "B for single selection.
      Grid setup for first display
        CALL METHOD go_grid->set_table_for_first_display
          EXPORTING
            i_structure_name = 'VBAK'
            is_variant       = l_layout
            i_save           = 'A'
            is_layout        = gs_layout
          CHANGING
            it_outtab        = gi_vbak.
    *-- End of grid setup -
      Raise event toolbar to show the modified toolbar
        CALL METHOD go_grid->set_toolbar_interactive.
      Set focus to the grid. This is not necessary in this
      example as there is only one control on the screen
        CALL METHOD cl_gui_control=>set_focus
          EXPORTING
            control = go_grid.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0200  INPUT
          text
    MODULE user_command_0200 INPUT.
      CASE ok_code.
        WHEN 'BACK'.
          LEAVE TO SCREEN 100.
          WHEN'SAVE'.
          PERFORM save_changes.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0200  INPUT
    *&      Form  get_data
          text
    FORM get_data.
    Read data from table VBAK
      SELECT *
        FROM vbak
        INTO TABLE gi_vbak
        WHERE vbeln IN s_vbeln.
    ENDFORM.                    " load_data_into_grid
    *&      Form  change_flight
    Reads the contents of the selected row in the grid, ans transfers
    the data to screen 200, where it can be changed and saved.
    FORM change_flight.
      DATA:l_lines TYPE i.
      REFRESH gi_index_rows.
      CLEAR   g_selected_row.
    Read index of selected rows
      CALL METHOD go_grid->get_selected_rows
        IMPORTING
          et_index_rows = gi_index_rows.
    Check if any row are selected at all. If not
    table  gi_index_rows will be empty
      DESCRIBE TABLE gi_index_rows LINES l_lines.
      IF l_lines = 0.
        CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
          EXPORTING
            textline1 = 'You must choose a line'.
        EXIT.
      ENDIF.
    Read indexes of selected rows. In this example only one
    row can be selected as we are using gs_layout-sel_mode = 'B',
    so it is only ncessary to read the first entry in
    table gi_index_rows
      LOOP AT gi_index_rows INTO g_selected_row.
        IF sy-tabix = 1.
          READ TABLE gi_vbak INDEX g_selected_row-index
           INTO g_wa_vbak.
        ENDIF.
      ENDLOOP.
    Transfer data from the selected row to screenm 200 and show
    screen 200
      CLEAR g_screen200.
      MOVE-CORRESPONDING g_wa_vbak TO g_screen200.
      LEAVE TO SCREEN '200'.
    ENDFORM.                    " change_flight
    *&      Form  save_changes
    Changes made in screen 200 are written to the datbase table
    zsflight, and to the grid table gi_sflight, and the grid is
    updated with method refresh_table_display to display the changes
    FORM save_changes.
    Update traffic light field
    Update database table
      MODIFY vbak FROM g_screen200.
    Refresh grid
      CALL METHOD go_grid->refresh_table_display.
      CALL METHOD cl_gui_cfw=>flush.
      LEAVE TO SCREEN '100'.
    ENDFORM.                    " save_changes
    *&      Module  STATUS_0200  OUTPUT
          text
    MODULE status_0200 OUTPUT.
      SET PF-STATUS 'ZTEST_ALV'.
      SET TITLEBAR 'ZTEST_ALV'.
    ENDMODULE.                 " STATUS_0200  OUTPUT
                     " lit_fieldcat_init

    Use FM -LVC_FIELDCATALOG_MERGE to derive the field catalog for table VBAK. It will give you the field catalog. You can modify the column VBELN  by changing HOTSPOT = 'X".
    and in your code - at the method SET_TABLE_FOR....DISPLAY , you comment out the structure name and pass the modified field catalog.
    Hope it helps.

  • ALV in background

    I am running a ALV report in background and in the spool noticed that one of my column is truncated. When i changed to the Column heading to more characters ....i notice that the output is fine....( field catalog was built by using the FM)
    I am not able to understand what could cause problem.....
    can anyone explain what could be the issue.....

    Whether it is background or foreground if any of the field value is more than what it is defined it will be truncated.So always declare with maximum characters, so that it will not be a problem.
        Actually ALV will take the header as count while printing in spool.
    Reward points if helpful.
    RamaKrishna C

  • Running Workflow step in Background & code inside doing Foreground proceing

    Hi all,
    I am extracting an attachment (file) from DMS (document management services: txn: CV02N) to the presentation server in Background Mode.  Again my Function Module is uploading the file in the forground Mode and at this point workflow is giving error about the presentation server. 
    Please can anyone help me if what am doing is wrong, and if yes then what would be the proper solution.
    Thanx in advance.  Points will be provided for sure
    Anand

    Hi Mike,
    Thank you so much for your help. 
    I will try to explain you the problem.
    The problem is I need to extract the contents of file attached to DMS, which is available only as a link, so using the BAPI_*CHECKOUTVIEW I need to download it on the presentation server so that file / attachment will be available on presentation server and then I can upload the file / attachment in SAP and will read its content in internal table.
    Now the problem is I am using above FM in a Workflow method.  Workflow is doing the processing via WF-BATCH which is a background user by default.  Now the question is
    1) How can i get the file / attachement from the link in the DMS in the background mode and again upload it in SAP in the background mode??  (I tried it but the only BAPI i found is given above, which is creating a local file based on the link in DMS)
                                                   OR
    2) How can I run / test the workflow in foreground mode(by default WF-BATCH (system) is running the workflow in background mode).  But then it is always advisable to run the workflow in background mode until an agent assignment (user interaction) is necessary.  And I guess whosoever will run workflow , it will run by system user only, which is background user.
                                                   OR
    Any other solution you can think of.

  • Perform setting OOP ALV for multiple reports using Field Symbols

    Hi, Abapers ... i try to write a programme which using ONE oop ALV but 2 different structure internal table. the last result should be 2 radio button. first button is r_wbs and 2ns r_kpi. r_wbs will display 4 column answer and r_kpi will display 10 columns answer with different column name. i successfully implemented using FIELDS SYMBOLS but the problems i failed to perform customized setting forALV (report's tittle, column name, different layout etc)  for 2 different reports.  this is the programme. Please Give Opinion, simple example will be more helpful. Thanks You Very Much
    *&this report experimental how to print into ONE alv
    *&with 2 diffrent structure internal table
    REPORT  zfiroopalv.
    SELECTION-SCREEN BEGIN OF BLOCK mode WITH FRAME TITLE text-002.
    PARAMETERS r_wbs RADIOBUTTON GROUP mode DEFAULT 'X'.
    PARAMETERS r_kpi RADIOBUTTON GROUP mode.
    SELECTION-SCREEN END OF BLOCK mode.
    CLASS lcl_main DEFINITION.
    PUBLIC SECTION.
    CLASS-DATA: md_wbs TYPE c LENGTH 1.
    METHODS: process,
             write.
    DATA: mdo_data TYPE REF TO data.
    TYPES: BEGIN OF st_wbs,
    rsnum TYPE zmeime002a-rsnum,
    rspos TYPE zmeime002a-rspos,
    a TYPE zmmgitab01-menge,
    b TYPE zmeime002a-bdmng,
    c TYPE zmeime002a-bdmng,
    d TYPE zmeime002a-bdmng,
    e TYPE zmeime002a-bdmng,
    f TYPE zmmgitab01-menge,
    g TYPE zmmgitab01-menge,
    END OF st_wbs.
    TYPES: BEGIN OF st_kpi,
    regio TYPE zmeime002a-regio,
    gsber TYPE zmeime002a-gsber,
    gtext TYPE zmeime002a-gtext,
    x TYPE zmmgitab01-menge,
    y TYPE zmmgitab01-menge,
    z TYPE zmmgitab01-menge,
    END OF st_kpi.
    CLASS-DATA: it_wbs TYPE TABLE OF st_wbs,
                wa_wbs LIKE LINE OF it_wbs.
    CLASS-DATA: it_kpi TYPE TABLE OF st_kpi,
                wa_kpi LIKE LINE OF it_kpi.
    PRIVATE SECTION.
    DATA: set_display_setting TYPE REF TO cl_salv_table.
    DATA: display_settings TYPE REF TO cl_salv_display_settings.
    DATA: salv_table TYPE REF TO cl_salv_table.
    DATA: error TYPE REF TO cx_root.
    DATA: errtext TYPE string.
    ENDCLASS.
    CLASS lcl_kpi DEFINITION INHERITING FROM lcl_main.
    PUBLIC SECTION.
    METHODS: process_kpi.
    PRIVATE SECTION.
    ENDCLASS.
    * C.L.A.S.S lcl_main D.E.F.I.N.I.T.I.O.N
    CLASS lcl_wbs DEFINITION INHERITING FROM lcl_main.
    PUBLIC SECTION.
    METHODS: process_wbs.
    PRIVATE SECTION.
    ENDCLASS.
    * m.a.i.n. .p.r.o.g.r.a.m.
    START-OF-SELECTION.
      DATA: o_main TYPE REF TO lcl_main.
    DATA: p_wbs TYPE c.
    CREATE OBJECT o_main.
      CASE 'X'.
      WHEN r_wbs.
          o_main->md_wbs = 'X'.
      WHEN r_kpi.
          o_main->md_wbs = ' '.
      ENDCASE.
      o_main->process( ).
      o_main->write( ).
    CLASS lcl_main IMPLEMENTATION.
    *ENDMETHOD.
    METHOD process.  " NOTE: public method
    DATA: o_main TYPE REF TO lcl_main,
          o_wbs TYPE REF TO lcl_wbs,
          o_kpi TYPE REF TO lcl_kpi.
    CREATE OBJECT: o_wbs,o_kpi.
      IF ( me->md_wbs = 'X' ).
          CALL METHOD o_wbs->process_wbs( ).  " NOTE: private method
          GET REFERENCE OF me->it_wbs INTO me->mdo_data.
      ELSE.
          CALL METHOD o_kpi->process_kpi( ).  " NOTE: private method
          GET REFERENCE OF me->it_kpi INTO me->mdo_data.
      ENDIF.
    ENDMETHOD.
    METHOD write.
    FIELD-SYMBOLS:
      <lt_outtab>    TYPE table.
      ASSIGN me->mdo_data->* TO <lt_outtab>.
    cl_salv_table=>factory(
    EXPORTING
    list_display = if_salv_c_bool_sap=>false
    IMPORTING
    r_salv_table = salv_table
    CHANGING
    t_table = <lt_outtab>
    salv_table->display( ).
    ENDMETHOD.
    ENDCLASS.
    CLASS lcl_kpi IMPLEMENTATION.
    METHOD process_kpi.
    *********** run some select statement into it_kpi*******
    ENDMETHOD.
    ENDCLASS.
    CLASS lcl_wbs IMPLEMENTATION.
    METHOD process_wbs.
    *********** run some select statement into it_wbs*******
    ENDMETHOD.
    ENDCLASS.

    Hi,
    I had similar requirement wherein I was supposed to display different data using 2 different internal tables on a subscreen area.
    The screen consists of two parts: 1) selection-screen with few input fields and two buttons 2) Subscreen area where the report need to be displayed. This report is displayed based on the button that the user is selecting. For this I have done the following things:
    1. Capture the sy-ucomm when user is clicking on any of the two buttons in PAI. Then perform data fetch operation.
             MODULE USER_COMMAND_9003 INPUT.
                 CASE OK_CODE.
                     WHEN 'DETAIL'.
                       GV_RPT = OK_CODE.
                       PERFORM F_GET_DETAIL_DATA.
                     WHEN 'REPORT'.
                       GV_RPT = OK_CODE.
                       PERFORM F_GET_REPT_DATA.
                   ENDCASE.
             ENDMODULE.                 " USER_COMMAND_9003  INPUT
    2.  Declare two different ALV's with the fieldcat similar to 2 internal tables respectively. Use the above sy-ucomm PBO to call appropriate ALV.
             MODULE DISPLAY_ALV OUTPUT.
               IF GV_RPT EQ 'DETAIL'.
                 PERFORM F_FIELDCAT_DETAIL.
                 PERFORM F_LAYOUT_DETAIL.
                 PERFORM F_EXCLUDE_TOOLBAR_DETAIL.
                 PERFORM F_DISPLAY_ALV_DETAIL.
               ELSEIF GV_RPT EQ 'REPORT'.
                 PERFORM F_FIELDCAT_REPT.
                 PERFORM F_LAYOUT_REPT.
                 PERFORM F_EXCLUDE_TOOLBAR_REPT.
                 PERFORM F_DISPLAY_ALV_REPT.
               ENDIF.
             ENDMODULE.                 " DISPLAY_ALV  OUTPUT
    3. Before displaying ALV you need to free the container and ALV.
    FORM F_DISPLAY_ALV_DETAIL .
    IF GC_CONTAINER_ES IS NOT INITIAL.
        CALL METHOD GC_CONTAINER_ES->FREE
          EXCEPTIONS
            CNTL_ERROR        = 1
            CNTL_SYSTEM_ERROR = 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.
      ENDIF.
      IF GC_ALV_GRID_ES IS NOT INITIAL.
        CALL METHOD GC_ALV_GRID_ES->FREE
          EXCEPTIONS
            CNTL_ERROR        = 1
            CNTL_SYSTEM_ERROR = 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.
      ENDIF.
      IF GC_CONTAINER_TB IS NOT INITIAL.
        CALL METHOD GC_CONTAINER_TB->FREE
          EXCEPTIONS
            CNTL_ERROR        = 1
            CNTL_SYSTEM_ERROR = 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.
      ENDIF.
      IF GC_ALV_GRID_TB IS NOT INITIAL.
        CALL METHOD GC_ALV_GRID_TB->FREE
          EXCEPTIONS
            CNTL_ERROR        = 1
            CNTL_SYSTEM_ERROR = 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.
      ENDIF.
      CREATE OBJECT GC_CONTAINER_ES
        EXPORTING
          CONTAINER_NAME              = 'CC_9003'
        EXCEPTIONS
          CNTL_ERROR                  = 1
          CNTL_SYSTEM_ERROR           = 2
          CREATE_ERROR                = 3
          LIFETIME_ERROR              = 4
          LIFETIME_DYNPRO_DYNPRO_LINK = 5
          OTHERS                      = 6.
      CREATE OBJECT GC_ALV_GRID_ES
        EXPORTING
          I_PARENT          = GC_CONTAINER_ES
        EXCEPTIONS
          ERROR_CNTL_CREATE = 1
          ERROR_CNTL_INIT   = 2
          ERROR_CNTL_LINK   = 3
          ERROR_DP_CREATE   = 4
          OTHERS            = 5.
      CALL METHOD GC_ALV_GRID_ES->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IS_LAYOUT                     = GS_LAYOUT_ES
          IT_TOOLBAR_EXCLUDING          = GT_TOOLBAR_ES
        CHANGING
          IT_OUTTAB                     = GT_ES_REPT
          IT_FIELDCATALOG               = GT_FIELDCAT_ES
        EXCEPTIONS
          INVALID_PARAMETER_COMBINATION = 1
          PROGRAM_ERROR                 = 2
          TOO_MANY_LINES                = 3
          OTHERS                        = 4.
    ENDFORM.                    " F_DISPLAY_ALV_DETAIL
    Similarly define the FORM F_DISPLAY_ALV_REPT.     
    Hope this will be useful for you. If you have any more queries let me know.

  • Radio buttons disabling functionality in OOPS ALV

    Hi,
    I am facing this peculiar problem in OOPS ALV. the requirement was to have a field and 2 radio buttons in ALV as editable when user clicks on CHANGE mode. but initially the table should be in display mode.
    I have used the icons in ALV to provide the radio button functioanlity and its working.. but cant find solution to these 2 issues:
    1) how to make radio button display only ?
    2) when appending a new row in the ALV, its just appending a row with 4 columns ( 2 of field and 2 of radio button), but it is not able to append icons by default.
    KIndly provide help on this. let me know if u need to clarify anything..
    Thankx in advance,
    Rohan Malik

    Hi Rohan,
    Not sure whether I understood your question correctly. I cant visualise your output .
    To add icons while appending a new row to the output
    First of all you need to have  a field icon ( of type icon_d ) in your output table.
    While appending the row you have to explicitly right the icon name to that field
    l_record-icon = '@#12' something like that  which you get from the type pool icons

  • Prob. while using error message in OOPS ALV

    Friends,
    I have developed an OOPS ALV to display the records with cost field as editable. And the cost should not accept decimals values, if the user enter the same (12.56) and click the save button (user-defined) then need to populate the error message. I am populating the error message, then the user change the value (12) and click the save, then in the ALV screen the chanegd value 12 is automatically back to prv. one 12.56 and the same error messgae is displaying.
    If i change the message type from Error to Info, then its working fine... but the client wants only error message. So anybody came across the same scenario? if yes.. pls share the solution..
    Ganesh C

    Hi,
    In this case, after the error message issued though the value is corrected , corrected data is not transferred to progarm.
    Program still works with old data. Check how you are issuing message and how you refereshing the table after user inputs.
    you can check program BCALV_EDIT_03 for vlidating fileds.
    I believe you can simply refer a data element which does not accepts decimal values.
    Regards,
    Ravi.

  • How to run a program in background and how to check the output

    I have to run my program as background job... it has a selection screen...... and i need to check the output after its complete.

    hi,
    u need to create one program for this.
    tables:btcevtjob.
    parameters:job(32).
    data:count like btcevtjob-jobcount.
    call the function modules JOB_OPEN,JOB_SUBMIT AND JOB_CLOSE
    and pass the parameters in those function modules.
    once u execute this program,
    go with sm37->provide jobname->select the option scheduled
    ->execute
    selct the entry->go with release option.
    under releasae select immediate option
    save
    select the job name again
    go with release
    status is in finished stage
    now go with spool option
    give spool no
    go for display
    o/p displayed.
    before this,go for se38->provide the name of program which u want to run in back ground->seelct variants->change->provide variant name->go for create->provide input value->go with attributes->provide description->save
    this variant name u have to give in the job_submit fm.
    or
    se38->program->execute->in back ground
    Reward points if useful,
    Thanks,
    Usha

  • How to see ALV in background

    Hi I run a alv report in background.
    I see it in a report format, i want to see it in a alv format.
    Kindly help

    Hi SK ,
    If use Grid in BG u will get o/p In ALV List Itself, second thing is u will get Croped o/p bcos of Print Format 65255 , in this case u have to create/change  a new Print Format only for BG jobs like 651000.
    for more info ask ur basis person to create a new print formats in such cases.
    Regards
    Prabhu

Maybe you are looking for

  • Satellite A205-S4607 doesn't start after windows vista update

    Hello, I was installing windows vista updates, but the battery was low and the computer turned off, then, the computer doesn´t start, only the hard disc led is light but the screen is black, please can you help me? The model is Satellite A205 -S4607

  • Link to an external RoboHlp8 html file

    Hi, I am trying to create a link to another RH8 project. I have been using Insert Hyperlink\Link to\File\Locating the html file in the other project. When I click OK it displays This action will create an external link to the help system. The link ma

  • Printing Problem from VBFA table(Transportation Management)

    Hello experts iam getting a problem in printout from a Z program (Execution) in which some information regarding 'Delivery No.' and 'Invoice No.' is coming. Can anyone tell me the reason for not getting the printout. I was not getting the print previ

  • Zen Touch - Noma

    I've been reading on these boards that it's possible to use some software by Nomad with my Creative Zen Touch. Which software exactly can I use, and is there any difference to the Media Source software that came with the Zen Touch? I've had my Zen To

  • EWM CIF Integration Model master data transfer Issue

    Hi Gurus, I am not able to transfer the master data from ERP to EWM. When I excecute the transaction CFM1 and CFM2 integration model ,the material is not getting transferred. I am getting the below mentioned Error message. "Location does not exist fo