Auto generated selection screen in Modulepool program

Hi Experts!!
How to develop/Desing auto-generated screen for accepting values from the user as criteria for database selections while running a report.
pls. guide me.
Thanks in advance

Use this - two FMS-
here is the code -
FORM extended_selection.
  DATA : t_dyn    LIKE rsdsfields OCCURS 0 WITH HEADER LINE.
*Work Areas.
  DATA : wa_range  TYPE LINE OF rsds_trange,
         wa_ranget TYPE rsds_frange_t,
         wa_line   TYPE LINE OF rsds_frange_t,
         t_selopt  TYPE rsds_selopt_t.
*Fields to be Put on the dynamic selection screen
  t_dyn-tablename = 'KNA1'.
  t_dyn-fieldname = 'KUNNR'.
  APPEND t_dyn.
  CLEAR  t_dyn.
  t_dyn-tablename = 'CEPC'.
  t_dyn-fieldname = 'PRCTR'.
  APPEND t_dyn.
  CLEAR  t_dyn.
  IF ( ( g_sel IS INITIAL ) OR ( t_ranges[] IS INITIAL ) ).
*Initialize Free Selection Mode.
    CALL FUNCTION 'FREE_SELECTIONS_INIT'
         EXPORTING
              kind                     = 'F'
         IMPORTING
              selection_id             = g_sel
         TABLES
              fields_tab               = t_dyn
         EXCEPTIONS
              fields_incomplete        = 1
              fields_no_join           = 2
              field_not_found          = 3
              no_tables                = 4
              table_not_found          = 5
              expression_not_supported = 6
              incorrect_expression     = 7
              illegal_kind             = 8
              area_not_found           = 9
              inconsistent_area        = 10
              kind_f_no_fields_left    = 11
              kind_f_no_fields         = 12
              too_many_fields          = 13
              dup_field                = 14
              field_no_type            = 15
              field_ill_type           = 16
              dup_event_field          = 17
              node_not_in_ldb          = 18
              area_no_field            = 19
              OTHERS                   = 20.
    IF sy-subrc NE 0.
      MESSAGE e717(db).
    ENDIF.
  ENDIF.
*Dialog for Selection.
  REFRESH t_ranges.
  CALL FUNCTION 'FREE_SELECTIONS_DIALOG'
       EXPORTING
            selection_id    = g_sel
            title           = 'Extended Selection'(s12)
            as_window       = true
            start_row       = 5
            start_col       = 20
            tree_visible    = space
       IMPORTING
            field_ranges    = t_ranges
       TABLES
            fields_tab      = t_dyn
       EXCEPTIONS
            internal_error  = 1
            no_action       = 2
            selid_not_found = 3
            illegal_status  = 4
            OTHERS          = 5.
  IF sy-subrc NE 0.
    CHECK sy-subrc NE 2.
    MESSAGE e717(db).
  ENDIF.
This will create a dynamic selection screen for you. For more information u can refer to the documentations of those function mdoules.
Hope it solves ur prob.

