Selection-screen in subroutine

Hi,
I would like to know if I can create my selection-screen using a subroutine.
Here is my selection-screen.
SELECTION-SCREEN : BEGIN OF LINE, COMMENT 1(45) text-aaa, POSITION 50.
PARAMETERS : p_aaa  TYPE rcgfiletr-ftappl OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN : BEGIN OF LINE, COMMENT 1(45) text-bbb, POSITION 50.
PARAMETERS : p_bbb  TYPE rcgfiletr-ftappl OBLIGATORY.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN : BEGIN OF LINE, COMMENT 1(45) text-ccc, POSITION 50.
PARAMETERS : p_ccc  TYPE rcgfiletr-ftappl OBLIGATORY.
SELECTION-SCREEN END OF LINE.
I tried this but it doesn't work.
PERFORM test : USING text-aaa p_aaa,
                          USING text-bbb p_bbb,
                          USING text-ccc p_ccc.
FORM test USING text parameter.
SELECTION-SCREEN : BEGIN OF LINE, COMMENT 1(45) text, POSITION 50.
PARAMETERS : parameter  TYPE rcgfiletr-ftappl OBLIGATORY.
SELECTION-SCREEN END OF LINE.
ENDFORM.
Error message : SELECTION-SCREEN statement is not allowed in FORM
Has anyone got an idea ?
Regards

First, you can not use selection-screen in FORM and PERFORM somewhere.
Second, you can use subscreen or include it is up to your screen design.
reward points if it helps.
michael

