Validation check in selection screen

Hi experts,
I have a selection screen in which there are 2 radio buttons S1 n S2, and a text field (Parameter) namely P_PATH.
I am using a method (CALL METHOD cl_gui_frontend_services=>file_save_dialog) for selecting a file to save some
data in the XLS format.
Once the user selects S2, and presses the F4 help in the parameter P_PATH, this method is called.
  CALL METHOD cl_gui_frontend_services=>file_save_dialog
    EXPORTING
      window_title      = p_title
      default_file_name = p_filename
      file_filter       = l_file_filter
      initial_directory = p_download_path
    CHANGING
      filename          = p_filename
      path              = p_download_path
      fullpath          = p_full_path
      user_action       = g_user_action    "save or cancel
    EXCEPTIONS
      OTHERS            = 1.
The  g_user_action given here has a value of 9 in case the user selects the CANCEL button in the pop up that asks for the file name to be given for saving the file.
My req. is that when  g_user_action = 9. then the selection screen should be displayed back, with the S1 being selected (instead of the earlier S2).
I have done the below coding, but its not working. Is there something that I am doing incorrect?
SELECTION-SCREEN: BEGIN OF BLOCK b4 WITH FRAME TITLE text-004.
PARAMETERS: s1 RADIOBUTTON GROUP rad2 DEFAULT 'X' USER-COMMAND ac,
            s2 RADIOBUTTON GROUP rad2.
SELECTION-SCREEN: END OF BLOCK b4.
DATA: g_s1 type c.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_path.
PERFORM get_download_path
AT SELECTION-SCREEN OUTPUT.
if g_s1 = 'X'.
  s1 = 'X'.
  s2 = ''.
endif.
FORM get_download_path
the above method is called**
IF g_user_action = 9.
g_s1 = 'X'.
  exit.
endif.
ENDFORM.

Hello Ajay,
As Advait has pointed out already AT SELECTION_SCREEN OUTPUT event (or the PBO) does not trigger after the ON VALUE-REQUEST (or the POV) event.
You have to use the FM: DYNP_VALUES_UPDATE to update the selection-screen value.
FORM get_download_path
** the above method is called**
  data: dyname like d020s-prog,
        dynumb like d020s-dnum.
  data: it_dyfields type standard table of dynpread,
           st_dyfields type dynpread.
IF g_user_action = 9.
  dyname = sy-repid.
  dynumb = sy-dynnr.
  CLEAR s2.
  s1 = 'X'.
  move 'S1' to st_dyfields-fieldname.
  move  'X'  to st_dyfields-fieldvalue.
  append st_dyfields to it_dyfields.
  move 'S2' to st_dyfields-fieldname.
  CLEAR st_dyfields-fieldvalue.
  append st_dyfields to it_dyfields.
  call function 'DYNP_VALUES_UPDATE'
       exporting
            dyname               = dyname
            dynumb               = dynumb
       tables
            dynpfields           = it_dyfields
       exceptions
            invalid_abapworkarea = 1
            invalid_dynprofield  = 2
            invalid_dynproname   = 3
            invalid_dynpronummer = 4
            invalid_request      = 5
            no_fielddescription  = 6
            undefind_error       = 7
            others               = 8.
  check sy-subrc eq 0.
endif.
ENDFORM.
Check this out.
BR,
Suhas

