How do we validate input fields on the selection screen

How do we validate input fields on the selection screen

hi balram,
u can validate input fields using <b>AT SELECTION-SCREEN</b>  Event.
PARAMETERS : p_werks TYPE marc-werks.
AT SELECTION-SCREEN ON p_werks.
SELECT SINGLE *
FROM t001w
WHERE werks = p_werks.
IF sy-subrc <> 0.
MESSAGE 'Invalid Plant' TYPE 'I'.
ENDIF.
Like this, we can validate user input for plant.
check this link:
http://help.sap.com/saphelp_nw04s/helpdata/en/9f/db9a2e35c111d1829f0000e829fbfe/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/56/1eb6c705ad11d2952f0000e8353423/content.htm
Reware me if useful......
Harimanjesh AN

Similar Messages

  • How to Add a new fields in the selection screen of LDB.

    Hi All,
    I want to add a new fields in the selection screen of LDB & then i need to select the data for that fields.
    So could you please tell me for that where i need to add the code for selecting the data.
    Thanks
    Roli

    Hi
    welcome to SDN forum
    If you are designing your own LDB with your own tables you can define tree structure and then the selection screen for the tables
    if you wants to modify the std LDB of SAp means take the access key and to modify that code
    if you add the extra field you have to modify the where conditions in the code also
    see the doc
    A logical database is a special ABAP/4 program which combines the contents of certain database tables. You can link a logical database to an ABAP/4 report program as an attribute. The logical database then supplies the report program with a set of hierarchically structured table lines which can be taken from different database tables.
    LDB offers an easy-to-use selection screens. You can modify the pre-generated selection screen to your needs. It offers check functions to check whether user input is complete, correct, and plausible. It offers reasonable data selections. It contains central authorization checks for data base accesses. Enhancements such as improved performance immediately apply to all report programs that use the logical database.
    Less coding s required to retrieve data compared to normal internel tables.
    Tables used LDB are in hierarchial structure.
    Mainly we used LDBs in HR Abap Programming.
    Where all tables are highly inter related so LDBs can optimize the performance there.
    Check this Document. All abt LDB's
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.highlightedcontent?documenturi=%2flibrary%2fabap%2fabap-code-samples%2fldb+browser.doc
    GO THROUGH LINKS -
    http://www.sap-basis-abap.com/saptab.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9bfa35c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c6/8a15381b80436ce10000009b38f8cf/frameset.htm
    /people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases
    Re: **LDB**
    www.sapbrain.com/FAQs/TECHNICAL/SAP_ABAP_Logical_Database_FAQ.html
    www.sap-img.com/abap/abap-interview-question.htm
    www.sap-img.com/abap/quick-note-on-design-of-secondary-database-indexes-and-logical-databases.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9b5e35c111d1829f0000e829fbfe/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/9f/db9bb935c111d1829f0000e829fbfe/content.htm
    Gothru the blog which provides info on LDB's:
    /people/srivijaya.gutala/blog/2007/03/05/why-not-logical-databases
    Sample code
    TABLES: SPFLI,
    SFLIGHT,
    SBOOK,
    SCARR.
    START-OF-SELECTION.
    GET SPFLI.
    WRITE:/ ’SPFLI: ’, SPFLI-CARRID, SPFLI-CONNID,
    SPFLI-AIRPFROM, SPFLI-AIRPTO.
    GET SFLIGHT.
    WRITE:/ ’ SFLIGHT: ’, SFLIGHT-CARRID, SFLIGHT-CONNID, SFLIGHT-FLDATE.
    GET SBOOK.
    WRITE:/ ’ SBOOK: ’, SBOOK-CARRID, SBOOK-CONNID,
    SBOOK-FLDATE, SBOOK-BOOKID.
    GET SFLIGHT LATE.
    WRITE:/ ’ GET SFLIGHT LATE: ’, SFLIGHT-FLDATE.
    Regards
    anji

  • How to gray out certain fields on the selection screen based on the radio b

    HI All,
      I have an ALV report. On the selection screen I have 2 radio buttons ..for eg..A and B.
    When radio button A(its on by default) is on..certain fields not relevant to this should be grayed out. Similarly when radio button B is on, certain fields should be grayed out.
    I did the AT SELECTION SCREEN OUTPUT and also did the
    LOOP AT SCREEN....ENDLOOP logic. The logic works but when I click the radio button B...the screen fields automatically does not gray out. I have to press ENTER and then its grays out.
    I know a USER_COMMAND needs to be attached.
    Can anyone give me a step by step details of how to do this. I truly appreciate it. if a screen painter thing is required..please give me the tcode and step by step detail to do this.
    Thanks

    Try this one too:
    REPORT ztest.
    TABLES: mara,
            bkpf.
    CONSTANTS:
                  c_pos(3) TYPE c VALUE 'POS',
                  c_acc(3) TYPE c VALUE 'ACC',
                  c_all(3) TYPE c VALUE 'ALL',
                  c_x TYPE c VALUE 'X'.
    The Selection Screen Definition
    SELECTION-SCREEN BEGIN OF BLOCK b_0 WITH FRAME TITLE text-000.
    SELECT-OPTIONS: s_mara FOR mara-matnr.
    SELECTION-SCREEN END OF BLOCK b_0.
    SELECTION-SCREEN BEGIN OF BLOCK b_1 WITH FRAME TITLE text-037.
    PARAMETER: rb_all RADIOBUTTON GROUP rb1 USER-COMMAND rad default 'X',
               rb_acc RADIOBUTTON GROUP rb1.
    SELECTION-SCREEN END OF BLOCK b_1.
    SELECTION-SCREEN BEGIN OF BLOCK b_2 WITH FRAME TITLE text-011. "Acct
    SELECT-OPTIONS:   s_blrtc1 FOR bkpf-blart MODIF ID acc,
                      s_blrti1 FOR bkpf-blart MODIF ID acc.
    SELECTION-SCREEN END OF BLOCK b_2.
    SELECTION-SCREEN BEGIN OF BLOCK b_3 WITH FRAME TITLE text-011. "Acct
    SELECT-OPTIONS:   s_blrtc2 FOR bkpf-blart MODIF ID all,
                      s_blrti2 FOR bkpf-blart MODIF ID all,
                      s_blrtv2 FOR bkpf-blart MODIF ID all.
    SELECTION-SCREEN END OF BLOCK b_3.
    AT SELECTION-SCREEN OUTPUT
    AT SELECTION-SCREEN OUTPUT.
      PERFORM f0200_screenfield_hide_logic.
    initialization.
      PERFORM f0200_screenfield_hide_logic.
          FORM f0200_screenfield_hide_logic                             *
    FORM f0200_screenfield_hide_logic.
      LOOP AT SCREEN.
        IF rb_acc = c_x.
          IF screen-group1 = c_all.
            screen-active = 0.
          ELSE.
            screen-active = 1.
          ENDIF.
        ENDIF.
        MODIFY SCREEN.
        IF rb_all = c_x.
          IF screen-group1 = c_acc.
            screen-active = 0.
          ELSE.
            screen-active = 1.
          ENDIF.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    ENDFORM.                    " F0200_SCREENFIELD_HIDE_LOGIC

  • F4 Help in BSP for a input field in the Selection Screen...Urgent

    Hi ,
    Can anyone possible tell me how to put F4 help in a BSP
    Regards...

    Hi Pavan,
    It's a reccurring question in BSP forum that cannot be solved that easily...
    You will find some examples of how it can be handled in demo BSP :
    <b>bsp_valuehelp</b>
    <b>bsp_vhelp</b>     (this one is MVC-oriented)
    To go further, you should have a look at the following blog :
    /people/thomas.jung3/blog/2004/09/17/bsp-150-a-developer146s-journal-part-xii-150-value-input-help-popups
    /people/thomas.jung3/blog/2004/11/01/bsp-value-input-help-popups-version-20-part-1
    Hope it helps.
    Best regards,
    Guillaume

  • How to validate input fields as the user is filling up a form with jQuery?

    Hello EA friends.
    Someone has experimented on how to validate input fields as the user is filling up a form with jQuery?, if the field is numeric and insert an A for example, an alert appears showing "insert a number" or not allowed to enter anything until a number is entered.
    Thanks and regards.
    Fer

    Hi Sudeshna.
    Sorry for not responding on time, how can I be included in this code?
    sym.setVariable("typeActivity", "input")
    var Element_1=document.createElement(typeActivity);
    $(Element_1).css({"text-align": "center"});
    //Answer
    sym.setVariable("Answer_1", "4");
    sym.$("box_1").append(Element_1)
    This code is on my creationComplete and it works fine.
    Would greatly appreciate your help.
    Regards.
    Fer García

  • How to validate a select-option field on the selection- screen

    Hi,
       I need to validate a selection-option field in the selection-screen.
    Requirement is : i need to read each of customer number one by one and validateCan you please me in achieving this.
    Best Regards
    Mamatha.B

    hi,
    chk this sample code.
    SELECT-OPTIONS : s_kunnr for kna1-kunnr.
    AT SELECTION-SCREEN.
         if 'S_KUNNR-HIGH' = "condition
        "put your required validation here
         endif.
    rgds
    Anver
    Message was edited by:
            Anversha s

  • Disabling certain fields on the selection screen.

    Hi all,
              I want to disable certain fields on selection screen of my program, also i want to display certain fields on selection screen only if a particular field on the selection screen is checked or selected. Please guide me how this can be achieved via coding in a program.
    Thanks & regards,
    Chetan.

    Hi Chetan,
    try this.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS: pa_file TYPE rlgrap-filename MODIF ID abc,
    pa_lifnr TYPE lfa1-lifnr MODIF ID abc,
    pa_vkorg TYPE vbak-vkorg MODIF ID abc.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
    PARAMETERS: pa_kunnr TYPE vbak-kunnr MODIF ID def.
    SELECT-OPTIONS: s_lifnr FOR gs_lfa1-lifnr MODIF ID def,
    s_date FOR gs_lfa1-erdat MODIF ID def,
    s_augru FOR gs_vbak-augru MODIF ID def,
    s_vbeln FOR gs_vbak-vbeln MODIF ID def.
    SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: pa_upd RADIOBUTTON GROUP g1 USER-COMMAND uc01 DEFAULT 'X'."#EC *
    SELECTION-SCREEN COMMENT 3(60) text-004 FOR FIELD pa_upd.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: pa_rep RADIOBUTTON GROUP g1 ."#EC *
    SELECTION-SCREEN COMMENT 3(60) text-005 FOR FIELD pa_rep.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK b3.
    IF pa_rep EQ gc_x.
    LOOP AT SCREEN.
    IF screen-group1 = gc_abc.
    screen-input = gc_zero_num.
    ELSEIF screen-group1 = gc_def.
    screen-active = gc_one_num.
    ENDIF.
    MODIFY SCREEN.
    ENDLOOP.
    ELSEIF pa_upd EQ gc_x.
    *For Reprocessing
    LOOP AT SCREEN.
    IF screen-group1 = gc_def.
    screen-input = gc_zero_num.
    ELSEIF screen-group1 = gc_abc.
    screen-active = gc_one_num.
    ENDIF.
    MODIFY SCREEN.
    CLEAR pa_upd.
    ENDLOOP.
    ENDIF.
    REPORT zrich_001.
    PARAMETERS: p_rad1 RADIOBUTTON GROUP grp1 DEFAULT 'X'
    user-command chk,
    p_rad2 RADIOBUTTON GROUP grp1.
    SELECT-OPTIONS: s_datum1 FOR sy-datum MODIF ID d1,
    s_datum2 FOR sy-datum MODIF ID d2.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
    IF p_rad1 = 'X'
    AND screen-group1 = 'D2'.
    screen-active = '0'.
    ENDIF.
    IF p_rad2 = 'X'
    AND screen-group1 = 'D1'.
    screen-active = '0'.
    ENDIF.
    MODIFY SCREEN.
    ENDLOOP.
    reward if useful.
    regards,
    sravanthi.

  • How to use MM/YYYY Format in the selection Screen?

    There is this program RMCB0300 where the date format in the selection screen has MM/YYYY Format.
    I am working on a report which requires it "Period" Field in the selection screen to be in the same format.
    However, i am trying to give the select option as " SL_SPMON FOR S031-SPMON MODIF ID PER." and declaring S031 table in the declaration part.
    But still, its not been able to provide me F4 help in the inpur screen.
    Can someone please provide me some guidance in this regard?

    Hi,
    the following works for me..
    *& Report  ZPMONAT                                                     *
    report  zpmonat                                 .
    tables: s031.
    selection-screen begin of block abc.
    select-options:  sl_spmon for s031-spmon.
    selection-screen end of block abc.
    at selection-screen on value-request for sl_spmon-low.
      perform monat_f4.
    at selection-screen on value-request for sl_spmon-high.
      perform monat_f4.
    start-of-selection.
    end-of-selection.
    *&      Form  monat_f4
    *       text
    *  -->  p1        text
    *  <--  p2        text
    form monat_f4 .
      data: begin of mf_dynpfields occurs 1.
              include structure dynpread.
      data: end   of mf_dynpfields.
      data: mf_returncode   like sy-subrc,
            mf_monat        like isellist-month,
            mf_hlp_repid    like sy-repid.
      field-symbols: <mf_feld>.
    * Wert von Dynpro lesen
      get cursor field mf_dynpfields-fieldname.
      append mf_dynpfields.
      mf_hlp_repid = sy-repid.
      do 2 times.
        call function 'DYNP_VALUES_READ'
          exporting
            dyname               = mf_hlp_repid
            dynumb               = sy-dynnr
          tables
            dynpfields           = mf_dynpfields
          exceptions
            invalid_abapworkarea = 01
            invalid_dynprofield  = 02
            invalid_dynproname   = 03
            invalid_dynpronummer = 04
            invalid_request      = 05
            no_fielddescription  = 06
            undefind_error       = 07.
        if sy-subrc = 3.
    *     Aktuelles Dynpro ist Wertemengenbild
          mf_hlp_repid = 'SAPLALDB'.
        else.
          read table mf_dynpfields index 1.
    *     Unterstriche durch Blanks ersetzen
          translate mf_dynpfields-fieldvalue using '_ '.
          exit.
        endif.
      enddo.
      if sy-subrc = 0.
    *   Konvertierung ins interne Format
        call function 'CONVERSION_EXIT_PERI_INPUT'
          exporting
            input         = mf_dynpfields-fieldvalue
          importing
            output        = mf_monat
          exceptions
            error_message = 1.
        if mf_monat is initial.
    *     Monat ist initial => Vorschlagswert aus akt. Datum ableiten
          mf_monat = sy-datlo(6).
        endif.
        call function 'POPUP_TO_SELECT_MONTH'
          exporting
            actual_month               = mf_monat
          importing
            selected_month             = mf_monat
            return_code                = mf_returncode
          exceptions
            factory_calendar_not_found = 01
            holiday_calendar_not_found = 02
            month_not_found            = 03.
        if sy-subrc = 0 and mf_returncode = 0.
    *     ASSIGN (MF_DYNPFIELDS-FIELDNAME) TO <MF_FELD>. " ==>> note 148804
    *     <MF_FELD> = MF_MONAT.
          call function 'CONVERSION_EXIT_PERI_OUTPUT'
            exporting
              input  = mf_monat
            importing
              output = mf_dynpfields-fieldvalue.
          collect mf_dynpfields.
          call function 'DYNP_VALUES_UPDATE'
            exporting
              dyname               = mf_hlp_repid
              dynumb               = sy-dynnr
            tables
              dynpfields           = mf_dynpfields
            exceptions
              invalid_abapworkarea = 01
              invalid_dynprofield  = 02
              invalid_dynproname   = 03
              invalid_dynpronummer = 04
              invalid_request      = 05
              no_fielddescription  = 06
              undefind_error       = 07.           "<<== note 148804
        endif.
      endif.
    endform.                                                    " monat_f4
    Regards,
    Suresh Datti

  • Adding field in the selection-screen of a zprogram

    hi gurus,
    i have to add field in the selection-screen of oppurtunities. in database i have a field salesvalues, some of oppurtunity guids have this field value. first i need to add in selection-screen in this alv report. and fetch the data from ztable into required field . if the input fields of the salesvalues field id filled, then filter the global  guids(from global table which had the guid values already) with this guids related to salesvalues. and if one single guid mathes to 2 values of salesvalues then concatenate 2 values with comma and display in single field. if select-options are blank then fetch all opportunity guids which have salesvalues. pls give solution.

    Hi Srini,
    Thanks for your Reply
    I have kept 01 against the field BSEG-AUGDT and selected the preselect check box also.
    But still that field is not visible in the dynamic selection screen.
    Thanks
    Ajay.D

  • Functional area(FKBER( field in the selection screen))

    Hi,
       I have a requirement to add functional area field in the selection screen for a report painter report. This report using library 1VK and table 'CCSS'. I added functional area field in the general data selection . After the execution of report with functional area field filled with value. report not giving any output. do i need to maintain any setting to achieve?
    Regards,
    Palani

    Hi,
    How you have filled the values?
    It is 16 CHAR long.

  • I have mapped the fields on the selection-screen  to the BDC on transaction

    I have mapped the fields on the selection-screen  to the BDC on transaction F110.
    When I am selecting a particular any value in select-option on the selection screen, it is giving some default value and the value given by me,for example:
    Payment methods:C
    but in BDC recording for F110 Payment methods:IEQC when the programs is running in foreground mode.
    how can I rectify it?

    This is because payment methods may be a table and what you see IEQC is actually, I for include, EQ for equal and C as your payment method. This is standard structure for ranges or select-options. You can use variable-low which will give you only C.

  • Maintaing a default value for a particular field in the selection screen

    Hi all,
    How to maintain a default value for a particular field in the Selection Screen of a Standard report
    Regards
    Ajay

    >
    ajay babu wrote:
    > Hi all,
    >
    > How to maintain a default value for a particular field in the Selection Screen of a Standard report
    >
    > Regards
    > Ajay
    Create a variant for your standard program and assign this variant to the field 'Start with variant' while creating transaction code for the standard program in the transaction 'SE93'.
    Regards
    Rajesh.

  • Field in the selection screen as a select option with two default values

    Hi All,
    can anybody tell me how to put field in the selection screen with two defaul values.
    for ex:  selection screen the Account Group KNA1-KTOKD as a select option. The defeault value should be Y001 and Y005.
    please reply ASAP. Its urgent.
    Thanks in advance,
    Madhu

    Hi Madhu,
    Since Select options are nothing but ranges, you can use the following code to add two distinct values to the select options by default.
    s_ktokd-sign = 'I'.
    s_ktokd-option = 'EQ'.
    s_ktokd-low = 'Y001'.
    append s_ktokd.
    s_ktokd-low = 'Y005'.
    append s_ktokd.
    clear s_ktokd.
    However, if you want to mention a range like all the values between these given two values to be considered then u may use,
    select-options : s_ktokd for KNA1-KTOKD default 'Y001' to 'Y005'.
    or
    s_ktokd-sign = 'I'.
    s_ktokd-option = 'BT'.
    s_ktokd-low = 'Y001'.
    s_ktokd-high = 'Y005'.
    append s_ktokd.
    Reward if helpful.

  • Clearing only a few fields in the selection-screen

    Hi Folks,
    I am having the following fields in the selection screen.
    werks.
    matnr
    quantity
    filename like rlgrap-file.
    First time the user enters some values and executes it and comes back to the selection-screen.At this point I want <b>only matnr and quantity</b> fields in the selection-screen to be cleared.
    If I use FREE MEMORY it is clearing all the fields.I want only the above mentioned fields.I don't want to set the data in the in werks as default in the program.Kindly let me know how to achieve this.
    Thanks,
    K.Kiran.

    Hi Kiran,
    You can write your code in AT-SELECTION SCREEN OUTPUT.
    So when ever selection screen called you will have your variables you want cleared.
    USe LOOP AT SCREEN.. there.
    Regards,
    Atish

  • How to create Drop down menu in the selection screen

    Hi all,
    How to create Drop down menu in the selection screen.
    Fast answer will be highly rewarded
    Regards
    Bikas

    hi ,
    TYPE-POOLS : vrm.
    TABLES:vbak,vbap.
    DATA : v(80) TYPE c.
    DATA: wa_vbak TYPE vbak,
          it_vbak TYPE vbak OCCURS 0 WITH HEADER LINE,
          wa_vbap TYPE vbap,
          it_vbap TYPE vbap OCCURS 0 WITH HEADER LINE.
      DATA: l_name TYPE vrm_id,
            li_list TYPE vrm_values ,
            v_count  TYPE i,
            l_value LIKE LINE OF li_list.
    PARAMETERS: p_test(20) AS LISTBOX VISIBLE LENGTH 60 MODIF ID DAT.
    INITIALIZATION.
    AT SELECTION-SCREEN OUTPUT.
      PERFORM get_data.
      LOOP AT it_vbak.
        l_value-key =  it_vbak-vbeln .
        l_value-text = it_vbak-vbeln .
        APPEND l_value TO li_list.
      ENDLOOP.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = 'P_TEST'
          values          = li_list
        EXCEPTIONS
          id_illegal_name = 1
          OTHERS          = 2.
    AT SELECTION-SCREEN ON P_TEST.
      clear : li_list , li_list[].
      SELECT vbeln
             matnr
             meins
             FROM vbap
             INTO CORRESPONDING FIELDS OF TABLE it_vbap
             WHERE vbeln = p_test.
    START-OF-SELECTION.
      SELECT vbeln
             matnr
             meins
             FROM vbap
             INTO CORRESPONDING FIELDS OF TABLE it_vbap
             WHERE vbeln = p_test.
      LOOP AT it_vbap.
        WRITE :/ it_vbap-vbeln, it_vbap-matnr,it_vbap-meins.
      ENDLOOP.
    *&      Form  get_Data
          text
    -->  p1        text
    <--  p2        text
    FORM get_data .
      SELECT  vbeln
              FROM vbak
              INTO  CORRESPONDING FIELDS OF TABLE it_vbak.
    ENDFORM.                    " get_Data
    regards,
    venkat.

Maybe you are looking for