Similar Messages

  • Error which validating selection screen data in subroutine

    Hi,this is my code
    selection-screen begin of block b_selection with frame title text-001.
    SELECT-OPTIONS: s_belnr for  rbkp-belnr,                                         "Invoice number
                    s_gjahr for rbkp-gjahr NO-EXTENSION NO INTERVALS,               "Fiscal year
                    s_stat  for  rbkp-rbstat OBLIGATORY NO-EXTENSION DEFAULT c_status, "Invoice status
                    s_blart for rbkp-blart OBLIGATORY DEFAULT c_doc_type,              "Document type
                    s_lifnr for rbkp-lifnr.                                          "Vendor
    selection-screen end of block b_selection.
    at selection-screen.
    select belnr gjahr from rbkp into table i_inv_data
                           where belnr  IN s_belnr
                           and   gjahr  IN s_gjahr
                           and   blart  IN s_blart
                           and   rbstat IN s_stat.
                           and   lifnr  IN s_lifnr.
      if i_inv_data[] is initial.
      message e000 with 'No record matching the search criteria'(001).
      endif.
    This is working fine...now when I try to modularise it, it is nt working
    selection-screen begin of block b_selection with frame title text-001.
    SELECT-OPTIONS: s_belnr for  rbkp-belnr,                                         "Invoice number
                    s_gjahr for rbkp-gjahr NO-EXTENSION NO INTERVALS,               "Fiscal year
                    s_stat  for  rbkp-rbstat OBLIGATORY NO-EXTENSION DEFAULT c_status, "Invoice status
                    s_blart for rbkp-blart OBLIGATORY DEFAULT c_doc_type,              "Document type
                    s_lifnr for rbkp-lifnr.                                          "Vendor
    selection-screen end of block b_selection.
    at selection-screen.
    perform sub_validate_data.
    FORM SUB_VALIDATE_DATA.
    select belnr gjahr from rbkp into table i_inv_data
                           where belnr  IN s_belnr
                           and   gjahr  IN s_gjahr
                           and   blart  IN s_blart
                           and   rbstat IN s_stat.
                           and   lifnr  IN s_lifnr.
      if i_inv_data[] is initial.
      message e000 with 'No record matching the search criteria'(001).
      endif.
    ENDFORM.                    " SUB_VALIDATE_DATA
    the error which I m getting is ' IN s_belnr should be followd by an internal table'Please tell how can I modularize this code and put the checking part in subroutine

    If I remove the period after s_stat your code is compiling without problems:
    SELECTION-SCREEN BEGIN OF BLOCK b_selection WITH FRAME TITLE text-001.
    SELECT-OPTIONS: s_belnr FOR  rbkp-belnr,
                    s_gjahr FOR rbkp-gjahr NO-EXTENSION NO INTERVALS,
                    s_stat  FOR  rbkp-rbstat OBLIGATORY NO-EXTENSION DEFAULT 'X',
                    s_blart FOR rbkp-blart OBLIGATORY DEFAULT 'X',
                    s_lifnr FOR rbkp-lifnr.
    SELECTION-SCREEN END OF BLOCK b_selection.
    AT SELECTION-SCREEN.
      PERFORM sub_validate_data.
    *&      Form  SUB_VALIDATE_DATA
    *       text
    FORM sub_validate_data.
      SELECT belnr gjahr FROM rbkp INTO TABLE i_inv_data
                         WHERE belnr  IN s_belnr
                         AND   gjahr  IN s_gjahr
                         AND   blart  IN s_blart
                         AND   rbstat IN s_stat
                         AND   lifnr  IN s_lifnr.
      IF i_inv_data[] IS INITIAL.
        MESSAGE e000(oo) WITH 'No record matching the search criteria'(001).
      ENDIF.
    ENDFORM.                    " SUB_VALIDATE_DATA
    Check, if you have an additional period somewhere else, or any other subtle differenec.
    Michael

  • How  to filter by manager's name using selection screen

    Hi all,
      I am trying to modify the report to filter data from the report based on the manger name given in selection screen. As the manger's name was given in selection screen.. records have to come only of the employee how were working under that entered manager name.
      I am unable to follow this code to modify.. where to add select criteria to filter... please make modify to my code..
      I am pasting my code here, Can any one kindly help for this scenario.
    TABLES: PA0001,  "HR Master Record: Infotype 0001 (Org. Assignment),
            PA0002,
            P0000,
            PA9001,
            PA0007,
            HRP1001, "Infotype 1001 DB Table
            PA0034. "HR Master Record: Infotype 0034 (Corporate Function)
    *Internal table for holding output data
    DATA: IT_PA0002 LIKE PA0002  OCCURS 100 WITH HEADER LINE,
          IT_PA9001 LIKE PA9001  OCCURS 100 WITH HEADER LINE,
          IT_PA0007 LIKE PA0007  OCCURS 100 WITH HEADER LINE,
          IT_PA0034 LIKE PA0034  OCCURS 100 WITH HEADER LINE.
    DATA: IT_RET LIKE BAPIRET2,
          IT_ACT LIKE BAPI_SWHACTOR OCCURS 0,
          IT_STR LIKE BAPI_STRUC OCCURS 0,
          IT_ORG LIKE BAPI_OBJEC OCCURS 0,
          IT_POS LIKE BAPI_OBJEC OCCURS 0,
          IT_SUP LIKE BAPI_OBJEC OCCURS 0,
          IT_FCAT LIKE BAPI_HRAQFIELDDESCRIPTION OCCURS 0,
          IT_FDAT LIKE BAPI_HRFIELDDATA OCCURS 0,
          IT_ORGS TYPE STANDARD TABLE OF BAPI_OBJEC WITH HEADER LINE,
          IT_POSS TYPE STANDARD TABLE OF BAPI_OBJEC WITH HEADER LINE,
          IT_SUPR TYPE STANDARD TABLE OF BAPI_OBJEC WITH HEADER LINE,
          V_DATE  TYPE SY-DATUM,
          IT_T500P LIKE T500P OCCURS 0 WITH HEADER LINE,
          IT_TT500P LIKE T500P OCCURS 0 WITH HEADER LINE,
          IT_T001P LIKE T001P OCCURS 0 WITH HEADER LINE      .
    DATA: IT_PA0001 LIKE PA0001 OCCURS 100 WITH HEADER LINE,
          P_ENDDA LIKE sy-datum.
    DATA: Begin of I_HRE,
            pernr  like  pa0001-pernr,  "Emp Number
            nachn  like  pa0002-nachn,  "Last Name
            vorna  like  pa0002-vorna,  "First Name
            plans  like  BAPI_OBJEC-LONG_TEXT,  "Position
            div_text  like  pa9001-div_text,
            kztim  like  ZKZTIM_VAUES-name,
            stext  like  T591S-STEXT,     "Corporate function text
            werks  like  BAPI_OBJEC-LONG_TEXT,
            btrtl  like  pa0001-btrtl,
            orgeh  like  BAPI_OBJEC-LONG_TEXT,
            kostl  like  pa0001-kostl,
            mstbr  like  pa0001-mstbr,  "Supervisor
          End of I_HRE.
    DATA: I_HR like I_HRE occurs 100 with header line.
    DATA: V_PLANS LIKE PA0001-PLANS,
          V_EMP   LIKE PA0001-PERNR,
          V_KOSTL LIKE PA0001-KOSTL,
          V_SUPER LIKE BAPI_OBJEC-LONG_TEXT,
          V_EMP_POS LIKE BAPI_OBJEC-LONG_TEXT,
          V_SUPER_POS LIKE BAPI_OBJEC-LONG_TEXT,
          V_HEADER TYPE N VALUE 1,
          V_COUNTER TYPE N VALUE 1,
          EMP_INDICATOR TYPE N,
          V_ORGEH LIKE BAPI_OBJEC-LONG_TEXT,
          V_WERKS LIKE BAPI_OBJEC-LONG_TEXT,
          V_KZTIM LIKE ZKZTIM_VAUES-NAME,
          V_STEXT LIKE T591S-STEXT.
      DATA: v_file TYPE string,         "Detail Filename
            v_filerecord(1000),
            f_filerecord(1000),
            drive(3),
            mstbr  like  pa0001-mstbr,  "Supervisor
            count  type n value 0.
    SELECTION-SCREEN BEGIN OF BLOCK SELECTION WITH FRAME TITLE TEXT-001.
    SELECT-OPTIONS: S_PERNR FOR P0000-PERNR,
                    S_WERKS FOR PA0001-WERKS,
                    S_BTRTL FOR PA0001-BTRTL,
                    S_PERSG FOR PA0001-PERSG,
                    S_ORGEH FOR PA0001-ORGEH,
                    S_DIV   FOR PA9001-DIV_CODE,
                    S_KZTIM FOR PA0007-KZTIM,
                   S_sname for pa0001-sname, " this is to enter name
                                                             " as manager name
                    S_FUNKT FOR PA0034-FUNKT.
    SELECTION-SCREEN END OF BLOCK SELECTION.
    SELECTION-SCREEN BEGIN OF BLOCK SELECTION1 WITH FRAME TITLE TEXT-002.
    PARAMETERS:     P_BEGDA LIKE SY-DATUM DEFAULT sy-datum.
    *                P_ENDDA LIKE SY-DATUM DEFAULT '99991231'.
    SELECTION-SCREEN END OF BLOCK SELECTION1.
    START-OF-SELECTION.
    if P_BEGDA is initial.
      p_begda = sy-datum.
    endif.
    if P_ENDDA is initial.
      p_endda = sy-datum.
    endif.
    if S_PERSG is initial.
    *    S_PERSG-SIGN = 'I'.
    *    S_PERSG-OPTION = 'EQ'.
    *    S_PERSG-LOW = '1'.
    *    APPEND S_PERSG.
    *    S_PERSG-SIGN = 'I'.
    *    S_PERSG-OPTION = 'EQ'.
    *    S_PERSG-LOW = '6'.
    *    APPEND S_PERSG.
        S_PERSG-SIGN = 'I'.
        S_PERSG-OPTION = 'NE'.
        S_PERSG-LOW = '5'.
        APPEND S_PERSG.
    endif.
      SELECT * FROM PA0001 into IT_PA0001
        WHERE PERNR IN S_PERNR
          AND WERKS IN S_WERKS
          AND BTRTL IN S_BTRTL
          AND PERSG IN S_PERSG
          AND ORGEH IN S_ORGEH
          AND BEGDA LE P_BEGDA
          AND ENDDA GE P_ENDDA.
        APPEND IT_PA0001.
      ENDSELECT.
      IF not S_DIV[] is initial.
        SELECT * FROM PA9001 into IT_PA9001
          WHERE DIV_CODE IN S_DIV.
          APPEND IT_PA9001.
        ENDSELECT.
      ENDIF.
      IF not S_KZTIM[] is initial.
        SELECT * FROM PA0007 into IT_PA0007
          WHERE KZTIM IN S_KZTIM.
          APPEND IT_PA0007.
        ENDSELECT.
      ENDIF.
      IF not S_FUNKT[] is initial.
        SELECT * FROM PA0034 into IT_PA0034
          WHERE FUNKT IN S_FUNKT.
          APPEND IT_PA0034.
        ENDSELECT.
      ENDIF.
      SORT IT_PA0001 by SNAME.
      LOOP AT IT_PA0001.
        IF not S_DIV[] is initial.
          READ TABLE IT_PA9001 with key pernr = IT_PA0001-PERNR.
          IF sy-subrc ne 0.
            continue.
          ENDIF.
        ENDIF.
        IF not S_KZTIM[] is initial.
          READ TABLE IT_PA0007 with key pernr = IT_PA0001-PERNR.
          IF sy-subrc ne 0.
            continue.
          ENDIF.
        ENDIF.
        IF not S_FUNKT[] is initial.
          READ TABLE IT_PA0034 with key pernr = IT_PA0001-PERNR.
          IF sy-subrc ne 0.
            continue.
          ENDIF.
        ENDIF.
          V_COUNTER = 1.
                V_EMP = IT_PA0001-PERNR.
                V_KOSTL = IT_PA0001-KOSTL.
    *            WRITE: (10) V_EMP, (20) PA0002-NACHN, (20) PA0002-VORNA.
          WRITE: / SY-VLINE.                   " Left border
            WHILE V_EMP NE ''.
                PERFORM GET_SUPER CHANGING V_EMP V_SUPER
                                    V_EMP_POS.
              if v_emp ne ''.
                  select single * into it_pa0002 from pa0002
                    where pernr = v_emp
                      and begda LE p_begda
                      and endda GE p_endda.
                  IF V_HEADER = 1.
                        PERFORM HEADING.
                    V_HEADER = 0.
                  ENDIF.
                  WRITE:  (10) V_EMP, (17) IT_PA0002-NACHN
                          ,(17) IT_PA0002-VORNA, (40) V_EMP_POS.
                  move v_emp  to  i_hr-pernr.
                  move IT_PA0002-NACHN  to  i_hr-nachn.
                  move IT_PA0002-VORNA  to  i_hr-vorna.
                  move V_EMP_POS  to  i_hr-plans.
                  EMP_INDICATOR = V_COUNTER.
                  IF V_COUNTER = 1.
                    select single * into it_pa9001 from pa9001
                      where pernr = v_emp
                        and begda LE p_begda
                        and endda GE p_endda.
                    select single * into it_pa0007 from pa0007
                      where pernr = v_emp
                        and begda LE p_begda
                        and endda GE p_endda.
                    PERFORM GET_KZTIM_TEXT CHANGING it_pa0007-kztim V_KZTIM.
                    select single * into it_pa0034 from pa0034
                      where pernr = v_emp
                        and begda LE p_begda
                        and endda GE p_endda.
                    PERFORM GET_FUNKT_TEXT CHANGING it_pa0034-funkt v_stext.
                    write: (8) IT_PA9001-DIV_CODE, (17) V_KZTIM,
                           (25) V_STEXT.
                    move  IT_PA9001-DIV_CODE  to  i_hr-div_text.
                    move  v_KZTIM  to  i_hr-kztim.
                  ENDIF.
                  IF V_COUNTER = 0.
                    WRITE: (1) '|'.
                  ENDIF.
                  IF V_COUNTER = 1.
                    PERFORM GET_NAMES.
                    WRITE: (20) V_WERKS, (5) IT_PA0001-BTRTL
                            ,(20) V_ORGEH,(11) V_KOSTL, (3) '|'.
                    V_COUNTER = 0.
                    move  V_WERKS  to  i_hr-werks.
                    move  IT_PA0001-BTRTL  to  i_hr-btrtl.
                    move  V_ORGEH  to  i_hr-orgeh.
                    move  V_KOSTL  to  i_hr-kostl.
                  ENDIF.
                clear it_pa0002.
                refresh it_pa0002.
              endif.
                V_EMP = V_SUPER.
                move V_SUPER to i_hr-mstbr.
                if EMP_INDICATOR EQ 1.
                  append i_hr.
                endif.
                clear i_hr.
            ENDWHILE.
      NEW-LINE.
      CLEAR : V_KZTIM, it_pa9001, it_PA0007.
      ENDLOOP.
    * Check if its a background Job
      IF SY-BATCH NE SPACE.
        perform write_file.     "Output File
      ENDIF.
      ULINE.
    *&      Form  GET_SUPER
    *       This subroutine takes the position number and get the position
    * number that it reports to and then who is holding that position and
    * then the name of the person who is holding that position in order to
    * provide the supervisors name for the person in that position.
    *  -->  p1        text
    *  <--  p2        text
    FORM GET_SUPER CHANGING EMP_SUB EMP_SUPER
                               EMP_SUB_POS  .
      DATA: v_reporto like hrp1001-varyf value space,
            v_holder  like hrp1001-varyf value space,
            v_filled  like hrp1001-varyf value space,
            v_otype   like hrp1001-otype value space,
            v_objid   like hrp1001-objid value space.
      CLEAR: v_reporto, v_holder, v_filled, v_otype, v_objid,
                              EMP_SUB_POS.
      Select single plans
        into v_plans
        from pa0001
            where pernr = emp_sub
              and begda LE p_begda
              and endda GE p_endda.
            CALL FUNCTION 'BAPI_ORGUNITEXT_DATA_GET'
               EXPORTING
                  PLVAR                = '01'
                  OTYPE                = 'S'
                  OBJID                = v_PLANS
                  KEYDATE              = SY-DATUM
                  SCENARIO             = '    '
    *                 EVALPATH             = 0
                  EVALDEPTH            = 0
               IMPORTING
                  RETURN               = IT_RET
               TABLES
    *                 ACTORTAB             = IT_ACT
    *                 STRUCTURALDATA       = IT_STR
                  OBJECTSDATA          = IT_SUP
    *                 FIELDCATALOGUE       = IT_FCAT
    *                 FIELDDATA            = IT_FDAT
            IF SY-SUBRC EQ 0.
              READ TABLE IT_SUP INTO IT_SUPR
                 WITH KEY PLAN_VERS  = '01'
                          OBJECTTYPE = 'S'
                          OBJECT_ID  = v_PLANS.
              IF SY-SUBRC EQ 0.
                MOVE IT_SUPR-LONG_TEXT TO EMP_SUB_POS.
              ENDIF.
            ENDIF.
      Select Single varyf
         into v_reporto
         from hrp1001
            where otype = 'S'
              and objid = v_plans
              and rsign = 'A'
              and relat = '002'
              and begda LE p_begda
              and endda GE p_endda.
      if sy-subrc = 0.
        move v_reporto+0(1) to v_otype.
        move v_reporto+2(8) to v_objid.
        Select single varyf
           into v_holder
           from hrp1001
              where otype = v_otype
                and objid = v_objid
                and rsign = 'A'
                and relat = '008'
              and begda LE p_begda
              and endda GE p_endda.
        if sy-subrc = 0.
          move v_holder+0(1) to v_otype.
          move v_holder+2(8) to v_objid.
          EMP_SUPER = v_objid.
        IF EMP_SUB = EMP_SUPER.
           EMP_SUPER = ''.
        ENDIF.
    *      Select single varyf
    *         into v_filled
    *            from hrp1001
    *               where otype = v_otype
    *                 and objid = v_objid
    *                 and rsign = 'A'
    *                 and relat = '209'.
    *      if sy-subrc = 0.
    *        CLEAR: IT_RET, IT_ACT, IT_STR,  IT_FCAT, IT_FDAT,
    *               IT_SUP, IT_SUPR.
    *        REFRESH: IT_POSS.
    *        move v_filled+0(2) to v_otype.
    *        move v_filled+2(8) to v_objid.
    *        CALL FUNCTION 'BAPI_ORGUNITEXT_DATA_GET'
    *           EXPORTING
    *              PLVAR                = '01'
    *              OTYPE                = v_otype
    *              OBJID                = v_objid
    *              KEYDATE              = V_DATE
    *              SCENARIO             = '    '
    **                 EVALPATH             = 0
    *              EVALDEPTH            = 0
    *           IMPORTING
    *              RETURN               = IT_RET
    *           TABLES
    **                 ACTORTAB             = IT_ACT
    **                 STRUCTURALDATA       = IT_STR
    *              OBJECTSDATA          = IT_SUP
    **                 FIELDCATALOGUE       = IT_FCAT
    **                 FIELDDATA            = IT_FDAT
    *        IF SY-SUBRC EQ 0.
    *          READ TABLE IT_SUP INTO IT_SUPR
    *             WITH KEY PLAN_VERS  = '01'
    *                      OBJECTTYPE = v_otype
    *                      OBJECT_ID  = v_objid.
    *          IF SY-SUBRC EQ 0.
    *            MOVE IT_SUPR-LONG_TEXT TO EMP_SUPER.
    *          ENDIF.
    *        ENDIF.
    *      endif.
        endif.
      endif.
        if sy-subrc <> 0.
           EMP_SUPER = ''.
        endif.
    ENDFORM.                    " GET_SUPER
    *&      Form  HEADING
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM HEADING .
      FORMAT INTENSIFIED OFF.              " Remove any INTENSIFIED
      FORMAT COLOR COL_HEADING INTENSIFIED." Title color
      WRITE:  (10) 'Employee', (17) 'Last Name'
                          ,(17) 'First Name', (40) 'Position'
                          ,(8) 'Division', (17) 'Management Type'
                          ,(25) 'Corporate Function'
          ,(20) 'Personnel Area', (5) 'PSA'
          ,(20) 'Org. Unit',(11) 'Cost Center',(3) '|'
              ,(10) 'Supervisor', (17) 'Last Name'
                          ,(17) 'First Name', (40) 'Position', (1) '|'
              ,(10) 'Supervisor', (17) 'Last Name'
                          ,(17) 'First Name', (40) 'Position', (1) '|'
              ,(10) 'Supervisor', (17) 'Last Name'
                          ,(17) 'First Name', (40) 'Position', (1) '|'
              ,(10) 'Supervisor', (17) 'Last Name'
                          ,(17) 'First Name', (40) 'Position', (1) '|'
              ,(10) 'Supervisor', (17) 'Last Name'
                          ,(17) 'First Name', (40) 'Position', (1) '|'
              ,(10) 'Supervisor', (17) 'Last Name'
                          ,(17) 'First Name', (40) 'Position', (1) '|'
              ,(10) 'Supervisor', (17) 'Last Name'
                          ,(17) 'First Name', (40) 'Position', (1) '|'
              ,(10) 'Supervisor', (17) 'Last Name'
                          ,(17) 'First Name', (40) 'Position', (1) '|'
              ,(10) 'Supervisor', (17) 'Last Name'
                          ,(17) 'First Name', (40) 'Position', (1) '|'
      ULINE  .                    " Line below titles
        NEW-LINE.
          WRITE: / SY-VLINE.                   " Left border
      FORMAT COLOR OFF.
    ENDFORM.                    " HEADING
    *&      Form  GET_NAMES
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM GET_NAMES .
      CLEAR: IT_RET, IT_ACT, IT_STR, IT_ORG, IT_POS, IT_FCAT, IT_FDAT,
             IT_ORGS, IT_POSS, V_ORGEH, V_WERKS.
      REFRESH: IT_ORGS, IT_POSS.
      MOVE SY-DATUM TO V_DATE.
      CALL FUNCTION 'BAPI_ORGUNITEXT_DATA_GET'
         EXPORTING
            PLVAR                = '01'
            OTYPE                = 'O '
            OBJID                = IT_PA0001-ORGEH
            KEYDATE              = V_DATE
            SCENARIO             = '    '
    *         SCENARIO             = 'MDT1'
    *         EVALPATH             = '0       '
            EVALDEPTH            = 0
         IMPORTING
            RETURN               = IT_RET
         TABLES
    *         ACTORTAB             = IT_ACT
    *         STRUCTURALDATA       = IT_STR
             OBJECTSDATA          = IT_ORG
    *         FIELDCATALOGUE       = IT_FCAT
    *         FIELDDATA            = IT_FDAT
      IF SY-SUBRC EQ 0.
        READ TABLE IT_ORG INTO IT_ORGS
           WITH KEY PLAN_VERS  = '01'
                    OBJECTTYPE = 'O '
                    OBJECT_ID  = IT_PA0001-ORGEH.
        IF SY-SUBRC EQ 0.
          MOVE IT_ORGS-LONG_TEXT TO V_ORGEH.
        ENDIF.
      ENDIF.
      CALL FUNCTION 'HR_TMW_READ_T500P'
        EXPORTING
          PERSA          = IT_PA0001-WERKS
        IMPORTING
          W500P          = IT_T500P
        EXCEPTIONS
          NO_ENTRY_FOUND = 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 SY-SUBRC EQ 0.
        MOVE IT_T500P-NAME1 TO V_WERKS.
        CLEAR:  IT_T500P.
        REFRESH: IT_T500P.
      ENDIF.
    *  CALL FUNCTION 'HR_TMW_READ_T001P'
    *    EXPORTING
    *      PERSA          = PA0001-WERKS
    *      BTRTL          = PA0001-BTRTL
    *    IMPORTING
    *      W001P          = IT_T001P
    *    EXCEPTIONS
    *      NO_ENTRY_FOUND = 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 SY-SUBRC EQ 0.
    *    MOVE IT_T001P-BTEXT TO IT_HRR05-BTRTL.
    *  ENDIF.
    ENDFORM.                    " GET_NAMES
    *&      Form  GET_KZTIM_TEXT
    *       text
    *      <--P_V_EMP  text
    *      <--P_V_KZTIM  text
    FORM GET_KZTIM_TEXT  CHANGING P_KZTIM_ID
                                  P_KZTIM.
      select single NAME into P_KZTIM from ZKZTIM_VAUES
              where TYPE eq P_KZTIM_ID.
    ENDFORM.                    " GET_KZTIM_TEXT
    *&      Form  GET_FUNKT_TEXT
    *       text
    *      <--P_V_EMP  text
    *      <--P_V_KZTIM  text
    FORM GET_FUNKT_TEXT  CHANGING P_FUNKT_ID
                                  P_STEXT.
      select single STEXT into P_STEXT from T591S
              where SPRSL eq 'EN' and
                    INFTY eq '0034' and
                    SUBTY eq P_FUNKT_ID.
    ENDFORM.                    " GET_KZTIM_TEXT
    *&      Form  write_file
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM write_file .
    *   Checking the System ID
      if sy-sysid = 'RD1'.
        drive = 'D:\'.
      else.
        drive = 'M:\'.
      endif.
    *  concatenate drive sy-sysid
    *              '\Output\Reports\HR\HR_Public\Emp_Hierarchy'
    *              sy-datum
    *              '.xls' into v_file.
      concatenate drive sy-sysid
                  '\Output\Reports\HR\HR_Public\Emp_Hierarchy.xls'
                  into v_file.
      OPEN DATASET v_file FOR OUTPUT in text mode encoding default.
      concatenate 'Employee'
                  'Last Name'
                  'First Name'
                  'Position'
                  'Division'
                  'Management Type'
                  'Corporate Function'
                  'Personnel Area '
                  'PSA'
                  'Org. Unit'
                  'Cost Center'
                  'Supervisor'
                  'Last Name'
                  'First Name'
                  'Position'
                  'Supervisor'
                  'Last Name'
                  'First Name'
                  'Position'
                  'Supervisor'
                  'Last Name'
                  'First Name'
                  'Position'
                  'Supervisor'
                  'Last Name'
                  'First Name'
                  'Position'
                  'Supervisor'
                  'Last Name'
                  'First Name'
                  'Position'
                  'Supervisor'
                  'Last Name'
                  'First Name'
                  'Position'
                  'Supervisor'
                  'Last Name'
                  'First Name'
                  'Position'
                  'Supervisor'
                  'Last Name'
                  'First Name'
                  'Position'
                  'Supervisor'
                  'Last Name'
                  'First Name'
                  'Position'
                   into v_filerecord
                   separated by CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
      transfer v_filerecord to v_file.    "Writing to file
      clear v_filerecord.
      loop at IT_PA0001.
        do.
          if count eq 0.
            read table i_hr with key pernr = IT_PA0001-pernr.
            concatenate i_hr-pernr
                        i_hr-nachn
                        i_hr-vorna
                        i_hr-plans
                        i_hr-div_text
                        i_hr-kztim
                        i_hr-stext
                        i_hr-werks
                        i_hr-btrtl
                        i_hr-orgeh
                        i_hr-kostl
                        into v_filerecord
                        separated by CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
             mstbr = i_hr-mstbr.
             count = count + 1.
          else.
            read table i_hr with key pernr = mstbr.
            concatenate v_filerecord
                        i_hr-pernr
                        i_hr-nachn
                        i_hr-vorna
                        i_hr-plans
                        into f_filerecord
                        separated by CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
            v_filerecord = f_filerecord.
            mstbr = i_hr-mstbr.
            clear i_hr.
          endif.
          if mstbr eq space.
            exit.
          endif.
        enddo.
        transfer v_filerecord to v_file.  "Writing to file
        clear: v_filerecord, f_filerecord, count.
      endloop.
      CLOSE DATASET v_file.
    ENDFORM.                    " write_file
    Edited by: Surender Batlanki on Feb 20, 2008 7:50 AM
    Edited by: Surender Batlanki on Feb 20, 2008 7:59 AM
    Edited by: Surender Batlanki on Feb 20, 2008 8:12 AM
    Edited by: Surender Batlanki on Feb 20, 2008 3:16 PM
    Edited by: Alvaro Tejada Galindo on Feb 20, 2008 9:26 AM

    Hi Surender,
    In the Perform GET_SUPER, you are getting manager's OBJID. Use this OBJID and from PA0001 get Manger's name.
    While passing data to output table, filter that table by Manager's name and then pass output table for display.
    Hope this helps u.
    <REMOVED BY MODERATOR>
    Regards,
    Preeti
    Edited by: Alvaro Tejada Galindo on Feb 20, 2008 9:26 AM

  • How to get the file name dialog on the selection screen

    Hi All
    I have a selection screen in which there is a parameter where I need to enter file name. Instead of typing filename in the parameter I would like to give a path from presentation server ( I am downloading Data to presentation server ).
    How to achive this functionality in case of a parameter on the selection screen. I need to have File open Dialog box like Windows here and then it should show the filename and it's path in this parameter after selectiong from the dialog box.
    Amol

    Hi..,
    Use the function module <b>F4_FILENAME</b> or <b>WS_FILENAME_GET</b> in the event
    <b>AT SELECTION-SCREEN ON VALUE REQUEST FOR P_FILE.</b>
    Parameters p_file type rlgrap-filename.
                AT SELECTION-SCREEN ON VALUE REQUEST EVENT            
    at selection-screen on value-request for p_file.
      perform value_request.
    *&      Form  value_request
          This subroutine proposes the possible input values             *
    There are no interface parameters to be passed to this subroutine.  *
    form value_request.
      call function 'WS_FILENAME_GET'
       importing
         filename               = p_file
       exceptions
         inv_winsys             = 1
         no_batch               = 2
         selection_cancel       = 3
         selection_error        = 4
         others                 = 5.
      check sy-subrc eq 0.
    endform.              
    Reward all helpful answers !!
    sai ramesh

  • Dynamic Selection option in the selection screen

    Hi ,
    I have a requirement like this ....
    The user wants some fields to be default available in the selection screen. But they also want to be able to select the data based on additional fields (all the remaining fields ) which they want to see in the dynamic selection .
    The basic list for selections should be limited to the fields listed in the specifications provided to me and the remaining fields should be made available through the dynamic selection option.
    In the transaction FBL3N , this facility is provided.
    Kindly help me with this..
    thanks,
    Sumit .

    Hi Sumit,
    To include dynamic selection check this sample code.
    TYPE POOLS DECLARATIONS FOR VALUE REQUEST MANAGER AND ICONS
    TYPE-POOLS : vrm,
                 icon.
    *SELECTION SCREEN FIELDS
    TABLES : sscrfields.*GLOBAL DECLARATIONS
    DATA : flag TYPE c,
          tablename(10),
          mmtable LIKE dd02l-tabname,
          sdtable LIKE dd02l-tabname,
          hrtable LIKE dd02l-tabname.*DECLARATIONS FOR SELECTION SCREEN STATUS
    DATA it_ucomm TYPE TABLE OF sy-ucomm.***********SELECTION-SCREENS**********************
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME.*FOR DYNAMIC DISPLAY OF MODULES
    PARAMETERS :  pa RADIOBUTTON GROUP rad USER-COMMAND com MODIF ID mod,
                  pb RADIOBUTTON GROUP rad MODIF ID rad,
                  pc RADIOBUTTON GROUP rad MODIF ID cad.SELECTION-SCREEN SKIP.**TO INCLUDE DYNAMIC ICONS
    SELECTION-SCREEN COMMENT 2(6) text_001.*DYNAMIC LIST BOX BASED ON USER SELECTIONS
    PARAMETERS one AS LISTBOX VISIBLE LENGTH 20  MODIF ID mod.
    PARAMETERS two AS LISTBOX VISIBLE LENGTH 20   MODIF ID rad.
    PARAMETERS three AS LISTBOX VISIBLE LENGTH 20 MODIF ID cad.SELECTION-SCREEN END OF BLOCK blk1.*DISPLAY DYNAMIC PUSHBUTTON ON APP TOOLBAR ON USER CLICKS
    SELECTION-SCREEN: FUNCTION KEY 1,
                      FUNCTION KEY 2,
                      FUNCTION KEY 3.**EVENT ON SELECTION SCREEN FOR OUTPUT DISPLAY
    AT SELECTION-SCREEN OUTPUT.*CLICK OF FIRST RADIO BUTTON
      IF pa = 'X'.
        sscrfields-functxt_01 = 'Materials Management'.
        WRITE icon_plant AS ICON TO text_001.
    *CODE TO GET DYNAMICS BASED ON THE SELECTED RADIO
        LOOP AT SCREEN.
          IF screen-group1 = 'MOD'.
            screen-intensified = '1'.
            screen-active = 1.
            screen-display_3d = '1'.
            MODIFY SCREEN.
          ENDIF.
          IF screen-group1 = 'RAD'.
            screen-intensified = '0'.
            screen-active = 0.
            screen-display_3d = '0'.
            MODIFY SCREEN.
          ENDIF.
          IF screen-group1 = 'CAD'.
            screen-intensified = '0'.
            screen-active = 0.
            screen-display_3d = '0'.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.*CLICK OF SECOND RADIO
      IF pb = 'X'.
        sscrfields-functxt_02 = 'Sales And Distribution'.
        WRITE icon_ws_ship AS ICON TO text_001.
        LOOP AT SCREEN.
          IF screen-group1 = 'RAD'.
            screen-intensified = '1'.
            screen-active = 1.
            screen-display_3d = '1'.
            MODIFY SCREEN.
          ENDIF.
          IF screen-group1 = 'MOD'.
            screen-intensified = '0'.
            screen-active = 0.
            screen-display_3d = '0'.
            MODIFY SCREEN.
          ENDIF.
          IF screen-group1 = 'CAD'.
            screen-intensified = '0'.
            screen-active = 0.
            screen-display_3d = '0'.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.*CLICK OF THIRD RADIO
      IF pc = 'X'.
        sscrfields-functxt_03 = 'Human Resources'.
        WRITE icon_new_employee AS ICON TO text_001.
        LOOP AT SCREEN.
          IF screen-group1 = 'RAD'.
            screen-intensified = '0'.
            screen-active = 0.
            screen-display_3d = '0'.
            MODIFY SCREEN.
          ENDIF.
          IF screen-group1 = 'MOD'.
            screen-intensified = '0'.
            screen-active = 0.
            screen-display_3d = '0'.
            MODIFY SCREEN.
          ENDIF.
          IF screen-group1 = 'CAD'.
            screen-intensified = '1'.
            screen-active = 1.
            screen-display_3d = '1'.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.*CUSTOMISING THE TOOLBARS OF THE SELECTION SCREEN
    *WITH F8 BUTTON DISABLED  APPEND :  'PRIN' TO it_ucomm,
                'SPOS' TO it_ucomm,
                'ONLI' TO it_ucomm.  CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
        EXPORTING
          p_status  = sy-pfkey
        TABLES
          p_exclude = it_ucomm.
    **EVENT ON THE SELECTION
    AT SELECTION-SCREEN.* LIST BOX ONE VALUES
      CASE one.
        WHEN '1'.
          mmtable = 'MARC'.
        WHEN '2'.
          mmtable = 'MARA'.
        WHEN '3'.
          mmtable = 'MARD'.
        WHEN '4'.
          mmtable = 'MARM'.
      ENDCASE.* LIST BOX TWO VALUES
      CASE two.
        WHEN '1'.
          sdtable = 'VBAK'.
        WHEN '2'.
          sdtable = 'VBAP'.
        WHEN '3'.
          sdtable = 'VBUK'.
        WHEN '4'.
          sdtable = 'VBUP'.
      ENDCASE.* LIST BOX THREE VALUES
      CASE three.
        WHEN '1'.
          hrtable = 'PA0001'.
        WHEN '2'.
          hrtable = 'PA0006'.
        WHEN '3'.
          hrtable = 'PA0022'.
        WHEN '4'.
          hrtable = 'PA0008'.
      ENDCASE.*VALUES FOR CLICK OF THE PUSHBUTTON ON APP TOOLBAR
    *AND ENABLING THE BUTTONS TO PERFORM F8
      CASE sscrfields-ucomm.
        WHEN 'FC01'.
          tablename = mmtable.
          sscrfields-ucomm = 'ONLI'.
        WHEN 'FC02'.
          tablename = sdtable.
          sscrfields-ucomm = 'ONLI'.
        WHEN 'FC03'.
          tablename = hrtable.
          sscrfields-ucomm = 'ONLI'.
      ENDCASE.*INITIALIZATION EVENT
    INITIALIZATION.*VALUES ASSIGNED TO DROPDOWNLISTS IN THE SUBROUTINES
      PERFORM f4_value_request_pa.
      PERFORM f4_value_request_pb.
      PERFORM f4_value_request_pc.*START OF SELECTION EVENT
    START-OF-SELECTION.*SUBROUTINE FOR OUTPUT
      PERFORM output.*&----------------------------------------------------------------*
    *&      Form  f4_value_request_PA
    *       text
    *SUBROUTINE TO PROVIDE DROPDOWN VALUES TO LIST1
    FORM f4_value_request_pa.  DATA: l_name TYPE vrm_id,
            li_list TYPE vrm_values,
            l_value LIKE LINE OF li_list.  l_value-key = '1'.
      l_value-text = 'Plant Data for Material'.
      APPEND l_value TO li_list.
      CLEAR l_value.  l_value-key = '2'.
      l_value-text = 'General Material Data'.
      APPEND l_value TO li_list.
      CLEAR l_value.  l_value-key = '3'.
      l_value-text = 'Storage Location Data for Material'.
      APPEND l_value TO li_list.
      CLEAR l_value.  l_value-key = '4'.
      l_value-text = 'Units of Measure for Material'.
      APPEND l_value TO li_list.
      CLEAR l_value.
      l_name = 'ONE'.  CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = l_name
          values          = li_list
        EXCEPTIONS
          id_illegal_name = 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.ENDFORM. " f4_value_request_tabname*&----------------------------------------------------------------*
    *&      Form  f4_value_request_PB
    *       text
    *SUBROUTINE TO PROVIDE DROPDOWN VALUES TO LIST2FORM f4_value_request_pb.  DATA: l_name TYPE vrm_id,
            li_list TYPE vrm_values,
            l_value LIKE LINE OF li_list.  l_value-key = '1'.
      l_value-text = 'Sales Document: Header Data'.
      APPEND l_value TO li_list.
      CLEAR l_value.  l_value-key = '2'.
      l_value-text = 'Sales Document: Item Data'.
      APPEND l_value TO li_list.
      CLEAR l_value.  l_value-key = '3'.
      l_value-text = 'Sales Document:Header Status'.
      APPEND l_value TO li_list.
      CLEAR l_value.  l_value-key = '4'.
      l_value-text = 'Sales Document: Item Status'.
      APPEND l_value TO li_list.
      CLEAR l_value.
      l_name = 'TWO'.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = l_name
          values          = li_list
        EXCEPTIONS
          id_illegal_name = 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.
    ENDFORM. " f4_value_request_PB*&----------------------------------------------------------------*
    *&      Form  f4_value_request_PC
    *       text
    *SUBROUTINE TO PROVIDE DROPDOWN VALUES TO LIST3FORM f4_value_request_pc.  DATA: l_name TYPE vrm_id,
            li_list TYPE vrm_values,
            l_value LIKE LINE OF li_list.  l_value-key = '1'.
      l_value-text = 'HR Master :Infotype 0001 (Org. Assignment)'.
      APPEND l_value TO li_list.
      CLEAR l_value.  l_value-key = '2'.
      l_value-text = 'Address Infotype 0006'.
      APPEND l_value TO li_list.
      CLEAR l_value.  l_value-key = '3'.
      l_value-text = 'Education Infotype 0022'.
      APPEND l_value TO li_list.
      CLEAR l_value.  l_value-key = '4'.
      l_value-text = 'Basic Pay Infotype 0008'.
      APPEND l_value TO li_list.
      CLEAR l_value.
      l_name = 'THREE'.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = l_name
          values          = li_list
        EXCEPTIONS
          id_illegal_name = 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.
    ENDFORM. " f4_value_request_PC
    *&      Form  OUTPUT
    *       text
    *      -->P_TABLENAME  text
    *fINAL OUTPUT
    FORM output.  DATA p_table(10).  p_table = tablename.*popup to display teh selected table and
    *Continue button is clicked
      CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
        EXPORTING
          titel        = 'User Selections '
          textline1    = p_table
          textline2    = 'is the Selected table'
          start_column = 25
          start_row    = 6.*assigning the table value in p_table to the
    * Table in SE16 transaction by explicitly calling
      SET PARAMETER ID 'DTB' FIELD p_table.
      CALL TRANSACTION 'SE16'.
    ENDFORM.                    "OUTPUT
    Regards,
    Manoj Kumar P

  • How to hide a block in Selection screen ?

    Hello abap gurus,
    I have a requirement where I have to hide a block on Selection screen. Can anyone of u give the command for that or code..
    Its urgent !
    Om Sai Ram,
    aRgD

    Hi,
    Just paste the following code in abap editor.
    *Selectionscreen elements..............................................
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    PARAMETERS:
      p_uname     LIKE sy-uname
                  MODIF ID bl1.            " User name
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
    PARAMETERS:
      p_fname(10) TYPE c MODIF ID bl2
                         OBLIGATORY,       " First name
      p_lname(10) TYPE c MODIF ID bl2
                         OBLIGATORY,       " Last name
      p_empid(5)  TYPE n MODIF ID bl2
                         OBLIGATORY.       " Employee id
    SELECTION-SCREEN END OF BLOCK b2.
    *" Data declarations...................................................
    Work variables                                                      *
    DATA:
      w_uname     LIKE sy-uname.           " User name
                 AT SELECTION-SCREEN OUTPUT EVENT                       *
    AT SELECTION-SCREEN OUTPUT.
      PERFORM validate.
                AT SELECTION-SCREEN ON FIELD EVENT                      *
    AT SELECTION-SCREEN ON p_uname.
      PERFORM validate_uname.
                      END OF SELECTION EVENT                            *
    END-OF-SELECTION.
      PERFORM output.
    FORM VALIDATE                                                      *
    This subroutine disables all parameters if user name is not        *
    initialized or user name is not valid.                             *
    There are no interface parameters to be passed to this subroutine. *
    FORM validate.
      w_uname = sy-uname.
      IF p_uname IS INITIAL OR p_uname NE w_uname.
        LOOP AT SCREEN.
          IF screen-group1 EQ 'BL2'.
            screen-active = '0'.
          ELSE.
            screen-active = '1'.
          ENDIF.                           " IF screen-group1 EQ 'BL2'.
          MODIFY SCREEN.
        ENDLOOP.                           " LOOP AT SCREEN.
      ELSEIF p_uname EQ sy-uname.
        LOOP AT SCREEN.
          IF screen-group1 = 'BL1'.
            screen-active = 0.
            MODIFY SCREEN.
          ELSEIF screen-group1 = 'BL2'.
            screen-active = 1.
            screen-output = 1.
            screen-input = 1.
            screen-invisible = 0.
          ENDIF.                           " IF screen-group1 = 'BL1'.
          MODIFY SCREEN.
        ENDLOOP.                           " LOOP AT SCREEN.
      ENDIF.                               " IF p_uname IS INITIAL...
    ENDFORM.                               " VALIDATE
    Form VALIDATE_UNAME                                                *
    This subroutine gives error message and validates the user name.   *
    There are no interface parameters to be passed to this subroutine. *
    FORM validate_uname .
      IF p_uname IS INITIAL.
        MESSAGE 'Enter the user name'(001) TYPE 'E'.
      ELSEIF p_uname NE sy-uname.
        MESSAGE 'Authorization unsuccessful'(002) TYPE 'E'.
      ENDIF.                               " IF p_uname IS INITIAL.
    ENDFORM.                               " VALIDATE_UNAME
    Form  OUTPUT                                                       *
    This subroutine is used to print the output.                       *
    There are no interface parameters to be passed to this subroutine. *
    FORM output .
      IF p_fname IS NOT INITIAL.
        WRITE: / 'First name:'(003),p_fname.
        WRITE: / 'Last name:'(004),p_lname.
        WRITE: / 'Employee id:'(005),p_empid.
      ENDIF.                               " IF p_fname IS NOT INITIAL.
    ENDFORM.                               " OUTPUT
    I think this solves your problem.
    Reward if it helps you.....
    Regards,
    Sandhya

  • Alv Output after dynamic selection screen

    Hi Guys
    I have coded a dynamic selection screen (shown below). I want to create an ALV report based on what the user enters in the selection screen. Is the right way of doing this to code an IF s_matnr is not initial statement then call all the subroutines for output of material data and then else call a second batch of subroutines for billing data. It seems a bit long winded to me but I haven't been able to find anything on google that clearly explains the approach.
    REPORT  ZTREVOR_DYNAMIC_ALV_MAKT_VBRP.
    TABLES : makt,
    marc,
    t001w,
    vbrk,
    vbrp.
    CONSTANTS : c_yes TYPE c VALUE '1',
    c_no TYPE c VALUE '0'.
    Selection-screen begin of block b1 with frame title text-sc1.
    PARAMETERS : p_opt1 TYPE c RADIOBUTTON GROUP radi USER-COMMAND op1, "Material
    p_opt2 TYPE c RADIOBUTTON GROUP radi.                  "Billing Document
    Selection-screen end of block b1.
    Selection-screen begin of block b2 with frame title text-sc2.
    SELECT-OPTIONS : s_matnr FOR makt-matnr MODIF ID op1, "Material
    s_vbeln FOR vbrp-vbeln MODIF ID op2. "Billing Document
    Selection-screen end of block b2.
    T SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN .
    IF screen-group1 = 'OP1' .
    IF p_opt1 = 'X' .
    screen-invisible = c_no .
    screen-active = c_yes .
    ELSE.
    screen-invisible = c_yes .
    screen-active = c_no .
    ENDIF.
    MODIFY SCREEN .
    ENDIF.
    IF screen-group1 = 'OP2' .
    IF p_opt2 = 'X' .
    screen-invisible = c_no .
    screen-active = c_yes .
    ELSE.
    screen-invisible = c_yes .
    screen-active = c_no .
    ENDIF.
    MODIFY SCREEN .
    ENDIF.
    ENDLOOP.

    Hi,
    First of all, you should check your radiobutton instead of select-option...
    Then you will have to build the output internal table dynamically based on the option chosen. There are lot of example on SDN...
    Here is a start: http://wiki.sdn.sap.com/wiki/display/Snippets/Tutorialabap-CodeforDynamicAlv+grid
    Kr,
    m.

  • Checking the Selection Screen Parameters

    Dear All,
    We are uploading data from various excel sheets into SAP tables. Now at selection screen I just want to check if the location specified exists or not ie. if I have created one variant on one system & then if I am running that report from other system using the variants, since the files does not exists it should throw the error and should return to the selection screen to enter the new parameters.
    Please help me in the code, I am attaching my code herewith.
    Waiting for ur responses,
    Nishu
    *********************CODE***************************
    tables: bseg, zfi_tbl_qty, t001, tgsb.
    data:
            t_excel like alsmex_tabline occurs 0 with header line,
            l_excelfile(128)  type c,
            l_excelfile1(128) type c,
            l_excelfile2(128) type c,
            l_excelfile3(128) type c.
    data: begin of t_bukrs_tmp occurs 0,
             bukrs like t001-bukrs,
          end of t_bukrs_tmp.
    data: begin of t_gsber_tmp occurs 0,
             gsber like tgsb-gsber,
          end of t_gsber_tmp.
    ranges: r_bukrs_tmp for t001-bukrs,
            r_gsber_tmp for tgsb-gsber.
    data: begin of t_type,
           bukrs like bseg-bukrs,
           gsber like bseg-gsber,
           count type i,
         end of t_type.
    data: l_charlen1 type i,
          l_charlen2 type i.
    data:  t_type2 like t_type occurs 0 with header line,
           t_type2_tmp like t_type occurs 0 with header line.
    data:  l_end_row type i,
           l_endrow1 type i,
           l_count type i,
           v_bukrs like bseg-bukrs.
    data : q_count type i value 1,
           v_flag  type i value 0,
           v_gsber like t_type2-gsber.
    data: l_var type c.
    selection-screen begin of block b1 with frame title text-001.
    parameter :  p_file1  type rlgrap-filename obligatory,
                 p_file2  type rlgrap-filename obligatory,
                 p_file3  type rlgrap-filename obligatory,
                 p_file4  type rlgrap-filename obligatory.
    selection-screen end of block b1.
    *perform updation_tbl.
    *clearing the contents of database table before uploading a new file everytime
    delete from zfi_tbl_qty.
    *selection-screen
    at selection-screen on value-request for p_file1.
      call function 'KD_GET_FILENAME_ON_F4'
        exporting
          field_name = p_file1
        changing
          file_name  = p_file1.
    at selection-screen on value-request for p_file2.
      call function 'KD_GET_FILENAME_ON_F4'
        exporting
          field_name = p_file2
        changing
          file_name  = p_file2.
    at selection-screen on value-request for p_file3.
      call function 'KD_GET_FILENAME_ON_F4'
        exporting
          field_name = p_file3
        changing
          file_name  = p_file3.
    at selection-screen on value-request for p_file4.
      call function 'KD_GET_FILENAME_ON_F4'
        exporting
          field_name = p_file4
        changing
          file_name  = p_file4.
    at selection-screen.
      l_excelfile  = p_file1.
      l_excelfile1 = p_file2.
      l_excelfile2 = p_file3.
      l_excelfile3 = p_file4.
    if l_excelfile = l_excelfile1 or l_excelfile = l_excelfile2 or l_excelfile = l_excelfile3
        or l_excelfile1 = l_excelfile2 or l_excelfile1 = l_excelfile3 or l_excelfile2 = l_excelfile3.
            message e010(zn) with 'Files with the same name found Please enter again. '.
    endif.
    start-of-selection.
        select bukrs
               from t001
               into corresponding fields of table t_bukrs_tmp.
        loop at t_bukrs_tmp.
           r_bukrs_tmp-sign = 'I'.
           r_bukrs_tmp-option = 'EQ'.
           r_bukrs_tmp-low = t_bukrs_tmp-bukrs.
           append r_bukrs_tmp.
        endloop.
        select gsber
               from tgsb
               into corresponding fields of table t_gsber_tmp.
        loop at t_gsber_tmp.
           r_gsber_tmp-sign = 'I'.
           r_gsber_tmp-option = 'EQ'.
           r_gsber_tmp-low = t_gsber_tmp-gsber.
           append r_gsber_tmp.
        endloop.
      perform upload_table using l_excelfile   5 2 6 4000.
      perform upload_table using l_excelfile1  5 2 6 4000.
      perform upload_table using l_excelfile2  5 2 6 4000.
      perform upload_table using l_excelfile3  5 2 6 4000.
    if sy-subrc = 0.
      message i010(zn) with 'Files Uploaded Successfully.'.
    if sy-subrc <> 0.
    message e398(00) with 'Files Not Found'.
      leave to screen 0.
    endif.
    ************Calling the other program
    SUBMIT ZFI_REP_IS_CHARGES_POST1.
    *and return.
    *******************Calling the subroutine.
    form upload_table using filename
                           i_begin_col type i
                           i_begin_row type i
                           i_end_col type i
                           i_end_row type i.
      clear   : t_excel.
      refresh : t_excel.
      v_flag = v_flag + 1.
      call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
        exporting
          filename                = filename
          i_begin_col             = 5
          i_begin_row             = 2
          i_end_col               = 6
          i_end_row               = 4000
        tables
          intern                  = t_excel
        exceptions
          inconsistent_parameters = 1
          upload_ole              = 2
          others                  = 3.
      case v_flag.
        when '1'.
          perform fill_int_tab.
        when '2'.
          perform fill_int_tab.
        when '3'.
          perform fill_int_tab.
        when '4'.
          perform fill_int_tab.
      endcase.
    endform.                    "upload_table
    *uploading data from internal table into database table
    *&      Form  fill_int_tab
          text
    -->  p1        text
    <--  p2        text
    form fill_int_tab .
      clear   : t_type2, q_count.
      refresh : t_type2.
      describe table t_excel lines l_endrow1.
      l_endrow1 = l_endrow1 / 2.
      do.
        loop at t_excel where row = q_count.
          if t_excel-col = 1.
            t_type2-gsber = t_excel-value.
          elseif t_excel-col = 2.
            t_type2-bukrs = t_excel-value.
          endif.
        endloop.
        l_charlen1 = strlen( t_type2-bukrs ).
        l_charlen2 = strlen( t_type2-gsber ).
        if ( t_type2-bukrs <> ' ' and t_type2-gsber <> ' ' ).
          if ( l_charlen1 = 4 and l_charlen2 = 4 ).
            append t_type2. clear t_type2.
          endif.
        endif.
        q_count = q_count + 1.
        if q_count > l_endrow1.
          exit.
        endif.
      enddo.
    t_type2_tmp[] = t_type2[].
    clear t_type2.
    refresh t_type2.
    loop at t_type2_tmp where bukrs in r_bukrs_tmp
                      and gsber in r_gsber_tmp.
      move-corresponding t_type2_tmp to t_type2.
      append t_type2.
    endloop.
      sort t_type2 by bukrs gsber.
      loop at t_type2.
        clear v_gsber.
        l_count = l_count + 1 .
        v_gsber = t_type2-gsber.
        at end of gsber.
         at end of bukrs.
            zfi_tbl_qty-company_code = t_type2-bukrs.
            zfi_tbl_qty-barea = v_gsber.
            zfi_tbl_qty-comb = l_count.
            if v_flag = 1.
              zfi_tbl_qty-type = 'A'.    " Item 1
            endif.
            if v_flag = 2.
              zfi_tbl_qty-type = 'B'.    " Item 2
            endif.
            if v_flag = 3.
              zfi_tbl_qty-type = 'C'.    " Item 3
            endif.
            if v_flag = 4.
              zfi_tbl_qty-type = 'D'.    " Item 4
            endif.
         insert  zfi_tbl_qty from zfi_tbl_qty.
          clear l_count.
        endat.
         endat.
      endloop.
    endform.                    " fill_int_tab

    Hi,
    After calling this FM:
    call function 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    exporting
    filename = filename
    i_begin_col = 5
    i_begin_row = 2
    i_end_col = 6
    i_end_row = 4000
    tables
    intern = t_excel
    exceptions
    inconsistent_parameters = 1
    upload_ole = 2
    others = 3.
    *-> try following code:
    if sy-subrc = '2'.
    message 'File not Found' type 'I'.
          leave list-processing.
    endif.
    Regards,
    Kalyan

  • How to can we do selection-screen modification for LDB?

    Hi All,
    I have custom field in my selection-screen of LDB PNP.
    Can you people please let me know how can I put the selection-screen modificaiton For ex:
    i have created
    parameters a as checbox.
    select-options: p_btrtl for p0001-btrtl no-intervals.
    now If the check box is selected then p_btrtl we can enter values or esle If check box is not selected then p_btrtl will be grayed out, ( I.e. SCREEN-INPUT = 0)
    This is simple from ABAP without LDB. But with LDB can we achieve?????????????
    Satish
    Edited by: Satish Vasireddy on Jun 23, 2010 4:05 PM

    you can use the following logic for the additional selection validation. I have done by using PNP LDB. Ex : I have done for one of the field in IT0377.
    SELECT-OPTIONS: s_bplan FOR p0377-bplan.
    *&      Form  check_selection_0377
      This subroutine is used to check the selection screen
    FORM check_selection_0377.
      LOOP AT p0377 WHERE pltyp  IN s_bplan
                     AND levl1 IN s_lti
                     AND   begda LE pn-endda
                     AND   endda GE pn-begda.
        CALL FUNCTION 'HR_CHECK_AUTHORITY_INFTY'
          EXPORTING
            tclas            = 'A'
            pernr            = pernr-pernr
            infty            = p0377-infty
            subty            = p0377-subty
            begda            = pn-begda
            endda            = pn-endda
            level            = 'R'
          EXCEPTIONS
            no_authorization = 1
            internal_error   = 2
            OTHERS           = 3.
        IF NOT sy-subrc IS INITIAL.
          DELETE p0377.
        ENDIF.
      ENDLOOP.
    selection not found and no value selected
      IF sy-subrc NE 0.
        READ TABLE s_bplan.
        IF sy-subrc EQ 0.
          REJECT.
        ENDIF.
        READ TABLE s_lti.
        IF sy-subrc EQ 0.
          REJECT.
        ENDIF.
      ENDIF.
    ENDFORM.                    " check_selection_0377
    Regards,
    Preetham

  • Submit statement without executing AT SELECTION SCREEN event

    hi,
      In my report since the input data is very large iam spliiting the input data batch by batch. Iam executing the report for the first batch input data and retriving the results for it.
       Then to find the result for the enxt batch input data , iam using submit statement to execute the report again. While executing the report now it should directly start from the start-of-selection event only. It should not go for At selection screen or initialization events.
    Can anyone help me how to execute the report for second time from start-of-selection event.
    Regards,
    Phyrose.

    Is code written directly under START-OF-SELECTION or you are calling subroutine in START-OF-SELECTION?
    I would suggest you to call the subroutines written under START-OF-SELECTION.
    PERFORM form IN PROGRAM prog.

  • Selection screen problem in module pool

    Hi friends,
    I am working on module pool programming, I need to put select screen on the screen of the module pool porgramming. I used Input/Output field to do that and activated. But I am getting message invalid field format (screen error) can any one tell me why I am not able to run the seletion screen when I am using input/output field, also please let me know how to solve this problem.
    Regards,
    Line

    Hello,
    Think that this is useful for u/
    SELECTION-SCREEN - Defining selection screens
    Variants:
    1a. SELECTION-SCREEN BEGIN OF SCREEN scr.
    1b. SELECTION-SCREEN END   OF SCREEN scr.
    2. SELECTION-SCREEN BEGIN OF SCREEN scr AS SUBSCREEN.
    Effect
    Defines a selection screen with the number scr. scr may be up to 4 digits.
    SELECTION-SCREEN BEGIN OF SCREEN scr.
    Additions:
    (zu SELECTION-SCREEN BEGIN OF SCREEN scr) 1. ... TITLE title
    2. ... AS WINDOW
    Notes
    In reports (type 1 programs), a selection screen with number 1000 is created automatically when you use the SELECT-OPTIONS, PARAMETERS and SELECTION-SCREEN statments. This selection screen appears when you SUBMIT the report.
    In any type of program (apart from subroutine pools - type S), you can define further selection screens using SELECT-OPTIONS, PARAMETERS and SELECTION-SCREEN. You enclose these statements between the SELECTION-SCREEN BEGIN OF SCREEN and SELECTION-SCREEN END OF SCREEN statements.
    You call these screens using the CALL SELECTION-SCREEN statement.
    Screen number 1000 is not allowed (reserved for standard selection screen).
    When you generate the program, all user-defined selection screens are also generated.
    Within a report (type 1 program), all SELECT-OPTIONS, PARAMETERS and SELECTION-SCREEN statements outside a SELECTION-SCREEN BEGIN/END OF SCREEN block form part of selection screen 100 (standard selection screen)
    Regards,
    LIJO JOHN.

  • To create Dynamic Selection screen using Key Fields

    Hi All,
    We have a requirement where we want to create Dynamic selection screen using Key fileds of Z-table or any standard table.
    Please provide some solution if you have worked in this area.
    Thanks in Advance,
    Anand Raj Kuruba

    Hi,
    You can use the following statement.
    SELECTION-SCREEN DYNAMIC SELECTIONS FOR NODE|TABLE <node>.
    declares a node <node> of a logical database for dynamic selections in the selection include.
    To use the dynamic selections in the SELECT statements of the subroutine PUT_<node>, you must use the data object DYN_SEL. The data object DYN_SEL is automatically generated in the logical database program as follows:
    TYPE-POOLS RSDS.
    DATA DYN_SEL TYPE RSDS_TYPE.
    You do not have to program these lines yourself. The data object DYN_SEL is available in the database program but not in a connected executable program.
    The type RSDS_TYPE of the data object is defined in the type group RSDS as follows:
    TYPE-POOL RSDS.
    WHERE-clauses ------------------------------
    TYPES: RSDS_WHERE_TAB LIKE RSDSWHERE OCCURS 5.
    TYPES: BEGIN OF RSDS_WHERE,
    TABLENAME LIKE RSDSTABS-PRIM_TAB,
    WHERE_TAB TYPE RSDS_WHERE_TAB,
    END OF RSDS_WHERE.
    TYPES: RSDS_TWHERE TYPE RSDS_WHERE OCCURS 5.
    Expressions Polish notation ---------------
    TYPES: RSDS_EXPR_TAB LIKE RSDSEXPR OCCURS 10.
    TYPES: BEGIN OF RSDS_EXPR,
    TABLENAME LIKE RSDSTABS-PRIM_TAB,
    EXPR_TAB TYPE RSDS_EXPR_TAB,
    END OF RSDS_EXPR.
    TYPES: RSDS_TEXPR TYPE RSDS_EXPR OCCURS 10.
    Selections as RANGES-tables -----------------
    TYPES: RSDS_SELOPT_T LIKE RSDSSELOPT OCCURS 10.
    TYPES: BEGIN OF RSDS_FRANGE,
    FIELDNAME LIKE RSDSTABS-PRIM_FNAME,
    SELOPT_T TYPE RSDS_SELOPT_T,
    END OF RSDS_FRANGE.
    TYPES: RSDS_FRANGE_T TYPE RSDS_FRANGE OCCURS 10.
    TYPES: BEGIN OF RSDS_RANGE,
    TABLENAME LIKE RSDSTABS-PRIM_TAB,
    FRANGE_T TYPE RSDS_FRANGE_T,
    END OF RSDS_RANGE.
    TYPES: RSDS_TRANGE TYPE RSDS_RANGE OCCURS 10.
    Definition of RSDS_TYPE
    TYPES: BEGIN OF RSDS_TYPE,
    CLAUSES TYPE RSDS_TWHERE,
    TEXPR TYPE RSDS_TEXPR,
    TRANGE TYPE RSDS_TRANGE,
    END OF RSDS_TYPE.
    For more information, please check this link.
    http://help.sap.com/saphelp_nw04/helpdata/en/67/93b80914a911d2953c0000e8353423/content.htm
    Regards,
    Ferry Lianto

  • Adding functionality to the pushbuttons in selection screen

    Hi,
    Where to add the logic to the pushbutton in the selection screen.In the PBO or PAI of that screen.If possible can anyone send an example for that?

    Hey!
      Check out this sample code.
    REPORT z_prog.
    DATA:
      BEGIN OF fs_spfli,
        carrid   LIKE spfli-carrid,        " Airline Code
        connid   LIKE spfli-connid,        " Flight Connection Number
        airpfrom LIKE spfli-airpfrom,      " Departure airport
        airpto   LIKE spfli-airpto,        " Destination airport
        deptime  LIKE spfli-deptime,       " Departure time
        arrtime  LIKE spfli-arrtime,       " Arrival time
      END OF fs_spfli,
      BEGIN OF fs_sflight,
        carrid   LIKE sflight-carrid,       " Airline Code
        connid   LIKE sflight-connid,       " Flight Connection Number
        fldate   LIKE sflight-fldate,       " Flight date
        seatsmax LIKE sflight-seatsmax,     " Maximum seats in economy class
        seatsocc LIKE sflight-seatsocc,     " Occupied seats in economyclass
      END OF fs_sflight,
      w_checkbox TYPE c,                    " Variable for checkbox
      w_currentline TYPE i,                 " Variable to display current
                                            " line
      w_lines TYPE i,
      w_read TYPE c .
    * Internal Table to hold flight schedule information                  *
    DATA:
      t_spfli LIKE
        TABLE OF
              fs_spfli.
    * Internal Table to hold flight information                           *
    DATA:
      t_sflight LIKE
          TABLE OF
                fs_sflight,
      t_sflight1 LIKE t_sflight.
    *    START-OF-SELECTION Event                                         *
    START-OF-SELECTION.
      PERFORM get_data_spfli.
    *    END-OF-SELECTION Event                                           *
    END-OF-SELECTION.
      SET PF-STATUS 'MENU'.
      PERFORM display_data_spfli.
    *    TOP-OF-PAGE Event                                                *
    TOP-OF-PAGE.
      PERFORM header_table_spfli.
    *    AT LINE-SELECTION EVENT                                          *
    AT LINE-SELECTION.
      SET PF-STATUS space.
      IF sy-lsind EQ 1 AND sy-lilli GE 4.
        PERFORM get_data_sflight.
        PERFORM display_data_sflight.
        PERFORM flag_line.
      ENDIF.                               " IF sy-lsind EQ 1..
    *    AT USER-COMMAND                                                  *
    AT USER-COMMAND.
      IF sy-lsind EQ 1.
        SET PF-STATUS space.
        CASE sy-ucomm.
          WHEN 'DISPLAY'.
            PERFORM get_data_sflight1.
            PERFORM display_data_sflight.
          WHEN 'SELECTALL'.
            PERFORM select_all.
            PERFORM flag_line.
          WHEN 'DESELECTAL'.
            PERFORM deselect_all.
            PERFORM flag_line.
        ENDCASE.                           " CASE sy-ucomm
      ENDIF.                               " IF sy-lsind EQ 1
    *    TOP-OF-PAGE DURING LINE-SELECTION                                *
    TOP-OF-PAGE DURING LINE-SELECTION.
      PERFORM sec_list_heading.
    *&      Form  get_data_spfli
    *  This subroutine fetches the data from SPFLI
    * This subroutine does not have parameters to pass
    FORM get_data_spfli .
      SELECT carrid                        " Airline Code
             connid                        " Flight Connection Number
             airpfrom                      " Departure airport
             airpto                        " Destination airport
             deptime                       " Departure time
             arrtime                       " Arrival time
        FROM spfli
        INTO TABLE t_spfli.
    ENDFORM.                               " GET_DATA_SPFLI
    *&      Form  display_data_spfli
    * This subroutine displays the data of SPFLI
    * This subroutine does not have parameters to pass
    FORM display_data_spfli .
      LOOP AT t_spfli INTO fs_spfli.
        WRITE: /02 w_checkbox AS CHECKBOX,
                05 w_read,
                   fs_spfli-carrid UNDER text-001,
                   fs_spfli-connid UNDER text-002,
                   fs_spfli-airpfrom UNDER text-003,
                   fs_spfli-airpto UNDER text-004,
                   fs_spfli-deptime UNDER text-005,
                   fs_spfli-arrtime UNDER text-006.
        HIDE:
          fs_spfli-carrid,
          fs_spfli-connid.
      ENDLOOP.                             " LOOP AT t_spfli..
    ENDFORM.                               " DISPLAY_DATA_SPFLI
    *&      Form  header_table_spfli
    * This subroutine diplays the headings of table spfli
    * This subroutine does not have parameters to pass
    FORM header_table_spfli .
      WRITE: /10 text-001 COLOR 4,
              25 text-002 COLOR 4,
              40 text-003 COLOR 4,
              55 text-004 COLOR 4,
              70 text-005 COLOR 4,
              85 text-006 COLOR 4.
    ENDFORM.                               " HEADER_TABLE
    *&      Form  get_data_sflight
    * This subroutine fetches the data from SFLIGHT
    * This subroutine does not have interface parameters to pass
    FORM get_data_sflight .
      SELECT carrid                        " Airline Code
             connid                        " Flight Connection Number
             fldate                        " Flight date
             seatsmax                      " Maximum seats in economy class
             seatsocc                      " Occupied seats in economyclass
        FROM sflight
        INTO TABLE t_sflight
       WHERE carrid EQ fs_spfli-carrid
         AND connid EQ fs_spfli-connid.
    ENDFORM.                               " GET_DATA_SFLIGHT
    *&      Form  display_data_sflight
    * This subroutine displays the SFLIGHT data
    * This subroutine does not have interface parameters to pass
    FORM display_data_sflight .
      LOOP AT t_sflight INTO fs_sflight.
        WRITE: / fs_sflight-carrid UNDER text-001,
                 fs_sflight-connid UNDER text-002,
                 fs_sflight-fldate UNDER text-007,
                 fs_sflight-seatsmax UNDER text-008 LEFT-JUSTIFIED,
                 fs_sflight-seatsocc UNDER text-009 LEFT-JUSTIFIED.
      ENDLOOP.
        CLEAR: fs_sflight.
    ENDFORM.                               " DISPLAY_DATA_sflight
    *&      Form  sec_list_heading
    *  This subroutine diplays the headings of table spfli
    * This subroutine does not have interface parameters to pass
    FORM sec_list_heading .
      WRITE: /2 text-001 COLOR 4,
             15 text-002 COLOR 4,
             33 text-007 COLOR 4,
             45 text-008 COLOR 4,
             60 text-009 COLOR 4.
    ENDFORM.                               " SEC_LIST_HEADING
    *&      Form  get_data_sflight1
    * This subroutine displays the data from SFLIGHT according to checkbox
    * clicked.
    * This subroutine does not have interface parameters to pass
    FORM get_data_sflight1 .
      DATA:
        lw_checkbox TYPE c.
      DESCRIBE TABLE t_spfli LINES w_lines.
      DO w_lines TIMES.
        w_currentline = 3 + sy-index.
        CLEAR:
          w_checkbox,
          fs_spfli.
        READ LINE w_currentline FIELD VALUE
          w_checkbox INTO lw_checkbox
          fs_spfli-carrid INTO fs_spfli-carrid
          fs_spfli-connid INTO fs_spfli-connid.
        IF sy-subrc EQ 0.
          IF lw_checkbox EQ 'X'.
            SELECT carrid                  " Airline Code
                   connid                  " Flight Connection Number
                   fldate                  " Flight Date
                   seatsmax                " Max Seats
                   seatsocc                " Occupied Seats
              FROM sflight
              INTO TABLE t_sflight1
             WHERE carrid EQ fs_spfli-carrid
               AND connid EQ fs_spfli-connid.
            IF sy-subrc EQ 0.
              APPEND LINES OF t_sflight1 TO t_sflight.
            ENDIF.                         " IF sy-subrc EQ 0.
          ENDIF.                           " IF lw_checkbox EQ 'X'
        ENDIF.                             " IF sy-subrc EQ 0.
      ENDDO.                               " DO w_lines TIMES
    ENDFORM.                               " GET_DATA_SFLIGHT1
    *&      Form  select_all
    * This subroutine selects all the records of SPFLI
    * This subroutine does not have interface parameters to pass
    FORM select_all .
      DESCRIBE TABLE t_spfli LINES w_lines.
      DO w_lines TIMES.
        w_currentline = sy-index + 3.
        READ LINE w_currentline FIELD VALUE
        w_checkbox INTO w_checkbox.
        IF sy-subrc = 0.
          MODIFY LINE w_currentline FIELD VALUE
          w_checkbox FROM 'X'.
        ENDIF.                             " IF sy-subrc = 0.
      ENDDO.                               " DO lw_line TIMES.
    ENDFORM.                               " SELECT_ALL
    *&      Form  deselect_all
    * This subroutine deselects all the records of SPFLI
    * This subroutine does not have interface parameters to pass
    FORM deselect_all .
      DESCRIBE TABLE t_spfli LINES w_lines.
      DO w_lines TIMES.
        w_currentline = sy-index + 3.
        READ LINE w_currentline FIELD VALUE
        w_checkbox INTO w_checkbox.
        IF sy-subrc = 0.
          MODIFY LINE w_currentline FIELD VALUE
          w_checkbox FROM ' '.
        ENDIF.                             " IF sy-subrc = 0.
      ENDDO.                               " DO lw_line TIMES.
    ENDFORM.                               " DESELECT_ALL
    *&      Form  flag_line
    * This subroutine flags the line which has been read
    * This subroutine does not have interface parameters to pass
    FORM flag_line .
      DESCRIBE TABLE t_spfli LINES w_lines.
      DO w_lines TIMES.
        w_checkbox = 'X'.
        READ LINE sy-lilli FIELD VALUE
          w_read INTO w_read
          w_checkbox INTO w_checkbox.
        IF sy-subrc EQ 0.
          MODIFY CURRENT LINE
          FIELD FORMAT w_checkbox INPUT OFF
          FIELD VALUE w_read FROM '*'.
        ENDIF.                             " IF sy-subrc EQ 0
      ENDDO.                               " DO w_lines TIMES
    ENDFORM.                               " FLAG_LINE
    Regards
    Abhijeet
    Edited by: Abhijeet Kulshreshtha on Jul 11, 2008 9:10 AM

  • Reading Text File from selection Screen and populating table (Urgent)

    Hi All,
    I have some requirment like i in my report i have to initial my Input feild from text file is it good to populate a internal table or range.
    I have three feild in a excel file that entry can more then 500
    data example
    Matnr Date             Day
    A1     10.07.2007    12
    B1     10.07.2007    10
    A1     19.07.2007    15
    C1     20.08.2007    30
    E1     11.09.2007    12
    This report for Price Protection claim.
    even u can help me out with proper table plz this is urgent.

    Hi..
    <b>parameters:</b>
      p_file(50) type c.
    <b>data:</b>
      begin of itab occurs 0,
         matnr type vbak-matnr,
         date type sy-datum,
         day(2) type n,
      end of itab.
    <b>at selection-screen on value-request for p_fname.</b>
      perform get_path.
    <b>start-of-selection.</b>
    <b>CALL FUNCTION 'GUI_UPLOAD'</b>
      <b>EXPORTING
        FILENAME                      =  p_fname
       FILETYPE                      = 'ASC'
       HAS_FIELD_SEPARATOR           = 'X'</b>
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
    <b>  TABLES
        DATA_TAB                      = itab</b>
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_READ_ERROR               = 2
      NO_BATCH                      = 3
      GUI_REFUSE_FILETRANSFER       = 4
      INVALID_TYPE                  = 5
      NO_AUTHORITY                  = 6
      UNKNOWN_ERROR                 = 7
      BAD_DATA_FORMAT               = 8
      HEADER_NOT_ALLOWED            = 9
      SEPARATOR_NOT_ALLOWED         = 10
      HEADER_TOO_LONG               = 11
      UNKNOWN_DP_ERROR              = 12
      ACCESS_DENIED                 = 13
      DP_OUT_OF_MEMORY              = 14
      DISK_FULL                     = 15
      DP_TIMEOUT                    = 16
      OTHERS                        = 17
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    This Sub routine is used to get the file name
    *There are no interface parameters passed to this subroutine.
    FORM get_path .
    CALL FUNCTION 'WS_FILENAME_GET'
    EXPORTING
       DEF_FILENAME            =  P_FNAME
      DEF_PATH               = ' '
      MASK                   = ' '
      MODE                   = ' '
      TITLE                  = ' '
    IMPORTING
       FILENAME                =  P_FNAME
      RC                     =
    EXCEPTIONS
       INV_WINSYS             = 1
       NO_BATCH               = 2
       SELECTION_CANCEL       = 3
       SELECTION_ERROR        = 4
       OTHERS                 = 5
    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_path
    data:

  • No values from selection screen

    Hi ppl,
    I have written a report program which has 3 parameters on the selection screen (Personnel number - pernr, trip number - reinr and status - abrec).
    I have a subroutine to check for the validity of the personnel number entered on the screen. The other two parameters do not have any validity check.
    I am using these 3 parameters in my SELECT statement. But, the problem is that when I execute it, at runtime, only the parameter for personnel number shows the value entered on the selection screen. The other two parameters show initial value at runtime though an entry has been made on the selection screen. Thus, it returns a subrc value of 4 though there are matching entries.
    Has anybody face such a problem? Please advise.
    Thanks.

    Hi David,
    Mentioning the event AT SELECTION SCREEN should resolve your problem.
    This will ensure that the values are picked from the selection sreen for all the parameters.
    (Else, if you do not use this event, your SELECT statement will not execute successfully the first time. But, if you execute your program again, it will fetch correct values.)
    Hope it solves your problem.
    Thanks,
    Dawood.