Similar Messages

  • Validating field on  selection screen

    wht is the meaning of validation
    how to validate a particular field on selection screen
    suppose parameters:p_vkorg like vbak-vkorg.
    how to validate p_vkorg.
    pz give me coding

    Hello pavan,
    Validation means "checking whether the input which u are gining to the selection secreen is valid or not". means...
    Lets take your example only...
    parameters:p_vkorg like vbak-vkorg.
    in selection screen you will give inout in that parameter....
    users can give any input... lets suppose I'll give input as ABC... which is not in the table VBAK. No need to excute the code once we came to know that the input is not there in the table. So we will do validation like...
    at selection-screen on p_vkorg.
    select * from vbak where vkorg = p+vkorg. " This is the case with Parameter.
    at selection-screen on p_vkorg.
    Select * from vbak where vkorg = p+vkorg. " This is the case with Selct-option.
    if the input that u r giving is present in the table... the above stmt will execute successfully, otherwise not.
    You can make use of System variable SY-SUBRC and you can go ahead with ur coding...
    Reward If Helpful
    Regards
    Sasidhar Reddy Matli.
    Message was edited by:
            Sasidhar Reddy Matli

  • Suggest the way while validating fields in selection-screen

    Hi Experts,
    I am not able to open multiple selection screen for select-options because when i tried to open, it triggers AT selection-screen event in which some validations are happened.
    If any of the validation fails, it will give message.
    Please suggest me the way how i can avoid that.
    Thank you very much for your help
    Regards
    Gopal

    Hello,
             I believe you are talking about the Multiple Selections Option.
             There are two cases here. For both the Cases, use the Following Logic in the At-Selection Screen Event.
    If your Select-Options Variable is not declared as OBLIGATORY, then use this Logic.
    In the At Selection-Screen Event, check the following Condition.
          IF SY-UCOMM NE SSCRFIELDS-UCOMM.
              Message 'Enter atleast 1 Value' Type 'E'.
          ENDIF.
          This will avoid throwing an Error when you click on the Multiple Selections Option.
    If your Select-Options Variable is Declared as Mandatory, the above logic does not work. So, what you can do is,
    Do not make it Obligatory. But use the below Logic.
    IF S_MATNR is Initial.
        CHECK NOT SY-UCOMM EQ SSCRFIELDS-UCOMM.
        Message 'Enter atleast 1 Value' Type 'E'.
    ENDIF.
    Hope it was helpful.
    Thanks and Regards,
    Venkat Phani Prasad Konduri
    Edited by: Konduri Venkata Phani Prasad on Sep 12, 2008 2:48 AM

  • Validation Check in Select Options

    Hi All,
         I have a select-options variable. I want to write a check that the user doesnot enter any values other than 04,03 and 07. Can i write this validation check because the select options table can have many values in the option field and two values in the sign field.
    Thanks & Regards,
    Rahul Rathi

    i,
        use below logic
         select-options s_matnr for mara-matnr no intervals.
       at selection-screen.
      ranges r_matnr for mara-matnr.
      R_matnr-LOW = '04'.
      r_matnr-sign = 'I'.
      r_metnr-option = 'EQ'.
      append r_matnr.
      R_matnr-LOW = '03'.
      append r_matnr.
      R_matnr-LOW = '07'.
      append r_matnr.
    clear r_matnr.
    select single matnr from mara into mara-matnr
         where matnr in r_matnr.
    if sy-subrc <> 0.
    message e00 'enter values in range '03,04,07'
    endif.
    or
    you can default this value
    at selection-screen output.
      ranges r_matnr for mara-matnr.
      R_matnr-LOW = '04'.
      r_matnr-sign = 'I'.
      r_metnr-option = 'EQ'.
      append r_matnr.
      R_matnr-LOW = '03'.
      append r_matnr.
      R_matnr-LOW = '07'.
      append r_matnr.
    clear r_matnr.
    s_matnr[] = r_matnr[].
    Regards,
    amole

  • Validation for a selection screen used as a subscreen

    Hi friends,
    I have a screen say '0001' in that screen i have three subscreens 0002 0003 0004
    In the subscreen 0002, i have declared three selection screens 0102, 0202, 0302
    In the Application toolbar of the screen 0001 (PF Status) i have declared three push buttons A, B, C,
    On click of A i ll invoke 0102 selection screen inside the subscreen 0002.
    Similarly On click of B i ll invoke 0202 selection screen inside the subscreen 0002
    Similarly On click of C i ll invoke 0302 selection screen inside the subscreen 0002.
    I have completed till the above ...
    My problem is ........................
    The selection screens will have their own Parameters and select options .....
    some of them are mandatory & some of them not .......
    Now when i switch from one push button to another say from A to B and then again to C .... for each and every click it is asking to fill in the mandatory paramters and select options ........ and then only allowing to move to the next sel screen .......
    Needed solution:
    ~~~~~~~~~~~~~
    1. How can i avoid this message "Fill in the required fields" ?
    2. How can i validate the user entries if i take away all the "OBLIGATORY"
        additions in the selection screen declaration part
    3. Where can i write "At selection screen" validation? becoz iam using a function
        group for the creation of screens and all and have included the selection
        screen declaration in the top include of the Function group?
    Hope iam clear with my question!!
    Revert back if you need more clarrifications on the question itself
    Cheers
    Kripa Rangachari .....

    Hi,
       In the pf status - for push buttons give the type as E.
    Write the processing for this in at exit command.
    Validation should be done in AT SELECTION-SCREEN ON field.
    Reward if helpful.

  • Date interval check on selection-screen

    Hello, How can I check on the selection-screen if the s_date (high part) is filled out or not? s_date is an interval. If the high field is not filled, the program don't allowed to run. So I have to check it is a single date or an interval.

    if u r referring to a field of date in select options just dont ignore the case that if u r not entering any field in the high interval its value will be '00000000'.
    u need to check this .
    execute the code .
    select-options : s_date for sy-datum.
    initialization.
    at selection-screen .
    if s_date-high eq '00000000'.
    message e999(zd) with 'Cannot Run'.
    endif.
    regards,
    vijay

  • 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

  • AUTHORITY-CHECK before Selection-screen?

    Hi,
    i want to check the authority before the selection-screen. I do it in this way:
    AT SELECTION-SCREEN OUTPUT.
      AUTHORITY-CHECK OBJECT 'Z_REPORT'
               ID 'PROGRAM' FIELD SY-REPID
               ID 'ACTVT'   FIELD '16'. "Ausführen
      IF SY-SUBRC <> 0.
        MESSAGE E010 WITH 'Keine Berechtigung für Programm: '
        SY-REPID.
      ENDIF.
    But the selection appears without any parameters.
    Is there a way to check without the selection-screen?
    thanks.
    regards, Dieter

    Hi Dieter,
    Please check the below code for at selection screen authorization check.
    Handling selection screen events
    AT SELECTION-SCREEN ON p_carrid.
      IF p_carrid IS INITIAL.
        MESSAGE 'Please enter a value' TYPE 'E'.
      ENDIF.
      AUTHORITY-CHECK OBJECT 'S_CARRID'
                          ID 'CARRID' FIELD p_carrid
                          ID 'ACTVT'  FIELD '03'.
      IF sy-subrc = 4.
        MESSAGE 'No authorization for carrier' TYPE 'E'.
      ELSEIF sy-subrc <> 0.
        MESSAGE 'Error in authority check' TYPE 'A'.
      ELSE.
        IF sy-ucomm = 'ONLI'.
          CALL SELECTION-SCREEN '0500'.
        ENDIF.
      ENDIF.
    Regards,
    Md Ziauddin

  • Grey out the input field as soon as check box checks on selection screen!

    HI Experts,
    In my report selection screen I have input_field1, input_field2, check_box1. Both input fields are mandatory fileds.
    My requireemnt is: If user as soon as checks the check_box1, the first input_field1 must go grey out (not allow allow to enter)!
    So I have assigned a user command to check box and assigned a modif-ID to the input_field1
    and wrote a LOOP AT SCREEN code as below,
    PARAMETERS show_all AS CHECKBOX USER-COMMAND flag.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
    PARAMETERS: p1 TYPE c LENGTH 10,
                p2 TYPE c LENGTH 10,
                p3 TYPE c LENGTH 10.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME.
    PARAMETERS: p4 TYPE c LENGTH 10 MODIF ID bl2,
                p5 TYPE c LENGTH 10 MODIF ID bl2,
                p6 TYPE c LENGTH 10 MODIF ID bl2.
    SELECTION-SCREEN END OF BLOCK b2.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF show_all <> 'X' AND
           screen-group1 = 'BL2'.
           screen-active = '0'.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    But,am getting an error message saying "Enter all required fields"
    Pls. let me know how to fix this?
    Thank you

    I assume P1, P2 and P3 are marked as obligatory.
    You cannot achieve that. But here is an alternative to achieve a similar functionality.
    AT SELECTION-SCREEN.
      CHECK sy-ucomm EQ 'ONLI' OR sy-ucomm = 'SJOB' OR sy-ucomm = 'PRIN'.
      IF p1 is INITIAL or P2 is INITIAL or P3 is INITIAL.
        MESSAGE 'Enter all required fields' TYPE 'E'.
      ENDIF.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF show_all = 'X' AND
           screen-group1 = 'BL2'.
          screen-input = '0'.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.

  • Date validation in the selection screen

    Hi
    I am new to all this..so pls help me with this...
    I need to validate my input field in the selection screen to have the format as YYYYMMDD i.e user is allowed to enter the date in this format only!!
    Now how to validate this kind of a format??

    Hi
    That's INPUT format just one used to save a date, so u need to check it only.
    It's the same if you used a DATS format, because its INPUT FORMAT is the same, for example, output format of SY-DATUM is DD.MM.YYYY, but input format is YYYYMMDD, so:
    PARAMATERS: P_DATE LIKE SY-DATUM.
    AT SELECTION-SCREEN.
    IF P_DATE < SY-DATUM.
      MESSAGE E208(00) 'Error'.
    ENDIF.
    In your case the INPUT and OUTPUT format are the same so:
    PARAMATERS: P_DATE(8) TYPE N.
    AT SELECTION-SCREEN.
    IF P_DATE < SY-DATUM.
      MESSAGE E208(00) 'Error'.
    ENDIF.
    Max

  • Issuing of remuneraton statement on the checking of selection screen field

    Hi Experts ,
                        Verify the field  XYZ  in the selection screen.
    - If the field is not checked, the remunerations statements should be issued in this sequence order:
    u2022     PA code
    u2022     PSA code
    u2022     Cost Center code (KOSTL)
    u2022     Employee number (PERNR
    please help to write code for the above requirement .
    thanks
    Harish

    solved

  • Selection-screen validation

    Hi Experts,
          Please can any one give me the details ..
      1)What is the actual use of selection screen  validation?
    2) When we use Selection-screen validation?
    3)If we are not written the selection-screen validation is there any effect?
    I know how to write the validation for a selection screen. But why i am asking above questions is I am very new to ABAP .My Functionl people also new to ABAP. They told me one report.I asked me what are the validation for selection screen . At that time they told there is no validation.
         Thats the reason to ask above questions..
      please tell me the details..
    Thanks In Advance..
    Thanks and Regards
    Siri..

    Abhi,
    Selection Screen Validation are used for correct input processing.
    Selection screen elements are used further in select queries to fetch data. if user enters some wrong input
    we will unnecessarily hit the data base with wrong values and select will fail , hence validation of the input
    will avoid unnecessary data base hit.
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Feb 27, 2008 12:26 PM

  • Check box in ALV selection screen

    Hi to all
              I like to know how to create a checkbox in the input screen of an ALV.

    What do you mean by ALV check box selection screen?
    ALV and selection screen check box( you are mixing two cases in your Question).
    You need use the Function moduel in the user command to get the updated data.
    in fieldcatalog you have to use INPUT = 'X' and EDIT = 'X' for the columns which ever you want edit.
    GET_GLOBALS_FROM_SLVC_FULLSCR
    follow the sample code.
    REPORT ZTEST_ALV_CHECK MESSAGE-ID ZZ .
    TYPE-POOLS: SLIS.
    DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
    IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
    L_LAYOUT TYPE SLIS_LAYOUT_ALV,
    X_EVENTS TYPE SLIS_ALV_EVENT,
    IT_EVENTS TYPE SLIS_T_EVENT.
    DATA: BEGIN OF ITAB OCCURS 0,
    VBELN LIKE VBAK-VBELN,
    POSNR LIKE VBAP-POSNR,
    CHK(1),
    color(4),
    END OF ITAB.
    SELECT VBELN
    POSNR
    FROM VBAP
    UP TO 20 ROWS
    INTO TABLE ITAB.
    X_FIELDCAT-FIELDNAME = 'CHK'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 1.
    X_FIELDCAT-INPUT = 'X'.
    X_FIELDCAT-EDIT = 'X'.
    X_FIELDCAT-CHECKBOX = 'X'.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    X_FIELDCAT-FIELDNAME = 'VBELN'.
    X_FIELDCAT-SELTEXT_L = 'VBELN'.
    X_FIELDCAT-HOTSPOT = 'X'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 2.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    X_FIELDCAT-FIELDNAME = 'POSNR'.
    X_FIELDCAT-SELTEXT_L = 'POSNR'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS = 3.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    L_LAYOUT-info_fieldname = 'COLOR'.
    *L_LAYOUT-ZEBRA = 'X'.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
    I_CALLBACK_PROGRAM = SY-REPID
    IS_LAYOUT = L_LAYOUT
    I_CALLBACK_PF_STATUS_SET = 'STATUS'
    I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
    IT_FIELDCAT = IT_FIELDCAT
    TABLES
    T_OUTTAB = ITAB
    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.
    *& Form STATUS
    text
    -->P_EXTAB text
    FORM STATUS USING P_EXTAB TYPE SLIS_T_EXTAB.
    Pf status
    SET PF-STATUS 'STATUS'.
    ENDFORM. " STATUS
    *& Form USER_COMMAND
    text
    -->R_UCOMM text
    -->RS_SELFIELD text
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
    RS_SELFIELD TYPE SLIS_SELFIELD.
    DATA: GD_REPID LIKE SY-REPID, "Exists
    REF_GRID TYPE REF TO CL_GUI_ALV_GRID.
    IF REF_GRID IS INITIAL.
    CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
    IMPORTING
    E_GRID = REF_GRID.
    ENDIF.
    IF NOT REF_GRID IS INITIAL.
    CALL METHOD REF_GRID->CHECK_CHANGED_DATA .
    ENDIF.
    loop at itab where chk = 'X'.
    itab-color = 'C300'.
    modify itab index sy-tabix transporting color.
    endloop.
    RS_SELFIELD-refresh = 'X'.
    break-point.
    ENDFORM. "USER_COMMAND
    Regards
    Vijay Babu Dudla

  • Validation on selection screen parameter.

    I have select options in my selection screen.
    1) s_a
    2) s_b
    Requirement:-
    1) If I run the program and click the arrow on the "s_a" field, it should open multi selection screen. From that I can make multi entry or upload data from excel file.
    2) If "s_a" and "s_b" is empty it sud throw an error message.
    Can I do this validation in AT SELECTION-SCREEN n how?

    hi Abhijeet,
    u can do the first by just writing the sel-options as:
    S_A like table-field (say vbak-vbeln). then the multiple selection comes automatically.
    the second - u can do thru at selection-screen by just writing a if condition.
    if s_a-low is initial and s_a-high is initial.
    message e001.
    endif.
    Let me know if you still have any issue.
    /Praveen

  • Error message disble the Fields in Selection Screen

    Hi,
    In my Report i am validating some fields as mandatory.
    If the field is initial then one Error message should be display in the screen and user has to modify the selection screen.
    But after displaying the errro message my selection screen is input disable except the mandatory field.
    I want all the fields should be input enable.
    Sample code for Error message,
    MESSAGE E018 WITH 'Enter Plant'.
    Please provide the code for this.

    Performing checks on SELECTION-SCREEN
    - if the check uses only one independent field (e.g.: value exist in a table) use a[ AT SELECTION-SCREEN ON <field>|http://help.sap.com/abapdocu/en/ABAPAT_SELECTION-SCREEN_EVENTS.htm#!ABAP_ALTERNATIVE_2@2@], the field will be editable when error is raised
    - if the check uses some fields, group them using [SELECTION-SCREEN BEGIN OF BLOCK <block>/END OF BLOCK <block>|http://help.sap.com/abapdocu/en/ABAPSELECTION-SCREEN_BLOCK.htm] and then [AT SELECTION-SCREEN ON BLOCK  <block>|http://help.sap.com/abapdocu/en/ABAPAT_SELECTION-SCREEN_EVENTS.htm#!ABAP_ALTERNATIVE_4@4@], each field of the block will be editable when error is raised
    So, if you really want that each and every field be editable when an error is raised, declare every parameter and select-options in a big block, and perform the check in a unique AT SELECTION-SCREEN ON BLOCK xxx.
    Use Error message, Warning and Information don't break the flow of the report.
    Regards,
    Raymond

Maybe you are looking for