Similar Messages

  • How do I add validation to a system-generated Selection Screen?

    As HR ABAPers know, using the Logical Database approach (I'm using PNPCE) gives you a system-generated Selection Screen.  Part of the specs I have for this report involves making sure that the begin and end dates for the period selected are for a two-week period.  If not, I should display an error message until the user enters a period such that the period (pn-begda and pn-endda) reflect a two-week period.
    The code for the validation is easy enough, and I put it in the AT SELECTION-SCREEN event.  But here's the problem -- the code fires every time the user clicks the "Reporting Period" drop-down box, never giving the user a chance to specify a two-week period.  It fires because pn-begda and pn-endda are still all zeroes.  Even if I select "Other Period" from the drop-down list, the text boxes to allow me to specify the begin and end dates don't appear.
    I've been working on this for quite a while, trying all kinds of things, but I'm spinning my wheels now.  I just want that check to happen when the user clicks the Execute button on the Selection Screen, not when he/she is still trying to enter criteria.  I'm thinking screen field validation for a system-generated Selection Screen has to be a pretty common thing, and there must be a good solution out there.
    Any ideas?

    Rich,
    Absolutely beautiful -- that's exactly what I needed to learn.  Thank you so much.
    Rob, I thought about that.  I even proposed to the users that I could default in a two-week range beginning with today, exactly as you suggested, but they didn't want that.  They felt that this report would more often than not be run to reflect data from two-week periods not necessarily starting today.  Still thought it was a good idea, but that's their call. _
    Again, thanks Rich.  Points awarded.

  • Selection-screen in module program

    Hi,
    I have created a module pool prog.
    Now the new regd. is that I want to create selection-screen before displying the actual screen.
    But when I m trying to use selection screen then I m getting the message that it is not possible in type 'M' as my program is module pool.
    I m using screen 9000 to display the records, now where to write selection screen in the program?
    I think in PBO but getting some error, I have created one screen and in that defined a subscreen but it is giving some error.
    So any body knows how to add selection screen in 'M' type program?
    Thankx in advance.
    Umesh

    Hi,
    You can create a selection-screen for a module pool program.
    Create a new program with executable type. Create the selection screen as you would do in a normal program. Once you give data in the selection and press F8 button, based on the logics written, the O/P must appear in a table control. This is what your requirement is:
    A example below for your understanding.
    name of the prog : ZTEST
    Type: Exectable report (I)
    *----Selection Screen -
    SELECTION-SCREEN BEGIN OF BLOCK IPDATA WITH FRAME TITLE TEXT-001.
    PARAMETERS: PR_MONTH LIKE BOITEM-SPMON.
    SELECT-OPTIONS: SO_VKGRP FOR KNVV-VKGRP.
    SELECTION-SCREEN END OF BLOCK IPDATA.
    SELECTION-SCREEN BEGIN OF BLOCK ORGDATA WITH FRAME TITLE TEXT-002.
    SELECT-OPTIONS: SO_REGIO FOR KNA1-REGIO,
                    SO_KUNNR FOR KNA1-KUNNR,
                    SO_WERKS FOR T001W-WERKS.
    SELECTION-SCREEN END OF BLOCK ORGDATA.
    *--Selection Screen Events--
    START-OF-SELECTION.
      W_CURMFDAY = SY-DATUM.
      W_CURMFDAY+6(2) = '01'.
      PERFORM F001_GETDATA.
      IF SY-DBCNT EQ 0.
        MESSAGE S017(ZSFL).
        EXIT.
      ENDIF.
      PERFORM F002_ADDITIONALDATA.
      CALL SCREEN 100.
    For this screen 100, both the PBO and PAI can be declared in this main program itself.
    Regards,
    JLN.

  • How to auto populte selection screen for variant maintained in User Profile

    Hi,
    I have to auto populate selection screen of Custom Report , with the variant maintained in User profile of User .
    Helpful answers would be awarded .
    Thanks
    Umesh

    Hi,
    use the PARAMETER-ID clausole of the PARAMETERS / SELECT-OPTIONS instructions.
    See help for more informations.
    You have to know the parameter id of the field and also the parameters, must be tight to the right data element (example : parameters : p_mara like mara-matnr and NOT parameters : p_mara(18) ).
    Otherwise, use "get parameter id" in the initialization event to populate the selection screen.
    Bye
    Andrea

  • Calling selection screen of another  program

    Hi all,
         Am trying to call a program from a enhancement section of IW3K transaction using the following statement.But the selection screen of the program is not getting displayed.
    but the screen is dispalyed when i run the statement in debug mode.
    Can anyone help me on this...
    useful answers will be rewarded.
    submit Z XXXXX            via selection-screen
                                       WITH s_ispla =  'BEKD'
                                       WITH p_rsnum =  CAUFVD-rsnum
                                       WITH s_rspos in   i_range_tab
                                       and RETURN.

    hi,
    You can call one selection screen from other selection screen program using SUBMIT command.
    The syntax is as follows -
    codeSUBMIT... VIA SELECTION-SCREEN
    USING SELECTION-SET <var>
    WITH <sel> <criterion>
    WITH FREE SELECTIONS <freesel>
    WITH SELECTION-TABLE <rspar>.[/code]
    e.g.
    The following executable program (report) creates a selection screen containing the parameter PARAMET and the selection criterion SELECTO:
    codeREPORT demo_program_submit_rep1.
    DATA number TYPE i.
    PARAMETERS paramet(14) TYPE c.
    SELECT-OPTIONS selecto FOR number.[/code]
    The program DEMO_PROGRAM_SUBMIT_REP1 is called by the following program using various parameters:
    codeREPORT demo_program_submit_sel_screen NO STANDARD PAGE HEADING.
    DATA: int TYPE i,
    rspar TYPE TABLE OF rsparams,
    wa_rspar LIKE LINE OF rspar.
    RANGES seltab FOR int.
    WRITE: 'Select a Selection!',
    SKIP.
    FORMAT HOTSPOT COLOR 5 INVERSE ON.
    WRITE: 'Selection 1',
    / 'Selection 2'.
    AT LINE-SELECTION.
    CASE sy-lilli.
    WHEN 4.
    seltab-sign = 'I'. seltab-option = 'BT'.
    seltab-low = 1. seltab-high = 5.
    APPEND seltab.
    SUBMIT demo_program_submit_rep1 VIA SELECTION-SCREEN
    WITH paramet eq 'Selection 1'
    WITH selecto IN seltab
    WITH selecto ne 3
    AND RETURN.
    WHEN 5.
    wa_rspar-selname = 'SELECTO'. wa_rspar-kind = 'S'.
    wa_rspar-sign = 'E'. wa_rspar-option = 'BT'.
    wa_rspar-low = 14. wa_rspar-high = 17.
    APPEND wa_rspar TO rspar.
    wa_rspar-selname = 'PARAMET'. wa_rspar-kind = 'P'.
    wa_rspar-low = 'Selection 2'.
    APPEND wa_rspar TO rspar.
    wa_rspar-selname = 'SELECTO'. wa_rspar-kind = 'S'.
    wa_rspar-sign = 'I'. wa_rspar-option = 'GT'.
    wa_rspar-low = 10.
    APPEND wa_rspar TO rspar.
    SUBMIT demo_program_submit_rep1 VIA SELECTION-SCREEN
    WITH SELECTION-TABLE rspar
    AND RETURN.
    ENDCASE.[/code]
    => To leave a called program, you can use SUBMIT .... AND RETURN. by choosing F3 or F15 from list level 0 of the called report.

  • Can I make two differents selection screen in my program?

    Hi experts!!
    I don't know how to male this, the problem is that I need to make two differents selection screen in my program because I have two differents kinds of button,
    BUTTON1         BUTTON2          BUTTON3
    When I press button1 I received.
    BUTTON4         BUTTON5          BUTTON6
    Now If I press on button4, how can I pick up the event? the name or something associate to this button4?
    Thanks a lot and regards
    Rebeca

    Hi and thanks,
    I've tried with your code,  Velu Lakshmanan,  and I only received another screen with the buttons... I need to put this button in the same screen, now I've this, but I can't receive the event associate to the second's buttons,
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN PUSHBUTTON  1(79) DTP USER-COMMAND DTP
    VISIBLE LENGTH 25.
    SELECTION-SCREEN PUSHBUTTON 28(79) EMP USER-COMMAND EMP
    VISIBLE LENGTH 25.
    SELECTION-SCREEN PUSHBUTTON 55(79) ABS USER-COMMAND ABS
    VISIBLE LENGTH 25.
    PARAMETERS: PROC_TYP TYPE I DEFAULT 1 NO-DISPLAY.
    SELECTION-SCREEN END OF LINE.
    * Informes de datos de tiempo.
    SELECTION-SCREEN SKIP.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN PUSHBUTTON 1(25)  TEXT-FED USER-COMMAND FED MODIF ID DT1.
    SELECTION-SCREEN PUSHBUTTON 28(25) TEXT-DCH USER-COMMAND DCH MODIF ID DT1.
    SELECTION-SCREEN PUSHBUTTON 55(25) TEXT-ACH USER-COMMAND ACH MODIF ID DT1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN PUSHBUTTON 1(25)  TEXT-FII USER-COMMAND FII MODIF ID DT1.
    SELECTION-SCREEN PUSHBUTTON 28(25) TEXT-PTB USER-COMMAND PTB MODIF ID DT1.
    SELECTION-SCREEN PUSHBUTTON 55(25) TEXT-PTS USER-COMMAND PTS MODIF ID DT1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN PUSHBUTTON 1(25)  TEXT-ACI USER-COMMAND ACI MODIF ID DT1.
    SELECTION-SCREEN PUSHBUTTON 28(25) TEXT-FIM USER-COMMAND FIM MODIF ID DT1.
    SELECTION-SCREEN PUSHBUTTON 55(25) TEXT-LDH USER-COMMAND LDH MODIF ID DT1.
    SELECTION-SCREEN END OF LINE.
    * Informes de empleados
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN PUSHBUTTON 1(25)  TEXT-LDP USER-COMMAND LDP MODIF ID EM1.
    SELECTION-SCREEN PUSHBUTTON 28(25) TEXT-PDF USER-COMMAND PDF MODIF ID EM1.
    SELECTION-SCREEN PUSHBUTTON 55(25) TEXT-LDT USER-COMMAND LDT MODIF ID EM1.
    SELECTION-SCREEN END OF LINE.
    * Informes de bajas
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN PUSHBUTTON 1(25)  TEXT-BAJ USER-COMMAND BAJ MODIF ID AB1.
    SELECTION-SCREEN PUSHBUTTON 28(25) TEXT-VMA USER-COMMAND VMA MODIF ID AB1.
    SELECTION-SCREEN PUSHBUTTON 55(25) TEXT-SDE USER-COMMAND SDE MODIF ID AB1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN PUSHBUTTON 1(25)  TEXT-LDB USER-COMMAND LDB MODIF ID AB1.
    SELECTION-SCREEN PUSHBUTTON 28(25) TEXT-LDA USER-COMMAND LDA MODIF ID AB1.
    SELECTION-SCREEN PUSHBUTTON 55(25) TEXT-DHT USER-COMMAND DHT MODIF ID AB1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK B1.
    * Pintamos los botones que necesitemos mostrar según la opción seleccionada
    AT SELECTION-SCREEN.
      CASE SSCRFIELDS-UCOMM.
        WHEN 'DTP'. PROC_TYP = 1.
        WHEN 'EMP'. PROC_TYP = 2.
        WHEN 'ABS'. PROC_TYP = 3.
      ENDCASE.
    AT SELECTION-SCREEN OUTPUT.
      CASE PROC_TYP.
    * Cuando el botón que ha seleccionado es "Datos de tiempo"
        WHEN 1.
          CALL FUNCTION 'ICON_CREATE'
            EXPORTING
              NAME   = ICON_OKAY
              TEXT   = TEXT-DTP
              INFO   = TEXT-AUS
            IMPORTING
              RESULT = DTP.
          EMP = TEXT-EMP.
          ABS = TEXT-ABS.
          LOOP AT SCREEN.
            IF SCREEN-GROUP1 EQ 'DT1'.
              SCREEN-INPUT = '1'. SCREEN-INVISIBLE = '0'. MODIFY SCREEN.
            ENDIF.
            IF SCREEN-GROUP1 EQ 'EM1'.
              SCREEN-INPUT = '0'. SCREEN-INVISIBLE = '1'. MODIFY SCREEN.
            ENDIF.
            IF SCREEN-GROUP1 EQ 'AB1'.
              SCREEN-INPUT = '0'. SCREEN-INVISIBLE = '1'. MODIFY SCREEN.
            ENDIF.
          ENDLOOP.
        WHEN 2.
          CALL FUNCTION 'ICON_CREATE'
            EXPORTING
              NAME   = ICON_OKAY
              TEXT   = TEXT-EMP
              INFO   = TEXT-AUS
            IMPORTING
              RESULT = EMP.
          DTP = TEXT-DTP.
          ABS = TEXT-ABS.
          LOOP AT SCREEN.
            IF SCREEN-GROUP1 EQ 'DT1'.
              SCREEN-INPUT = '0'. SCREEN-INVISIBLE = '1'. MODIFY SCREEN.
            ENDIF.
            IF SCREEN-GROUP1 EQ 'EM1'.
              SCREEN-INPUT = '1'. SCREEN-INVISIBLE = '0'. MODIFY SCREEN.
            ENDIF.
            IF SCREEN-GROUP1 EQ 'AB1'.
              SCREEN-INPUT = '0'. SCREEN-INVISIBLE = '1'. MODIFY SCREEN.
            ENDIF.
          ENDLOOP.
        WHEN 3.
          CALL FUNCTION 'ICON_CREATE'
            EXPORTING
              NAME   = ICON_OKAY
              TEXT   = TEXT-ABS
              INFO   = TEXT-AUS
            IMPORTING
              RESULT = ABS.
          DTP = TEXT-DTP.
          EMP = TEXT-EMP.
          LOOP AT SCREEN.
            IF SCREEN-GROUP1 EQ 'DT1'.
              SCREEN-INPUT = '0'. SCREEN-INVISIBLE = '1'. MODIFY SCREEN.
            ENDIF.
            IF SCREEN-GROUP1 EQ 'EM1'.
              SCREEN-INPUT = '0'. SCREEN-INVISIBLE = '1'. MODIFY SCREEN.
            ENDIF.
            IF SCREEN-GROUP1 EQ 'AB1'.
              SCREEN-INPUT = '1'. SCREEN-INVISIBLE = '0'. MODIFY SCREEN.
            ENDIF.
          ENDLOOP.
      ENDCASE.
    Help please... I don't know how can I make this.....
    If I use screen...how can I put this screen in the correct place?
    Thanks a lot
    Regards,
    Rebeca

  • Problem with the selection screen in submit program

    Hi Friends,
    i am facing the problem wih the selection screen in submit program. in my Module pool program i am using the submit program statement, When i execute the program , The module program display the submit program selections creen.
    I have implemented the code same as below.
    submit ztest with tknum =p_tknum and  return.
    Can you pleaes help me how to avoid the submit program selection screen.
    Thanks,
    Charan

    Hi Charan,
    You have to give the selection screen values when you submit a job.
    Press F1 on submit and you will see more details.
    Here is an example from ABAP Documentation.
    Program accessed
    REPORT report1.
    DATA text(10) TYPE c.
    SELECTION-SCREEN BEGIN OF SCREEN 1100.
      SELECT-OPTIONS: selcrit1 FOR text,
                      selcrit2 FOR text.
    SELECTION-SCREEN END OF SCREEN 1100.
    Calling program
    REPORT report2.
         DATA: text(10)   TYPE c,
          rspar_tab  TYPE TABLE OF rsparams,
          rspar_line LIKE LINE OF rspar_tab,
          range_tab  LIKE RANGE OF text,
          range_line LIKE LINE OF range_tab.
    rspar_line-selname = 'SELCRIT1'.
    rspar_line-kind    = 'S'.
    rspar_line-sign    = 'I'.
    rspar_line-option  = 'EQ'.
    rspar_line-low     = 'ABAP'.
    APPEND rspar_line TO rspar_tab.
    range_line-sign   = 'E'.
    range_line-option = 'EQ'.
    range_line-low    = 'H'.
    APPEND range_line TO range_tab.
    range_line-sign   = 'E'.
    range_line-option = 'EQ'.
    range_line-low    = 'K'.
    APPEND range_line TO range_tab.
    SUBMIT report1 USING SELECTION-SCREEN '1100'
                   WITH SELECTION-TABLE rspar_tab
                   WITH selcrit2 BETWEEN 'H' AND 'K'
                   WITH selcrit2 IN range_tab
                   AND RETURN.
    Regards,
    Jovito.

  • How to generage pop up screen on selection screen of report program?

    Hi Guys,
            I am having a requirement to generate the <b>pop up screen on the selection screen</b> of the report program.
           Suggest me the best one with model program

    Hi Chakradhar,
                             Refer this code :
    SELECTION-SCREEN BEGIN OF BLOCK BL2 WITH FRAME TITLE TEXT-456.
    PARAMETERS PO RADIOBUTTON GROUP RADI USER-COMMAND R.
    SELECTION-SCREEN END OF BLOCK BL2.
    AT SELECTION-SCREEN OUTPUT.
    CALL SCREEN 100.
    when user will click on this radio button , a pop up screen will appear dynamically.
    Reward points if helpful.
    Regards,
    Hemant

  • Choose fields option in Selection Screen of report program.

    Hi Experts,
          Actually In my requirement , the user wants to display the output fields in ALV Grid and also in Block ALV format.They need 10 fields to be displayed by default and the additional fields has to be displayed based on the choose fields option
    ( i.e like SE11 choose fields option ) provided in the selection screen of this report program.So based on this the output has to be displayed.
    Pls suggest ur ideas.....
    Thanks in advance.
    Regards,
    Srinivas.

    Hi ,
    The following code will be helpful for your requirement...
    REPORT  ypm_hist_dyn.
    *              T Y P E - P O O L S                *
    TYPE-POOLS: slis.
    *                   T Y P E S                     *
    TYPES :   BEGIN OF t_equz,
                datbi TYPE datbi,     " Valid To Date
                equnr TYPE equnr,     " Equipment Number
                erdat TYPE erdat,     " Date on Which Record Was Created
                aedat TYPE aedat,    " Changed On
                iloan TYPE iloan,     " Location and account assignment for technical object
                gewrk TYPE lgwid,     " Object ID of the Work Center
                ingrp TYPE ingrp,      " Planner Group for Customer Service and Plant Maintenance
             END OF t_equz,
               BEGIN OF t_equz1,
                 datbi TYPE datbi,     " Valid To Date
                 equnr TYPE equnr,     " Equipment Number
                 erdat TYPE erdat,     " Date on Which Record Was Created
                 aedat TYPE aedat,    " Changed On
              END OF t_equz1,
              BEGIN OF t_iloa,
                iloan TYPE iloan,   "Location and account assignment for technical object
                tplnr TYPE tplnr,    " Functional Location
                msgrp TYPE raumnr,  " Room
             END OF t_iloa,
             BEGIN OF t_iflotx,
               tplnr TYPE tplnr,   "Functional Location
               pltxt TYPE pltxt,  " Description of functional location
             END OF t_iflotx,
            BEGIN OF t_equi,
              equnr TYPE equnr,   " Equipment Number
              eqart TYPE eqart,   "Type of Technical Object
           END OF t_equi,
           BEGIN OF t_crhd,
              objid TYPE cr_objid,  "Object ID of the resource
              arbpl TYPE arbpl,     "Work center
          END OF t_crhd,
              BEGIN OF t_eqkt,
              equnr TYPE equnr,    "Equipment Number
              eqktx TYPE ktx01,    "Description of technical object
              END OF t_eqkt,
              BEGIN OF t_t370k_t,
              eqart TYPE eqart,  "Type of Technical Object
              eartx TYPE eartx,  "Text for Object Type
              END OF t_t370k_t,
              BEGIN OF t_t024i,
              ingrp TYPE ingrp,  "Planner Group for Customer Service and Plant Maintenance
              innam TYPE innam,  "Name of the Maintenance Planner Group
              END OF t_t024i,
              BEGIN OF t_viqmel,
              equnr TYPE equnr,  "Equipment Number
              qmnum TYPE qmnum,  "Notification No
              qmdat TYPE qmdat,  "Date of Notification
              bequi TYPE bequi,  "Equipment Affected
              iloan TYPE iloan,  "Location and account assignment for technical object
              END OF t_viqmel,
              BEGIN OF t_final,
               equnr TYPE equz-equnr,
               eqktx TYPE eqkt-eqktx,
               tplnr TYPE iloa-tplnr,
               pltxt TYPE iflotx-pltxt,
               iloan TYPE iloan,
               datbi TYPE equz-datbi,
               ingrp TYPE t024i-ingrp,
               erdat TYPE equz-erdat,
               enddt1 TYPE char10,
               aedat TYPE equz-aedat,
               innam TYPE t024i-innam,
               equart TYPE equi-eqart,
               eartx TYPE t370k_t-eartx,
              qmnum TYPE viqmel-qmnum,
              arbpl TYPE crhd-arbpl,
              msgrp TYPE iloa-msgrp,
              dat_diff TYPE char10,
              END OF t_final,
              BEGIN OF t_final1,
               equnr TYPE equz-equnr,
               eqktx TYPE eqkt-eqktx,
               tplnr TYPE iloa-tplnr,
               pltxt TYPE iflotx-pltxt,
              END OF t_final1.
    DATA:   it_equz TYPE STANDARD TABLE OF t_equz,
            it_iloa TYPE STANDARD TABLE OF t_iloa,
            it_iflotx TYPE STANDARD TABLE OF t_iflotx,
            it_equi TYPE STANDARD TABLE OF t_equi,
            it_crhd TYPE STANDARD TABLE OF t_crhd,
            it_eqkt TYPE STANDARD TABLE OF t_eqkt,
            it_t370k_t TYPE STANDARD TABLE OF t_t370k_t,
            it_t024i TYPE STANDARD TABLE OF  t_t024i,
            it_viqmel TYPE STANDARD TABLE OF  t_viqmel,
            it_final TYPE STANDARD TABLE OF t_final,
            it_final1 TYPE STANDARD TABLE OF t_final1,
            it_equz1 TYPE STANDARD TABLE OF t_equz1.
    DATA:   wa_equz TYPE  t_equz,
           wa_iloa TYPE t_iloa,
           wa_iflotx TYPE  t_iflotx,
           wa_equi TYPE  t_equi,
           wa_crhd TYPE t_crhd,
           wa_eqkt TYPE t_eqkt,
           wa_t370k_t TYPE  t_t370k_t,
           wa_t024i TYPE  t_t024i,
           wa_viqmel TYPE t_viqmel,
           wa_final TYPE t_final,
           wa_final1 TYPE t_final1,
           wa_equz1 TYPE t_equz.
    DATA: t_equnr TYPE equz-equnr,          "EQUZ-EQUNR
          t_tplnr TYPE iloa-tplnr,          "Functional Location
          t_datbi TYPE equz-datbi,          "Date
          t_ingrp TYPE equz-ingrp,          "Planner Group
          t_eqart TYPE equi-eqart,          "Technical Object
          w_diff TYPE p,
          w_time TYPE t.
    *            ALV DATA DECLARATION                 *
    * Field Catalog
    TYPES:  BEGIN OF t_fldnam,
              fld TYPE fieldname,
              desc TYPE char30,
            END OF t_fldnam.
    DATA:   is_layout TYPE slis_layout_alv,
            it_fieldcat TYPE slis_t_fieldcat_alv,
            is_fieldcat TYPE slis_fieldcat_alv,
            it_fldnam TYPE STANDARD TABLE OF t_fldnam,
            wa_fldnam TYPE t_fldnam,
            it_sort TYPE STANDARD TABLE OF slis_t_sortinfo_alv,
            wa_sort LIKE LINE OF it_sort.
    DATA:   i_events   TYPE slis_t_event,
            ls_line TYPE slis_listheader,
            gt_list_top_of_page TYPE slis_t_listheader,  "FOR TOP OF PAGE
            gt_list_end_of_page TYPE slis_t_listheader.  "FOR END OF PAGE
    DATA : formname_top_of_page TYPE slis_formname VALUE
                                                  'GENERATE_TOP_OF_PAGE',
           formname_end_of_page TYPE slis_formname VALUE
                                                  'GENERATE_END_OF_PAGE',
           formname_user_command TYPE slis_formname VALUE 'USER_COMMAND'.
    *                C O N S T A N T S                *
    *CONSTANTS: c_top         TYPE slis_formname VALUE 'TOP_OF_PAGE',
    *           c_final(40)   TYPE c VALUE 'IT_FINAL',
    *           c_detail(15)  TYPE c VALUE 'IT_FINAL1'.
    DATA :      g_save(1) TYPE c,
          g_exit(1) TYPE c,
          g_variant LIKE disvariant,
          gx_variant LIKE disvariant.
    *        S E L E C T I O N   S C R E E N          *
    SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_equnr FOR t_equnr,
                    s_tplnr FOR   t_tplnr,
                    s_datbi FOR  t_datbi ,
                    s_ingrp FOR t_ingrp,
                    s_eqart FOR t_eqart.
    SELECTION-SCREEN: END OF BLOCK b1.
    SELECTION-SCREEN  :  BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 3(16) text-007.
    SELECTION-SCREEN POSITION 22.
    PARAMETERS        :  11_flds RADIOBUTTON GROUP g1 DEFAULT 'X' USER-COMMAND g1.
    SELECTION-SCREEN COMMENT 39(13) text-009.
    SELECTION-SCREEN POSITION 54.
    PARAMETERS        :  6_flds RADIOBUTTON GROUP g1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN  :  END OF BLOCK blk2.
    SELECTION-SCREEN:BEGIN OF BLOCK b2 WITH FRAME TITLE text-003.
    PARAMETERS:     alv_list RADIOBUTTON GROUP gp1 DEFAULT 'X'.
    PARAMETERS:  alv_grid RADIOBUTTON GROUP gp1.
    SELECTION-SCREEN:END OF BLOCK b2.
    SELECTION-SCREEN: BEGIN OF BLOCK b3 WITH FRAME TITLE text-005.
    PARAMETERS  : p_vari LIKE disvariant-variant.
    SELECTION-SCREEN: END OF BLOCK b3.
    AT SELECTION-SCREEN.
      PERFORM date_range.
      IF s_datbi[] IS INITIAL.
        MESSAGE e398(00) WITH 'ENTER A VALUE FOR DATE'(012).
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.
      PERFORM f4_for_variant.
    START-OF-SELECTION.
      IF 11_flds EQ 'X'.
        PERFORM fill_equz.
        PERFORM fill_iloa.
        PERFORM fill_iflotx.
        PERFORM fill_equi.
        PERFORM fill_t370k_t.
        PERFORM fill_t024i.
        PERFORM fill_crhd.
        PERFORM fill_eqkt.
        PERFORM fill_viqmel.
      ELSE.
        PERFORM fill_equz.
        PERFORM fill_iloa.
        PERFORM fill_iflotx.
        PERFORM haha_final.
        PERFORM dyn_tab.
      ENDIF.
      PERFORM fill_final.
      PERFORM get_day_diff.
    *                      END-OF-SELECTION                                *
    END-OF-SELECTION.
    *Display Output in ALV Format
    *  PERFORM populate_layout.
      PERFORM populate_fcat.
      PERFORM populate_events .
    *  PERFORM gen_top.
      PERFORM display_alv .
    *&      Form  FILL_EQUZ
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM fill_equz .
      IF s_datbi-high IS INITIAL.
        s_datbi-high = '99990701'.
      ENDIF.
    *  IF s_datbi-LOW IS INITIAL.
    *    s_datbi-LOW = '20071201'.
    *  ENDIF.
        SELECT datbi
                equnr
                erdat
                aedat
                iloan
                gewrk
                ingrp
                FROM equz
            INTO CORRESPONDING FIELDS OF TABLE  it_equz
    *      WHERE datbi IN s_datbi AND equnr IN s_equnr.
            WHERE equnr IN s_equnr
             AND  ingrp IN s_ingrp
             AND  datbi LE s_datbi-high
            AND  datbi GE s_datbi-low.
    ENDFORM.                    " FILL_EQUZ
    *&      Form  FILL_ILOA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM fill_iloa .
      SELECT iloan
              tplnr
              msgrp
             INTO CORRESPONDING FIELDS OF TABLE it_iloa
              FROM iloa
              FOR ALL ENTRIES IN it_equz
              WHERE iloan = it_equz-iloan.
    ENDFORM.                    " FILL_ILOA
    *&      Form  FILL_IFLOTX
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM fill_iflotx .
      SELECT tplnr
              pltxt
              INTO CORRESPONDING FIELDS OF TABLE it_iflotx
              FROM iflotx
              FOR ALL ENTRIES IN it_iloa
              WHERE tplnr = it_iloa-tplnr.
    ENDFORM.                    " FILL_IFLOTX
    *&      Form  FILL_EQUI
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM fill_equi .
      SELECT equnr
            eqart
            INTO CORRESPONDING FIELDS OF TABLE  it_equi
            FROM equi
            FOR ALL ENTRIES IN it_equz
            WHERE equnr = it_equz-equnr.
    ENDFORM.                    " FILL_EQUI
    *&      Form  FILL_T370K_T
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM fill_t370k_t .
      SELECT eqart
            eartx
            INTO CORRESPONDING FIELDS OF TABLE it_t370k_t
            FROM t370k_t
            FOR ALL ENTRIES IN it_equi
            WHERE eqart = it_equi-eqart.
    ENDFORM.                    " FILL_T370K_T
    *&      Form  FILL_T024I
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM fill_t024i .
      SELECT ingrp
              innam
              INTO CORRESPONDING FIELDS OF TABLE it_t024i
              FROM t024i
              FOR ALL ENTRIES IN it_equz
              WHERE ingrp = it_equz-ingrp.
    ENDFORM.                    " FILL_T024I
    *&      Form  FILL_CRHD
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM fill_crhd .
      SELECT objid
              arbpl
              INTO CORRESPONDING FIELDS OF TABLE it_crhd
              FROM crhd
              FOR ALL ENTRIES IN it_equz
              WHERE objid = it_equz-gewrk.
    ENDFORM.                    " FILL_CRHD
    *&      Form  FILL_EQKT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM fill_eqkt .
      SELECT equnr
             eqktx
             INTO CORRESPONDING FIELDS OF TABLE it_eqkt
             FROM eqkt
             FOR ALL ENTRIES IN it_equz
             WHERE equnr = it_equz-equnr.
    ENDFORM.                    " FILL_EQKT
    *&      Form  FILL_VIQMEL
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM fill_viqmel .
    ENDFORM.                    " FILL_VIQMEL
    *&      Form  SHW_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM shw_data .
      LOOP AT it_final1 INTO wa_final1.
        WRITE : wa_final1-equnr , wa_final1-eqktx , wa_final1-tplnr , wa_final1-pltxt.
        CLEAR wa_final1.
      ENDLOOP.
    ENDFORM.                    " SHW_DATA
    *&      Form  POPULATE_LAYOUT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    *FORM populate_layout .
    *  is_layout-zebra = 'X'.
    *  is_layout-colwidth_optimize = 'X'.
    *  APPEND is_layout.
    *ENDFORM.                    " POPULATE_LAYOUT
    *&      Form  POPULATE_FCAT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM populate_fcat .
      IF 11_flds EQ 'X'.
        APPEND 'EQUNR                         EQUIP NUMBER         ' TO it_fldnam.
        APPEND 'EQKTX                         DESC OF EQUIP        '  TO it_fldnam.
        APPEND 'ERDAT                         START DATE           ' TO it_fldnam.
        APPEND 'DATBI                         END DATE             ' TO it_fldnam.
        APPEND 'AEDAT                         CHND ON              '  TO it_fldnam.
        APPEND 'ILOAN                         LOC ON ACCOUNT       '  TO it_fldnam.
        APPEND 'TPLNR                         FUNC LOC             '  TO it_fldnam.
        APPEND 'PLTXT                         DESC FUNC LOC        '  TO it_fldnam.
        APPEND 'INGRP                         PLANNER GRP          '  TO it_fldnam.
        APPEND 'INNAM                         MAINT PLN GRP        '  TO it_fldnam.
        APPEND 'DAT_DIFF                      DATE DIFF            '  TO it_fldnam.
      ENDIF.
      IF 6_flds EQ 'X'.
        APPEND 'TPLNR                         FUNC LOCATION        ' TO it_fldnam.
        APPEND 'PLTXT                         DESC OF FUC LOC      ' TO it_fldnam.
        APPEND 'DATBI                         END DATE             ' TO it_fldnam.
        APPEND 'EQUNR                         EQUIP NUMBER         ' TO it_fldnam.
        APPEND 'ERDAT                         START DATE           ' TO it_fldnam.
        APPEND 'AEDAT                         CHND ON              '  TO it_fldnam.
      ENDIF.
    ENDFORM.                    " POPULATE_FCAT
    *&      Form  DISPLAY_ALV
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM display_alv .
    *--------------------------------------------------Preparing the Layout*
      is_layout-colwidth_optimize = 'X'.
      is_layout-zebra = 'X'.
    *-------------------------------------------Preparing the Field Catalog*
        BREAK-POINT.
      LOOP AT it_fldnam INTO wa_fldnam.
        is_fieldcat-tabname       = 'IT_FINAL'.
        is_fieldcat-fieldname     = wa_fldnam-fld.
        is_fieldcat-seltext_l     = wa_fldnam-desc.
        is_fieldcat-col_pos       = sy-tabix.
        IF wa_fldnam-fld = 'EQKTX'.
          is_fieldcat-lowercase       = ' '.
        ENDIF.
        APPEND is_fieldcat TO it_fieldcat.
        CLEAR : is_fieldcat, wa_fldnam.
      ENDLOOP.
    *-------------------------------------------------------Calling Display*
      IF alv_list = 'X'.
        CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
          EXPORTING
            i_callback_program = sy-repid
            is_layout          = is_layout
            it_fieldcat        = it_fieldcat
            it_events          = i_events[]
            i_default          = 'X'
          TABLES
            t_outtab           = it_final
          EXCEPTIONS
            program_error      = 1
            OTHERS             = 2.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ELSE.
    *    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    *      EXPORTING
    *        i_callback_program     = sy-repid
    *        i_callback_top_of_page = 'GEN_TOP'
    *        is_layout              = is_layout
    *        it_fieldcat            = it_fieldcat
    *        it_events              = i_events[]
    *        i_save                 = g_save
    *        is_variant             = g_variant
    *        i_default              = 'A'
    *      TABLES
    *        t_outtab               = it_final
    *      EXCEPTIONS
    *        program_error          = 1
    *        OTHERS                 = 2.
    *    IF sy-subrc <> 0.
    *      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    *              WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    *    ENDIF.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
         EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
           i_callback_program                = sy-repid
    *   I_CALLBACK_PF_STATUS_SET          = ' '
    *   I_CALLBACK_USER_COMMAND           = ' '
           i_callback_top_of_page            = 'GEN_TOP'
    *   I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
    *   I_CALLBACK_HTML_END_OF_LIST       = ' '
    *   I_STRUCTURE_NAME                  =
    *   I_BACKGROUND_ID                   = ' '
    *   I_GRID_TITLE                      =
    *   I_GRID_SETTINGS                   =
           is_layout                         = is_layout
           it_fieldcat                       = it_fieldcat
    *   IT_EXCLUDING                      =
    *   IT_SPECIAL_GROUPS                 =
    *   IT_SORT                           =
    *   IT_FILTER                         =
    *   IS_SEL_HIDE                       =
    *   I_DEFAULT                         = 'X'
           i_save                            = 'A'
    *   IS_VARIANT                        = g_variant
    *   IT_EVENTS                         = i_events[]
    *   IT_EVENT_EXIT                     =
    *   IS_PRINT                          =
    *   IS_REPREP_ID                      =
    *   I_SCREEN_START_COLUMN             = 20
    *   I_SCREEN_START_LINE               = 30
    *   I_SCREEN_END_COLUMN               = 100
    *   I_SCREEN_END_LINE                 = 40
    *   I_HTML_HEIGHT_TOP                 = 0
    *   I_HTML_HEIGHT_END                 = 0
    *   IT_ALV_GRAPHICS                   =
    *   IT_HYPERLINK                      =
    *   IT_ADD_FIELDCAT                   =
    *   IT_EXCEPT_QINFO                   =
    *   IR_SALV_FULLSCREEN_ADAPTER        =
    * IMPORTING
    *   E_EXIT_CAUSED_BY_CALLER           =
    *   ES_EXIT_CAUSED_BY_USER            =
          TABLES
            t_outtab                          = it_final
         EXCEPTIONS
           program_error                     = 1
           OTHERS                            = 2
        IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    ENDFORM.                    " DISPLAY_ALV
    *&      Form  GET_DAY_DIFF
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM get_day_diff .
      w_time = '00:00:00'.
      FIELD-SYMBOLS: <deb> LIKE LINE OF it_final.
      LOOP AT it_final ASSIGNING <deb>.
        CALL FUNCTION 'SD_DATETIME_DIFFERENCE'
          EXPORTING
            date1                  = <deb>-datbi
            time1                  = w_time
            date2                  = <deb>-erdat
            time2                  = w_time
         IMPORTING
           datediff               = w_diff
    *   TIMEDIFF               =
    *   EARLIEST               =
    * EXCEPTIONS
    *   INVALID_DATETIME       = 1
    *   OTHERS                 = 2
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ELSEIF sy-subrc = 0.
          <deb>-dat_diff = w_diff.
    *      MODIFY it_final FROM WA_FINAL TRANSPORTING dat_diff.
        ENDIF.
      ENDLOOP.
    ENDFORM.                    " GET_DAY_DIFF
    *&      Form  HAHA_FINAL
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM haha_final .
    *  FIELD-SYMBOLS: <deb> LIKE LINE OF it_final.
      LOOP AT it_iflotx INTO wa_iflotx.
    *    wa_final1-equnr = wa_iflotx-equnr.
    *    wa_final1-eqktx = wa_iflotx-eqktx.
        wa_final1-tplnr = wa_iflotx-tplnr.
        wa_final1-pltxt = wa_iflotx-pltxt.
        APPEND wa_final1 TO it_final1.
      ENDLOOP.
    ENDFORM.                    " HAHA_FINAL
    *&      Form  DYN_TAB
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM dyn_tab .
      LOOP AT it_equz INTO wa_equz.
        wa_equz1-datbi = wa_equz-datbi.
        wa_equz1-equnr = wa_equz-equnr.
        wa_equz1-erdat = wa_equz-erdat.
        wa_equz1-aedat = wa_equz-aedat.
        APPEND wa_equz1 TO it_equz1.
      ENDLOOP.
    ENDFORM.                    " DYN_TAB
    *&      Form  FILL_FINAL1
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM fill_final.
      IF 11_flds EQ 'X'.
        FIELD-SYMBOLS: <deb> LIKE LINE OF it_equz,
                     <deb1> LIKE LINE OF it_final.
        CLEAR wa_equz.
        REFRESH : it_final[].
        LOOP AT it_equz ASSIGNING <deb>.
          wa_final-equnr = <deb>-equnr.
          wa_final-datbi = <deb>-datbi.
          wa_final-erdat = <deb>-erdat.
          wa_final-aedat = <deb>-aedat.
          wa_final-iloan = <deb>-iloan.
          wa_final-ingrp = <deb>-ingrp.
          APPEND wa_final TO it_final.
          CLEAR wa_final.
        ENDLOOP.
        LOOP AT it_final ASSIGNING <deb1>.
          READ TABLE it_iloa INTO wa_iloa WITH KEY iloan = <deb1>-iloan.
          <deb1>-tplnr = wa_iloa-tplnr.
        ENDLOOP.
        LOOP AT it_final ASSIGNING <deb1>.
          READ TABLE it_iflotx INTO wa_iflotx WITH KEY tplnr = <deb1>-tplnr.
          <deb1>-pltxt = wa_iflotx-pltxt.
        ENDLOOP.
        LOOP AT it_final ASSIGNING <deb1>.
          READ TABLE it_eqkt INTO wa_eqkt WITH KEY equnr = <deb1>-equnr.
          <deb1>-eqktx = wa_eqkt-eqktx.
        ENDLOOP.
        LOOP AT it_final ASSIGNING <deb1>.
          READ TABLE it_t024i INTO wa_t024i WITH KEY ingrp = <deb1>-ingrp.
          <deb1>-innam = wa_t024i-innam.
        ENDLOOP.
      ELSE.
        REFRESH : it_final[].
        LOOP AT it_equz INTO wa_equz.
          wa_final-datbi = wa_equz-datbi.
          wa_final-equnr = wa_equz-equnr.
          wa_final-erdat = wa_equz-erdat.
          wa_final-aedat = wa_equz-aedat.
          wa_final-iloan = wa_equz-iloan.
          APPEND wa_final TO it_final.
          CLEAR wa_final.
        ENDLOOP.
        FIELD-SYMBOLS: <deb2> LIKE LINE OF it_final.
        LOOP AT it_final ASSIGNING <deb2>.
          READ TABLE it_iloa INTO wa_iloa WITH KEY iloan = <deb2>-iloan.
          <deb2>-tplnr = wa_iloa-tplnr.
        ENDLOOP.
        LOOP AT it_final ASSIGNING <deb2>.
          READ TABLE it_iflotx INTO wa_iflotx WITH KEY tplnr = <deb2>-tplnr.
          <deb2>-pltxt = wa_iflotx-pltxt.
        ENDLOOP.
      ENDIF.
    ENDFORM.                    " FILL_FINAL
    *&      Form  DATE_RANGE
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM date_range .
      DATA :l_dat TYPE i.
      IF s_datbi-high IS NOT INITIAL.
        CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
          EXPORTING
            i_datum_bis             = s_datbi-high
            i_datum_von             = s_datbi-low
          IMPORTING
            e_tage                  = l_dat
          EXCEPTIONS
            days_method_not_defined = 1
            OTHERS                  = 2.
        IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
        IF l_dat GT '31'.
          MESSAGE e398(00) WITH 'Split Your Planning for a range of 31 Days'(012).
          LEAVE LIST-PROCESSING.
        ENDIF.
      ENDIF.
    ENDFORM.                    " DATE_RANGE
    *&      Form  GEN_TOP
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM gen_top .
      DATA: info(60),
            w_dt TYPE d.
      CLEAR ls_line.
      ls_line-typ = 'H'.
      ls_line-info = 'ALV DISPLAY'.
      APPEND ls_line TO gt_list_top_of_page.
      CONCATENATE 'Date :' s_datbi-low ' TO ' s_datbi-high INTO info SEPARATED BY space.
      CLEAR ls_line.
      ls_line-typ = 'S'.
      ls_line-info = info.
      APPEND ls_line TO gt_list_top_of_page.
      CLEAR ls_line.
      ls_line-typ = 'A'.
      ls_line-info = 'By Debarshi Roy'.
      APPEND ls_line TO gt_list_top_of_page.
    * Generate the End of Page
    *  CLEAR ls_line.
    *  ls_line-typ = 'H'.
    *  ls_line-info = 'ECL'.
    *  APPEND ls_line TO gt_list_end_of_page.
      CLEAR: ls_line.
    *  PERFORM generate_top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = gt_list_top_of_page
          i_logo             = 'DEB'.
    ENDFORM.                    " GEN_TOP
    *&      Form  POPULATE_EVENTS
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM populate_events .
      DATA: l_i_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = i_events[].
    *----- Pass top-of-page
      READ TABLE i_events WITH KEY name = slis_ev_top_of_page
                               INTO l_i_event.
      IF sy-subrc = 0.
        MOVE formname_top_of_page TO l_i_event-form.
        APPEND l_i_event TO i_events.
      ENDIF.
      CLEAR l_i_event.
    *----- Pass end-of-page
      READ TABLE i_events WITH KEY name = slis_ev_end_of_page
                               INTO l_i_event.
      IF sy-subrc = 0.
        MOVE formname_end_of_page TO l_i_event-form.
        APPEND l_i_event TO i_events.
      ENDIF.
      CLEAR l_i_event.
    *----- Pass user-command
      READ TABLE i_events WITH KEY name = slis_ev_user_command
                               INTO l_i_event.
      IF sy-subrc = 0.
        MOVE formname_user_command TO l_i_event-form.
        APPEND l_i_event TO i_events.
      ENDIF.
    ENDFORM.                    " POPULATE_EVENTS
    *&      Form  generate_top_of_page
    *       text
    *FORM generate_top_of_page.
    *  CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
    *    EXPORTING
    *      it_list_commentary = gt_list_top_of_page
    *      i_logo             = 'DEB'.
    *ENDFORM.                    "generate_top_of_page
    *&      Form  generate_end_of_page
    *       text
    FORM generate_end_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary       = gt_list_end_of_page
    *   I_LOGO                   =
    ENDFORM.                    "generate_end_of_page
    *&      Form  F4_FOR_VARIANT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM f4_for_variant .
      CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
        EXPORTING
          is_variant = g_variant
          i_save     = g_save
        IMPORTING
          e_exit     = g_exit
          es_variant = gx_variant
        EXCEPTIONS
          not_found  = 2.
      IF sy-subrc = 2.
        MESSAGE ID sy-msgid TYPE 'S'      NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ELSE.
        IF g_exit = space.
          p_vari = gx_variant-variant.
        ENDIF.
      ENDIF.
    ENDFORM.                    " F4_FOR_VARIANT

  • How to set Screen type "Selection Screen" in Dialog program

    Hi Experts,
    I have copied a screen 400 from a program into my program. In that screen in source program, the screen type was defined as 'Selection Screen'. After i copied that screen into my program, the screen type Selection Screen option is disabled. How to set the screen type of a screen to Selection Screen.
    I am currently getting the following error
    "Error when generating the selection screen "0400" of   "Ztest_screen                 ".
    I tried running the generation program RSDBGENA. There the diagnosis was given as follows:
    When generating the report Ztest_screen and its selection screen, an existing screen 1000 (not a selection screen) was overwritten.
    The selection screen was defined as follows:
    SELECTION-SCREEN BEGIN OF SCREEN 400 AS SUBSCREEN.
    SELECTION-SCREEN BEGIN OF BLOCK blck1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_matnr FOR mara-matnr.
    PARAMETERS:     p_werks TYPE werks_d OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK blck1.
    SELECTION-SCREEN END OF SCREEN 400 .
    I am calling the screen 400 with selection screen declarations in PBO of screen 0100.
    CALL SUBSCREEN sub_scr INCLUDING 'Ztest_Screen'  '400'.
    Where am i going wrong? Your inputs are needed.
    Thanks

    Thanks Przemysław and Nabheet for your suggestions.
    I had copied the generated screen 400 also from the source program into my program. This was the error. I deleted that and the report got activated now.
    Both the source and destination programs are not module pool. They are executable programs.
    Thanks

  • Call Selection screen of other program..

    Hello ABAP Experts,
    I have a situation where in I need to call the selection screen of one sap generated standard program without executing that program & get the values of those selection variables in to my custom program. Is there a way to do that? Please help.
    Thanks,
    Pandu

    If it is static or one program I could have done like that. But the nature of the  program is dynamic & not just one program.

  • Generate Selection Screen as Popup dynamically

    Hello to all,
    is there a way to generate a selection screen popup at runtime dynamically?
    Is there any guide, that explains how "generate dynpro" has to be used?
    Thanks
    Christian

    Hello Oliver,
    sorry that i didn't update this thread. I tried the way you described above and it works. Sometimes I get short dumps in the shared memory block. I didn't solve this yet.
    I post you my code below:
      DATA la_dssfield TYPE /XXX/zssys_dssfield.
      CLEAR: wa_code, it_code.
      CLEAR: Ranges.
      wa_code = '*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'.
      APPEND wa_code TO it_code.
      wa_code = '*!!!!!! Generated program. Do not change anything!!!!'.
      APPEND wa_code TO it_code.
      wa_code = '*!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'.
      APPEND wa_code TO it_code.
      wa_code = 'REPORT /XXX/ZSYS_GENSELSCREEN.'.
      APPEND wa_code TO it_code.
    **** Generate Tables Section
      DATA lt_tmp_dssfield TYPE /XXX/ztsys_dssfield.
      lt_tmp_dssfield[] = it_dssfield[].
    **** Delete Parameters
      DELETE lt_tmp_dssfield WHERE basictype EQ 'P'.
    **** Delete Duplicates
      SORT lt_tmp_dssfield BY reftable.
      DELETE ADJACENT DUPLICATES FROM lt_tmp_dssfield COMPARING reftable.
    **** Generate Tables Code
      LOOP AT lt_tmp_dssfield INTO la_dssfield.
        CONCATENATE 'TABLES' la_dssfield-reftable '.' INTO wa_code SEPARATED BY space.
        APPEND wa_code TO it_code.
      ENDLOOP.
    **** Build Selection Screen
      DATA: l_tabix(10) TYPE c,
            l_type(128) TYPE c,
            l_desc(10) TYPE c.
      LOOP AT it_dssfield INTO la_dssfield.
        l_tabix = sy-tabix.
        CONDENSE l_tabix.
        wa_code = 'SELECTION-SCREEN BEGIN OF LINE.'.
        APPEND wa_code TO it_code.
        CONCATENATE 'SELECTION-SCREEN COMMENT 1(32) cmt' l_tabix '.' INTO wa_code.
        APPEND wa_code TO it_code.
        CONCATENATE la_dssfield-reftable la_dssfield-reffield INTO l_type SEPARATED BY '-'.
        CASE la_dssfield-basictype.
          WHEN 'P'.
            CONCATENATE 'PARAMETERS' la_dssfield-fieldname 'LIKE' l_type '.' INTO wa_code SEPARATED BY space.
          WHEN 'S'.
            CONCATENATE 'SELECT-OPTIONS' la_dssfield-fieldname 'FOR' l_type '.' INTO wa_code SEPARATED BY space.
          WHEN 'V'.
            CONCATENATE 'SELECT-OPTIONS' la_dssfield-fieldname 'FOR' l_type ' NO INTERVALS.' INTO wa_code SEPARATED BY space.
        ENDCASE.
        APPEND wa_code TO it_code.
        wa_code = 'SELECTION-SCREEN END OF LINE.'.
        APPEND wa_code TO it_code.
      ENDLOOP.
    **** Initialize Comment Fields
      wa_code = 'INITIALIZATION.'.
      APPEND wa_code TO it_code.
    **** Set GUI-Status
      MOVE 'SET PF-STATUS ''STATUS_1000'' OF PROGRAM ''/XXX/ZSYS_GENSELSCREEN''.' to wa_code.
      APPEND wa_code to it_code.
    **** Set title
      DATA: l_stitle type string,
            l_sprog type string,
            l_stitletxt type string.
      MOVE '''TITLE_1000''' To l_stitle.
      MOVE '''/XXX/ZSYS_GENSELSCREEN''' to l_sprog.
      CONCATENATE 'SET TITLEBAR' l_stitle 'OF PROGRAM' l_sprog 'WITH'
                   INTO wa_code SEPARATED BY space.
      APPEND wa_code TO it_code.
      CONCATENATE '''' i_title '''' into wa_code.
      append wa_code to it_code.
      MOVE '.' to wa_code.
      APPEND wa_code TO it_code.
      LOOP AT it_dssfield INTO la_dssfield.
        l_tabix = sy-tabix.
        CONDENSE l_tabix.
        CONCATENATE 'cmt' l_tabix INTO l_tabix.
        CONCATENATE l_tabix ' = ''' la_dssfield-descr '''.' INTO wa_code.
        APPEND wa_code TO it_code.
      ENDLOOP.
    *** Start of Selection
    *  wa_code = 'START-OF-SELECTION.'.
    *  APPEND wa_code TO it_code.
    **** AT SELECTION-SCREEN
      wa_code = 'AT SELECTION-SCREEN.'.
      APPEND wa_code TO it_code.
      wa_code = 'DATA: okcode type SYUCOMM.'.
      APPEND wa_code TO it_code.
      wa_code = 'MOVE sy-ucomm to okcode.'.
      APPEND wa_code TO it_code.
    * Data types for shared objects
      wa_code = 'DATA t_ranges TYPE ACE_FIELD_RANGES_T.'.
      APPEND wa_code TO it_code.
      wa_code = 'DATA wa_ranges LIKE LINE OF t_ranges.'.
      APPEND wa_code TO it_code.
      wa_code = 'DATA t_fldrange TYPE ACE_GENERIC_RANGE_T.'.
      APPEND wa_code TO it_code.
      wa_code = 'DATA wa_fldrange TYPE ACE_GENERIC_RANGE.'.
      APPEND wa_code TO it_code.
    * Read the input from the selection screen and
    *  store it in Shared Objects
      LOOP AT it_dssfield INTO la_dssfield.
    *   Assign the fieldname in the variable
        CONCATENATE 'wa_ranges-fieldname = '''
                     la_dssfield-fieldname '''.'
          INTO wa_code SEPARATED BY space.
        APPEND wa_code TO it_code.
        wa_code = 'REFRESH t_fldrange.'.
        APPEND wa_code TO it_code.
    *   Processing for SELECT-OPTIONS
    *   Loop and move data to the shared memory
        IF la_dssfield-basictype EQ 'S'
           OR la_dssfield-basictype EQ 'V'.
          CONCATENATE 'LOOP AT ' la_dssfield-fieldname '.'
            INTO wa_code SEPARATED BY space.
          APPEND wa_code TO it_code.
          wa_code = 'CLEAR wa_fldrange.'.
          APPEND wa_code TO it_code.
          CONCATENATE 'MOVE-CORRESPONDING ' la_dssfield-fieldname 'TO' 'wa_fldrange.'
             INTO wa_code SEPARATED BY space.
          APPEND wa_code TO it_code.
          wa_code = 'APPEND wa_fldrange TO t_fldrange.'.
          APPEND wa_code TO it_code.
          wa_code = 'ENDLOOP.'.
          APPEND wa_code TO it_code.
          wa_code = 'wa_ranges-fieldrange[] = t_fldrange[].'.
          APPEND wa_code TO it_code.
          wa_code = 'APPEND wa_ranges TO t_ranges.'.
          APPEND wa_code TO it_code.
        ELSEIF la_dssfield-basictype EQ 'P'.
    *   Processing for PARAMETERS
          wa_code = 'CLEAR wa_fldrange.'.
          APPEND wa_code TO it_code.
    *     Process if the parameter is not initial
          CONCATENATE 'IF ' la_dssfield-fieldname 'IS NOT INITIAL.'
            INTO wa_code SEPARATED BY space.
          APPEND wa_code TO it_code.
          wa_code = 'wa_fldrange-sign = ''I''.'.
          APPEND wa_code TO it_code.
          wa_code = 'wa_fldrange-option = ''EQ''.'.
          APPEND wa_code TO it_code.
          CONCATENATE 'wa_fldrange-low = ' la_dssfield-fieldname '.'
            INTO wa_code SEPARATED BY space.
          APPEND wa_code TO it_code.
          wa_code = 'APPEND wa_fldrange TO t_fldrange.'.
          APPEND wa_code TO it_code.
          wa_code = 'ENDIF.'.
          APPEND wa_code TO it_code.
          wa_code = 'wa_ranges-fieldrange[] = t_fldrange[].'.
          APPEND wa_code TO it_code.
          wa_code = 'APPEND wa_ranges TO t_ranges.'.
          APPEND wa_code TO it_code.
        ENDIF.
      ENDLOOP.
      wa_code = 'DATA: area type ref to /XXX/zsmasys_genselscreen.'.
      APPEND wa_code TO it_code.
      wa_code = 'DATA root type REF to /XXX/zclsys_genselscreen.'.
      APPEND wa_code TO it_code.
    * Get ref to the shared memory
      wa_code = 'area = /XXX/zsmasys_genselscreen=>attach_for_write( ).'.
      APPEND wa_code TO it_code.
      wa_code = 'create object root area handle area.'.
      APPEND wa_code TO it_code.
    * Store the value in memory
      wa_code = 'root->set_fields( t_ranges ).'.
      APPEND wa_code TO it_code.
    * Store ok_code in memory
      wa_code = ' root->set_okcode( okcode ).'.
      APPEND wa_code TO it_code.
      wa_code = 'area->set_root(  root ).'.
      APPEND wa_code TO it_code.
    * Commit and detatch
      wa_code = 'area->detach_commit( ).'.
      APPEND wa_code TO it_code.
    * Quit the program: Return to the main code
      wa_code = 'LEAVE PROGRAM.'.
      APPEND wa_code TO it_code.
    * Generate the report program
      INSERT REPORT '/XXX/ZSYS_GENSELSCREEN' FROM it_code.
      COMMIT WORK.
    * Execute the report
      SUBMIT /XXX/zsys_genselscreen VIA SELECTION-SCREEN AND RETURN.
    Importing parameters are:
    it_dssfield type /XXX/zTsys_dssfield
    i_title type title_txt
    /XXX/ztsys_dssfield has the following line structure:
    FIELDNAME     CHAR08
    REFTABLE     TABNAME
    REFFIELD     FIELDNAME
    BASICTYPE     CHAR01
    DESCR     CHAR30_BRO
    I hope It helps you!
    I'm looking for a way to do the same in a selection-screen Pop-Up.
    For further questens contact me!
    Regards Christian

  • Set the parameter in the selection screen of a program from another program

    Hi ALL,
    I need to call the program RHALESMD from another program and the program RHALESMD takes from date as one of the input parameter.how do i set the from date from the calling program and call RHALESMD
    Thanks
    Bala Duvvuri

    i got the answer
    Program accessed
    REPORT report1.
    DATA text TYPE c LENGTH 10.
    SELECTION-SCREEN BEGIN OF SCREEN 1100.
      SELECT-OPTIONS: selcrit1 FOR text,
                      selcrit2 FOR text.
    SELECTION-SCREEN END OF SCREEN 1100.
    Calling program
    REPORT report2.
    DATA: text       TYPE c LENGTH 10,
          rspar_tab  TYPE TABLE OF rsparams,
          rspar_line LIKE LINE OF rspar_tab,
          range_tab  LIKE RANGE OF text,
          range_line LIKE LINE OF range_tab.
    rspar_line-selname = 'SELCRIT1'.
    rspar_line-kind    = 'S'.
    rspar_line-sign    = 'I'.
    rspar_line-option  = 'EQ'.
    rspar_line-low     = 'ABAP'.
    APPEND rspar_line TO rspar_tab.
    range_line-sign   = 'E'.
    range_line-option = 'EQ'.
    range_line-low    = 'H'.
    APPEND range_line TO range_tab.
    range_line-sign   = 'E'.
    range_line-option = 'EQ'.
    range_line-low    = 'K'.
    APPEND range_line TO range_tab.
    SUBMIT report1 USING SELECTION-SCREEN '1100'
                   WITH SELECTION-TABLE rspar_tab
                   WITH selcrit2 BETWEEN 'H' AND 'K'
                   WITH selcrit2 IN range_tab
                   AND RETURN.
    Thanks
    Bala Duvvuri

  • How to insert a standard selection screen on moduled program?

    Hi All,
    Selection screen can be easily done in classic report by just simply invoking the event "SELECTION-SCREEN"
    SELECTION-SCREEN BEGIN OF ...
    SELECT-OPTIONS ...
    PARAMETERS ...
    In the case of moduled program, there will be a PBO and PAI, I have a requirement on my 2nd screen where I need to have a selection screen, but the SELECTION-SCREEN event is not applicable for NOT TYPE 1(Executable) Program.
    My Dialog Program Flow:
    Main Screen -> Display Screen (should be SELECTION SCREEN) -> Output (3rd screen)
    What's the best alternative solution on this scenario?
    Thanks.

    Hi All,
    I layout and detailed my question, please see my scenario below:
    screen 9000
    MODULE user_command_9000 INPUT.
      CASE ok_code.
         WHEN 'CREATE'.
            CALL SCREEN 9001.
         WHEN 'DISPLAY'.
             "SHOULD CALL A SELECTION SCREEN HERE
             "AFTER THE SELECTION SCREEN, IS ANOTHER SCREEN FOR OUTPUT
        ENDCASE.
    TOP include
    SELECTION-SCREEN BEGIN OF SCREEN 9003 AS SUBSCREEN.
      PARAMETERS P_PLANT TYPE T001W-WERKS.
      SELECT-OPTIONS: S_MATNR    FOR MARA-MATNR,
                      S_LICHA    FOR MCHA-LICHA,
                      S_LIFNR    FOR LFA1-LIFNR.
    SELECTION-SCREEN END OF SCREEN   9003.
    Questions:
    1. on the PAI of my main screen 9001, how can I call the SUBSCREEN I created using CALL SUBSCREEN?
        the code:
            CALL SUBSCREEN 9001 INCLUDING 'PROG_NAME' '9002',
         is not working / syntax error.
    2. Should I call it like this?
        WHEN 'DISPLAY'.
           CALL SCREEN 9002.
       Screen 9002 PBO
            CALL SUBSCREEN 9001INCLUDING 'PROG_NAME' 9002',
         is not working / syntax error.
    Thanks all.
    Edited by: Jaime Cabanban on Dec 2, 2009 5:29 PM

  • Adding Field on Selection Screen in Standard program

    Hiiii,
    We have a requirement to add a field Business Place (BUPLA) on the Selection Screen.
    TCode - S_ALR_87012082, Program Name - RFKSLD00
    Please give me some idea, so that i can modify this program !!
    Nitin Garg

    Hii Klaus,
    Okay, If as per your aspects there is no need of modify logical database, so Plz let me know how can i enhance  RFKSLD00 to add Business Place.
    I try to find Badi for it, but i think there is no suitable Badi findings . Plz give solution soon .
    Nitin Garg
    Edited by: Suhas Saha on Oct 19, 2011 2:22 PM

Maybe you are looking for

  • How to add entries in possible fields in Account assignment model/Note 2596

    Hi Friends,          I want to know How to apply OSS Note 2596, The basic requirement is to to add entries in the list of possible fields in Account assignment model( Exactly in program SAPDFKA6 in screen 120). I found the note 2596 to achieve this,

  • I need to display a Report which contain -- del QTY  and  INV QTY   in one

    Hi ALL, I need to display a Report which contain <b>Customer  , Material , Order No, Delivery No, Billing No , Order Qty , Dev Qty, Bill Qty , Invoiced Qty  and There Values  in One Line  .</b> How can I Display, When I am executing the report agains

  • Using distinct in a command

    I have a query that works fine in SQL DEveloper: select distinct s.invoice_number as "Invoice Number",c1.company_cd as Counterparty,  C2.COMPANY_cd as "Internal Company", s.payment_due_dt as "Payment Due",        s.invoice_amt as "Amount", s.paid_amt

  • Error occurred in the data uploading from Flat File in BPC NW

    Hi, I am doing Migration project from BPC MS to NW. In this i am loading data from flat file to BPC NW. One error occured in this process that is Record Duplication. Total 17000 records in that  7000 recards rejected by the reason of duplication. The

  • M251nw not being recognized

    Just purchased a brand new m251nw, and I cannot get my computer operating on XP to reconize it.  I have used 2 different USB connectors, and have tried multiple usb ports on my computer.  I have rebooted, tried all kinds of different combinations all