Maybe you are looking for

  • Recent Purchase - Released with Windows 7? How to get upgrade

    Good Day  Everyone I've recently purchased from a Lenovo dealer in RSA a W530 series, I've asked that the system get windows 8 on as it states windows 7/8 on the pc specs. Now that i have received it, it only has windows 7?   How would one go about c

  • Error importing iDVD projects - feature or bug?

    I know you used to be able to import projects created in iDVD into DVD Studio Pro, but is that a thing of the past? I see there's a current known issue where projects created in iDVD 5 or 6 will not import into DVD Studio Pro 3 or 4 http://docs.info.

  • Removing items from download folder/stack

    Just purchased a new macbook pro,great computer. Just wondering what to do with an app, coconut battery that I downloaded and it is in my downloads stacks folder. When i click on it, it opens in the dashboard, can I just move it to my desktop.

  • Missing Sainsburys Gift Card

    Hey Guys, My BT Infinity broadband was installed in January, but I still haven't received my £100 Sainsburys gift card (I already filled out the claim form online) Would anyone be able to help with this? Kind Regards, Michael

  • BW 3.5 courses

    I am thinking about doing the delta courses and possibly obtain the 3.5 delta certification. However, a good chunk of the course is on BPS, a new component of BW. I want to get some feedback from those whom have done the courses. Thanks in advance.