RadioButton validation

Hello All,
Iam working in EP6.0, in an iview, Iam not getting the selected value of the radio buttons on the client side using java script.What is the property I need to use to check the selected value of the radiobuttons of a radiobutton group."checked" property is not working on the object of "radiobutton group". Can any of you advise me over this please.
Thanks in advance,

You should use this for Radio Button and not the Radio ButtonGroup as you had mentioned.
In your javascript method
var funcName = htmlb_formid+"_getHtmlbElementId";
func = window[funcName];
and
eval(func("radioButtonID"));

Similar Messages

  • How to write Validations for RadioButton

    Hi All,
    in my Application , two RadioButtons and one submitbutton is there, in that
    1. yes
    2. no
    both are radio buttons
    when i click on submit button, without selecting any one of those radiobuttons ,
    it shud display error message, this errormessage i have written in iwdmessage.
    it shud show this error message, instead of displaying nullpointer exception.
    how to write validation for this.
    please help me.
    regards
    sush

    Hi shushma,
    Simply put a check that:
    If(wdContext.current<YOUR_NODE>Element().get<YOUR_ATTRIBUTE_NAME> !=null){
    else{
    // Show the error messages
    //Displaying the error message is very easy.
    //You can report exception using the message manager API's. You will get this easily on SDN.
    I hope this helps! if you need ay further help please let me know.
    Thanks and Regards,
    Pravesh

  • Interface validation

    Hi
    This is my existing interface ,I need to do a validation on Unique id,which i need to add to custom table ZBACKS_GIPD.
    Check if there is same unique id within the upload file.
    Check from table ZBACKS_GIPD if the same Unique ID already exists ,
    Update log file with error message :"Duplicate record"
    Please let me know where I need to add this validation in the below code.
    REPORT ZBAB005 LINE-SIZE 255
                   LINE-COUNT 58(2)
                   NO STANDARD PAGE HEADING
                   MESSAGE-ID 00.
    TABLES: MARA,        "Material master
            MARC,        "Plant Data for Material
            MBEW,        "Material Valuation
            T001K,       "Valuation area
            t100,        "Messages
            kna1,        "Customer master
            SKB1,        "G/L account
            BKPF,        "FIN doc
            zprdordhdr,  "production order header
            ZSTDLOADING, "BACKS-SAP Interface - Generic ProdOrd costing data
            ZBACKS_GIPD. "BACKS-SAP Interface - Material Consumption
    Short name of the interface name
    DATA: INTFNAME(4) value 'GIPD'. "Good Issues for Prod. Order
    include zbab000. "Common procedures for files handling
    SELECTION-SCREEN BEGIN OF BLOCK 6 WITH FRAME TITLE TEXT-006.
      parameters: p_usafl obligatory default 'E'. "Usgae indicator
      parameters: p_chk_ui as checkbox "check invalid usage ind "UATK922842
                    default space.                              "UATK922842
      parameters: p_chk_pd as checkbox "check period of the posting date
                    default 'X'.                                "UATK923027
    SELECTION-SCREEN END OF BLOCK 6.
    SELECTION-SCREEN BEGIN OF BLOCK 7 WITH FRAME TITLE TEXT-007.
    parameters: fb70mode default 'N'.
    parameters: fb50mode default 'N'.
    SELECTION-SCREEN END OF BLOCK 7.
    SELECTION-SCREEN BEGIN OF BLOCK 8 WITH FRAME TITLE TEXT-008.
    parameters:
      p_nor  radiobutton group rad1, "new posting
      p_rep2 radiobutton group rad1. "report (flag '2')
    select-options:
      recno for zbacks_gipd-recno    "record number
        default '1' obligatory.
    SELECTION-SCREEN END OF BLOCK 8.
    DATA: BEGIN OF TAB OCCURS 1000,
             WERKS(04),  "plant
             AUFNR(25),  "production order number
             MATNR(18),  "material
             ERDAT(10),  "BACKS tx date
             MENGE_as_string(17),  "qty
             USAFL(01),  "consumption/usage indicator
             SAKNR(10),  "G/L account number (this is from user's data file,
                         "use SAKNR_FOR_POSTING to post mat. doc instead)
           EXPCD(02),  "expenses code
             IDNUM(35),  "BACKS Identification number
             kunnr(10),  "customer number
    The below 3 fields have no use in SAP transactions
    however they are included in the data file from BACKS.
    Just store them in ZBACKS_GIPD for future use if required
             USACD(10),  "usage code
             ORDCD(10),  "order code
             LOSTY(03),  "loss type
             COTAX(13),  " like zbacks_gipd-cotax, "consumption tax
             MWSKZ(02),  " like zbacks_gipd-MWSKZ, "tax code
    The below fields are not included in the BACKS incoming data file
    They are only for the processing of this program
             RECNO(10),  "record number in the uploaded data file
             FAILF(01),  "Status flag (0=OK, see documentation for details)
             MSGNR(01),                     "message number
             MSGTX(200),                    "message text
             menge(13) type p decimals 3, "qty as numeric
             BUKRS        like t001-bukrs,  "company code
             PRCTR        like marc-prctr,  "profit center
             matkl        like mara-matkl,  "material group
             unitstdcost  type p decimals 3,"standard cost (per 1 EA)
             matloading   type i,           "material loading
             runum        like zprdordhdr-runum,"prod. order running number
           SAKNR        like zexpense-saknr, "account no.
             KOSTL        like zexpense-kostl, "cost center
             saknr_for_posting like bseg-saknr,"G/L acct after validation
             erdat_raw(10),                    "BACKS tx date (MM/DD/YYYY)
    **>>1104
           post_seq_ORIG like DATATYPE-INTEGER4,
           "(5) type n,          "random number: posting order
           post_seq_RAND like DATATYPE-INTEGER4,
           "(5) type n,          "random number: posting order
    **>>1104
             MATDOC(10),     "material document
             MATDOCITEM(4),  "material document item number
             Direction(1),   "I=Issue, R=Reverse (based on the +/- of MENGE)
             ladra like zbacks_gipd-ladra, "material loading rate
             hdr_SUBPR like zprdordhdr-SUBPR, "Sub-con Prodorder "UATK922842
    the below 2 fields are added to resolve 1-yen issue        "DEVK914235
             STOCKQTY like ZBACKS_GIPD-STOCKQTY,    "total stock (from MBEW)
             SALK3    like ZBACKS_GIPD-SALK3,      "total value before issue
             ISSUESTPRS like ZBACKS_GIPD-ISSUESTPRS,"unit std cost
          END OF TAB.
    data: START_RECNO like ZBACKS_GIPD-recno.
    DATA: BEGIN OF BDCDATA OCCURS 100.
          INCLUDE STRUCTURE BDCDATA.
    DATA: END OF BDCDATA.
    data: begin of msgtab occurs 0.
          INCLUDE STRUCTURE BDCMSGCOLL.
    data: end of msgtab.
      Constants used in A/C & Inv postings                               *
    for JV posting
    CONSTANTS:
      CONST_SAKNR_WIP_LABOUR_OH like BSEG-SAKNR "G/L act: WIP-Labour & O/H
        value '0000141000',
      CONST_SAKNR_WIP_MAT_LOAD like BSEG-SAKNR  "G/L act: WIP Matl. Loading
        value '0000543004',
      CONST_SAKNR_WIP_MAT like BSEG-SAKNR            "G/L act: WIP matl
        value '0000140000',
      CONST_SAKNR_OTHER_INCOME like BSEG-SAKNR       "G/L act: Other income
        value '0000725000', "was: '0000400310',
      CONST_SAKNR_WIP_MAT_SUB_CON like BSEG-SAKNR    "G/L act: Mat supplied
        value '0000126001'.                          "to subcontractor
    for material movement (inventory posting)
    CONSTANTS:
       CONST_LGORT like mseg-LGORT      "storage location
         value 'STR1',
       CONST_CHARG like mseg-charg      "batch number
         value 'BACKS'.
    for AR customer invoice for sub-contractor
    CONSTANTS:
       CONST_TAX_RATE     type p decimals 2 value '0.05',     "i.e. 5%
       CONST_PENALTY_RATE type p decimals 2 value '0.2'.      "i.e. 20%
      Structures & internal tables for BAPI - Material movement          *
    Header segment with control information
    DATA: BEGIN OF GOODSMVT_HEADER OCCURS 0.
          INCLUDE STRUCTURE BAPI2017_GM_HEAD_01.
    DATA: END OF GOODSMVT_HEADER.
    DATA: BEGIN OF GOODSMVT_CODE OCCURS 0.
          INCLUDE STRUCTURE BAPI2017_GM_CODE.
    DATA: END OF GOODSMVT_CODE.
    DATA: BEGIN OF GOODSMVT_ITEM OCCURS 0.
          INCLUDE STRUCTURE BAPI2017_GM_ITEM_CREATE.
    DATA: END OF GOODSMVT_ITEM.
    DATA: BEGIN OF REMSG OCCURS 0.
          INCLUDE STRUCTURE BAPIRET2.
    DATA: END OF REMSG.
    DATA: BEGIN OF GOODSMVT_HEADRET OCCURS 0.
          INCLUDE STRUCTURE BAPI2017_GM_HEAD_RET.
    DATA: END OF GOODSMVT_HEADRET.
    *DATA: MATDOC LIKE BAPI2017_GM_HEAD_RET-MAT_DOC.
    DATA: DOCYEAR LIKE BAPI2017_GM_HEAD_RET-DOC_YEAR.
      Structures & internal tables for BAPI - Account Doc Posting        *
    DATA: DOCUMENTHEADER like BAPIACHE08.
    DATA: BEGIN OF ACCOUNTGL occurs 0.
          include structure BAPIACGL08.
    DATA: END OF ACCOUNTGL.
    DATA: BEGIN OF CURRENCYAMOUNT occurs 0.
          include structure BAPIACCR08.
    DATA: END OF CURRENCYAMOUNT.
    DATA: BEGIN OF RETURN occurs 0.
          include structure BAPIRET2.
    DATA: END OF RETURN.
      Misc. internal tables and variable for error logging               *
    DATA: BEGIN OF ERRTX OCCURS 0,
          MSGTX(110).
    DATA: END OF ERRTX.
    DATA: ERR(1) TYPE C.
        TTLQTY(12) TYPE P,
        SUCQTY(12) TYPE P,
        FALQTY(12) TYPE P.
      Calculation variables for sub-contractor                           *
      data: ar_amt_vendor   type p decimals 0.
      data: ar_amt_penalty  type p decimals 0.
      data: ar_amt_total    type p decimals 0.
      data: ar_amt_tax      type p decimals 0.
      data: ar_amt_vendor_as_text(13).
      data: ar_amt_penalty_as_text(13).
      data: ar_amt_total_as_text(13).
      data: ar_amt_tax_as_text(13).
    data: last_werks like tab-werks. "plant
    data: last_matnr like tab-matnr. "to avoid locking problem -> Sleep if
                               "the current p/n is the same as the last one
    data: last_direction.
    DATA: FI_DOC_TEXT(50).   "contains: 1-35:  BACKS ID
                             "          36-50: Quantity
    data: begin of tab_by_matnr occurs 0.
          include structure tab.
    data: end of tab_by_matnr.
    data: MATDOC_AND_ITEM(16). "to put in reference fields
      Data for mat doc item rearrangement                                *
    *Max. no. of items in a single material doc.
    *This number must be less than the half of the FI doc. item limit (999)
    constants:
      c_max_mat_doc_items type i value '400'.
    last flag to indicate if a break is required
    data: l_last_matnr     like tab-matnr.     "last material
    data: l_last_direction like tab-direction. "last direction (+ or -)
    data: l_last_werks     like tab-werks.     "last plant
    count the no. of items (to check against the max. no. of item limit)
    data: l_matnr_counter type i.
      Start and End date of the allowed posting priod                    *
    data: g_period_start_date like sy-datum. "first date of current period
    data: g_period_end_date   like sy-datum. "end date of current period
      Stock info before Goods issue (to solve 1-yen issue)               *
    data: G_SALK3(16) type p decimals 0. "total stock value
    data: G_LBKUM like mbew-lbkum.      "total stock qty
         T O P   O F   P A G E
    TOP-OF-PAGE.
    CALL FUNCTION 'Z_PRINT_REPORT_HEADING'
         EXPORTING
                I_WERKS = 'IHK1'
                I_LINSZ = SY-LINSZ
                I_CPROG = SY-CPROG
                I_TITLE = SY-TITLE.
    WRITE: /1(006)  'Plant'                color 1,
             (025)  'Production Order No'  color 1,
             (018)  'Material'             color 1,
             (010)  'CreDate'              color 1,
             (015)  'Qty'                  color 1,
             (010)  'Usage Ind.'           color 1,
             (010)  'G/L Acct.'            color 1,
             (025)  'BACKS ID'             color 1,
             (010)  'Cust.No.'             color 1,
             (001)  'Fail Flag'            color 1,
             (100)  'Message'              color 1.
    ULINE.
      START - OF - SELECTION                                             *
    START-OF-SELECTION.
    if p_chk_pd = 'X'. "check preiod is needed    "UATK923027
      perform start_end_date_of_period.  "calculate period start/end date
      if   g_period_start_date is initial     "if the start/end date is not
        or g_period_end_date   is initial.    "determined, stop the program
        write: / 'Period start/end date not determined, program stopped.'.
        stop.
      endif.
    endif.
    if p_nor = 'X'.
      PERFORM COMMON_SETUP_FILENAMES. "auto setup filenames by current date
      PERFORM COMMON_UPLOAD_FILES.    "upload input files: TXT and FLG
      PERFORM CONVERSION_DATA.
    elseif p_rep2 = 'X'.
      perform read_data_from_GIPD.
    endif.
    PERFORM CHECK_DATA.
    PERFORM MAIN_UPDATE.
    PERFORM PRINT_OUTPUT.
    PERFORM COMMON_DOWNLOAD_FILES.  "download the log & status file
      FORM READ_DATA_FROM_GIPD                                         *
    form read_data_from_GIPD.
      select * from zbacks_gipd
        where failf = '2'
          and recno in recno.
        clear tab.
        clear result_total. "reset the record counter
        tab-werks = zbacks_gipd-WERKS.         "plant
        tab-aufnr = zbacks_gipd-AUFNR.         "production order no.
        tab-matnr = zbacks_gipd-MATNR.         "material
        tab-erdat = zbacks_gipd-BUDAT.         "transaction date
        tab-recno = zbacks_gipd-recno.
        TAB-MENGE = zbacks_gipd-menge.         "qty
        TAB-USAFL = zbacks_gipd-usafl.         "usage/consumption ind.
             TAB-EXPCD            "Expenses code
        TAB-SAKNR = zbacks_gipd-saknr.         "G/L account number
        TAB-IDNUM = zbacks_gipd-idnum.         "BACKS identification no.
        TAB-KUNNR = zbacks_gipd-kunnr.         "Customer Number
        TAB-USACD = zbacks_gipd-usacd.         "usage code
        TAB-ORDCD = zbacks_gipd-ordcd.         "order code
        TAB-LOSTY = zbacks_gipd-losty.         "loss type
        TAB-COTAX = zbacks_gipd-cotax.         "consumption tax
        TAB-MWSKZ = zbacks_gipd-mwskz.         "tax code
        tab-runum = zbacks_gipd-runum.         "running number
        tab-failf = zbacks_gipd-failf.     "failure flag
        tab-msgnr = zbacks_gipd-failf.     "failure flag
        tab-matdoc = zbacks_gipd-docm1.    "material doc
        tab-msgtx = 'Repost 2nd step'.
       tab-erdat_raw = tab-erdat. "keep the MM/DD/YYYY format
       CONCATENATE TAB-ERDAT6(4) TAB-ERDAT0(2) TAB-ERDAT+3(2)
              INTO TAB-ERDAT.
         concatenate tab-erdat+4(2) '/'
                     tab-erdat+6(2) '/'
                     tab-erdat+0(4)
                   into tab-erdat_raw.
    *Process only a particular set of usage indicator first
        if tab-usafl = p_usafl.
          APPEND TAB.
          result_total = result_total + 1. "Increase the record counter
        endif.
      endselect.
      write: / 'Re-processing records for usage indicator', p_usafl.
    endform.
      FORM CONVERSION_DATA                                               *
    FORM CONVERSION_DATA.
      data: saknr_len type i. "field length of GL acct
      data: kunnr_len type i. "field length of cust no.
      describe field tab-saknr length saknr_len.
      describe field tab-kunnr length kunnr_len.
      clear result_total. "reset the record counter
      LOOP AT STR_TXT.
         CLEAR TAB.
         SPLIT STR_TXT-SLINE AT '|'
          INTO TAB-WERKS            "plant
               TAB-AUFNR            "production order no.
               TAB-MATNR            "material
               TAB-ERDAT            "transaction date
               TAB-MENGE_as_string  "qty
               TAB-USAFL            "usage/consumption ind.
             TAB-EXPCD            "Expenses code
               TAB-SAKNR            "G/L account number
               TAB-IDNUM            "BACKS identification no.
               TAB-KUNNR            "Customer Number
               TAB-USACD            "usage code
               TAB-ORDCD            "order code
               TAB-LOSTY            "loss type
               TAB-COTAX            "consumption tax
               TAB-MWSKZ            "tax code
         tab-erdat_raw = tab-erdat. "keep the MM/DD/YYYY format
         CONCATENATE TAB-ERDAT6(4) TAB-ERDAT0(2) TAB-ERDAT+3(2)
                INTO TAB-ERDAT.
         tab-menge = tab-menge_as_string. "convert to numeric field
    *set tab-msgnr to 1 for invalid usage indicator
    *so that the error records will be included in the error log
         if p_chk_ui = 'X'.
           perform check_usage_indicator.
         endif.
    *Process only a particular set of usage indicator first
    *{Gary Tang 02/10/2003 UATK922842 also include MSGNR=1 (invalid usage
    *incicator records
         if tab-usafl = p_usafl "this is the target usage indicator
            or tab-msgnr = '1'. "this is 1 because of invalid usage ind.
    *}Gary Tang 02/10/2003 UATK922842
    add leading zero to numeric GL acct no.
    e.g. data file: 230330 --> convert to: 0000230330
           CALL FUNCTION 'Z_PURE_NUMERIC_ADD_LEADING_0'
             EXPORTING
               INPUT_FIELD        = tab-saknr
               TARGET_LEN         = saknr_len
             IMPORTING
               OUTPUT_FIELD       = tab-saknr
    add leading zero to numeric cust num
    e.g. data file: 3100001 --> convert to: 0003100001
    e.g. data file: NEC-JP  --> no conversion: NEC-JP
           CALL FUNCTION 'Z_PURE_NUMERIC_ADD_LEADING_0'
             EXPORTING
               INPUT_FIELD        = tab-kunnr
               TARGET_LEN         = kunnr_len
             IMPORTING
               OUTPUT_FIELD       = tab-kunnr
           APPEND TAB.
           result_total = result_total + 1. "Increase the record counter
         endif.
      ENDLOOP.
      write: / 'Processing records for usage indicator', p_usafl.
    ENDFORM.
      FORM CHECK_DATA                                                    *
    FORM CHECK_DATA.
       if p_nor = 'X'.
         PERFORM GET_NEXT_RECNO.
       endif.
       LOOP AT TAB.
          perform check_data_on_period."record date must in current period
          perform check_data_on_zprdordhdr. "production order header
          perform check_data_on_mara.  "material master (general)
          perform check_data_on_marc.  "material master (plant)
          perform check_data_on_t001k. "company code vs plant
          perform check_data_on_mbew.  "Material Valuation
          perform check_usage_indicator. "usage indicator
          perform check_sub_contract.  "must have customer number
          perform check_data_on_kna1.  "customer number
          perform check_data_on_skb1.  "G/L account
          perform check_menge.         "quantity
        perform check_expense.       "for eXpenses
          perform calculate_materail_loading.
        perform gen_random_posting_sequence.
          if p_nor = 'X'.
            PERFORM INSERT_TABLE_ZBACKS_GIPD.
          endif.
          MODIFY TAB.
      endloop.
      if p_nor = 'X'.
    print the last record number for reference
      write: / 'ZBACKS_GIPD record number (RECNO) to   :',
                ZBACKS_GIPD-RECNO.
      skip 1.
      endif.
    endform.
      FOMR Gen_random_posting_sequence                                   *
    *form gen_random_posting_sequence.
    tab-post_seq_ORIG = SY-TABIX.
    if tab-msgnr = '1'. "no need to go further if already rejected
       tab-post_seq_RAND = 0.
    else.
       CALL FUNCTION 'RANDOM_I4'
         EXPORTING
           RND_MIN         = 1
           RND_MAX         = 50000
         IMPORTING
           RND_VALUE       = tab-Post_seq_RAND
    endif.
    *endform.
      FOMR CHECH_MENGE                                             *
    form check_MENGE.
      if tab-menge > 0.      "Issue qty > 0
        tab-direction = 'I'. "Issue (i.e. decrease the inventory)
      elseif tab-menge < 0.  "Issue qty < 0
        tab-direction = 'R'. "Reverse (i.e. increase the inventory
      elseif tab-menge = 0.  "Issue qty = 0 ==> Strange case, error!
        TAB-MSGNR = '1'.
        tab-msgtx = 'Qty is 0. Nothing to post!'.
      endif.
    endform.
      FOMR CHECH_USAGE_INDICATOR                                         *
    form check_usage_indicator.
      case tab-usafl.
        when 'I'. "Inhouse production
        when 'E'. "External procurement
        when 'X'. "Expense
        when 'T'. "transfer to sub-contractor
        when 'S'. "sale to sub-contractor
        when 'C'. "consign to sub-contractor
      when '?'. "add new usage indicator here if needed!
        when others. "illegal value! reject the record
          TAB-MSGNR = '1'.
         concatenate 'Invalid usage indicator'
           into tab-msgtx separated by space.
          tab-msgtx = 'Invalid usage indicator'.
      endcase.
    endform.
    *form check_expense.
    check not tab-msgnr = '1'. "no need to go further if already rejected*
    check tab-usafl = 'X'. "only for expense
    SELECT SINGLE ZEXPENSE~SAKNR
                   ZEXPENSE~KOSTL
       into (TAB-SAKNR,
             TAB-KOSTL)
       FROM ZEXPENSE
       WHERE ZEXPENSE~WERKS = TAB-WERKS
         AND ZEXPENSE~EXPCD = TAB-EXPCD.
    IF SY-SUBRC <> 0.
       TAB-MSGNR = '1'.
       TAB-MSGTX = 'Expense code not found (ZEXPENSE)'.
    endif.
    *endform.
      FOMR CALCULATE_MATERIAL_LOADING                                    *
    form calculate_materail_loading.
      check not tab-msgnr = '1'. "no need to go further if already rejected
    *Material loading is calculated for all records
    *Though posting only required for usage 'E'
    check tab-usafl = 'E'. "only for External procurement need to post
      select single ZSTDLOADING~LADRA  "loading %
        into ZSTDLOADING-LADRA         "loading %
        from ZSTDLOADING               "standard loading info.
        where WERKS = tab-werks        "plant
          and MATGP = tab-matkl+0(2)   "customer code
        and LADTY = tab-usafl.       "usage code
          and LADTY = 'P'.             "material loading
      if ( sy-subrc <> 0 ).
       or ( zstdloading-LADRA is initial ). "DEVK909574
        TAB-MSGNR = '1'.
        TAB-MSGTX = 'Mat. loading % not found or = 0% (ZSTDLOADING)'.
      else.
        tab-ladra = zstdloading-ladra. "store the loading rate into table
    *{Gary Tang 02/10/2003                                     "UATK922842
    round the qty*stdcost to integer before multiplying the loading rate
        tab-matloading         "type is integer (result will be rounded off)
          = tab-menge          "qty
    tab-unitstdcost.   "std cost (of 1 EA)
         * ZSTDLOADING-LADRA "material loading percentage (%)
         / 100.              "because material loading is in %
       tab-matloading         "type is integer (result will be rounded off)
          = tab-matloading
    ZSTDLOADING-LADRA "material loading percentage (%)
           / 100.              "because material loading is in %
    *}Gary Tang 02/10/2003                                     "UATK922842
      endif.
    endform.
      FORM CHECK_DATA_ON_SKB1                                            *
    form check_data_on_SKB1.
      data: saknr_as_numeric(10) type n. "for leading zero
      check not tab-msgnr = '1'. "no need to go further if already rejected
      case tab-usafl.
      when 'I' or 'E' or 'C'.
        if not tab-saknr is initial.
          TAB-MSGNR = '1'.
          concatenate 'G/L Account no. should be blank for usage indicator'
            tab-usafl into tab-msgtx separated by space.
        else.
          tab-saknr_for_posting = CONST_SAKNR_WIP_MAT.
        endif.
      when 'T' or 'S'.
        if not tab-saknr is initial.
          TAB-MSGNR = '1'.
          concatenate 'G/L Account no. should be blank for usage indicator'
            tab-usafl into tab-msgtx separated by space.
        else.
          tab-saknr_for_posting = CONST_SAKNR_WIP_MAT_SUB_CON.
        endif.
      when 'X'. "G/L acct is required for eXpense
        if tab-saknr is initial.
          TAB-MSGNR = '1'.
          concatenate 'G/L Account no. is REQUIRED for usage indicator'
            tab-usafl into tab-msgtx separated by space.
        else.
          CATCH SYSTEM-EXCEPTIONS CONVT_NO_NUMBER = 4.
            SAKNR_AS_NUMERIC = TAB-SAKNR.
          endcatch.
          if sy-subrc = 4.
            TAB-MSGNR         = '1'.
            TAB-MSGTX         = 'Invild G/L acct no. (should be numeric)'.
          endif.
          select single skb1~saknr
            into skb1-saknr
          from skb1
          where skb1~bukrs = tab-bukrs
            and skb1~saknr = saknr_as_numeric. " tab-saknr.
          if sy-subrc = 0.
            tab-saknr_for_posting = saknr_as_numeric. " tab-saknr.
          else.
            TAB-MSGNR = '1'.
            TAB-MSGTX = 'G/L Account no. not found (SKB1)'.
          endif.
        endif.
      endcase.
    endform.
      FORM CHECK_DATA_ON_PREIOD                                          *
    form check_data_on_period.
      check p_chk_pd = 'X'.      "check period option is selected
      check not tab-msgnr = '1'. "no need to go further if already rejected
      if   tab-erdat < g_period_start_date "record in past period, reject!
        or tab-erdat > g_period_end_date.  "record in future period, reject!
        TAB-MSGNR = '1'.
        TAB-MSGTX = 'Record date is not in open period.'.
      endif.
    endform.
      FORM CHECK_DATA_ON_MBEW                                            *
    form check_data_on_mbew.
      data: local_stprs like mbew-stprs. "std price
      data: local_peinh like mbew-peinh. "price unit
      check not tab-msgnr = '1'. "no need to go further if already rejected
    *Standard cost is checked for all records
    *Though calculation is only required for usage 'E'
    check tab-usafl = 'E' "for External procurement
        or tab-usafl = 'T' "for Transfer to sub-contractor
        or tab-usafl = 'S'."for Sale to sub-contractor
      select single stprs              "std price
                    peinh              "price unit
              into  (local_stprs,      "std price
                     local_peinh)      "price unit
        from mbew                      "material valuation
        where matnr = tab-matnr        "material
          and bwkey = tab-werks.       "plant
      if ( sy-subrc <> 0 )             "record not round
        or ( local_stprs = 0 ).        "std cost = 0 (should not happen)
        TAB-MSGNR = '1'.
        TAB-MSGTX = 'Standard cost not found or = 0 (MBEW)'.
      else.                            "calculate the cost of 1 EA
        tab-unitstdcost = local_stprs / local_peinh * 100.
      endif.
    endform.
      FORM CHECK_DATA_ON_ZPRDORDHDR                                      *
    form check_data_on_zprdordhdr.
      check not tab-msgnr = '1'. "no need to go further if already rejected
    Production order is not required for usage indicator 'T' or 'S'
    Even the number is provided, it may or may not exist in ZPRDORDHDR
    Therefore, all checking on production order can be skipped for T & S
    (11/11/2002, confirmation from Stephen Chung, Miura-san, Sato-san)
      check tab-usafl <> 'T'  "Transfer to sub-contract
        and tab-usafl <> 'S'  "Sales to sub-contract
    Confirmed by Miura-san on 11/30/2002
    Production order no. is also not required for 'X' (Expense)
        and tab-usafl <> 'X'. "Expenses
      if tab-aufnr is initial.
        TAB-MSGNR = '1'.
        TAB-MSGTX = 'Production order number is missing'.
        exit.
      endif.
      select single zprdordhdr~aufnr
        into zprdordhdr-aufnr
        from zprdordhdr
        where zprdordhdr~werks = tab-werks
          and zprdordhdr~aufnr = tab-aufnr.
      if sy-subrc <> 0.
        TAB-MSGNR = '1'.
        TAB-MSGTX = 'Production order number not found (ZPRDORDHDR)'.
      else.
        select max( zprdordhdr~runum )
          into tab-runum
          from zprdordhdr
          where zprdordhdr~werks = tab-werks
            and zprdordhdr~aufnr = tab-aufnr.
       if tab-runum is initial.
         TAB-MSGNR = '1'.
         TAB-MSGTX = 'Production order number not found (ZPRDORDHDR)'.
       else.
          select single
             stats   "production order status
             SUBPR   "Sub-contracting Production Order
            into (zprdordhdr-stats,
                  tab-hdr_SUBPR)    "save into internal table TAB directly!
            from zprdordhdr
            where zprdordhdr~werks = tab-werks
              and zprdordhdr~aufnr = tab-aufnr
              and zprdordhdr~runum = tab-runum.
          if ( zprdordhdr-stats <> 'O' )
            and ( zprdordhdr-stats <> 'C' ).
            TAB-MSGNR = '1'.
            concatenate 'No tx is allowed, production order in status'
            zprdordhdr-stats into tab-msgtx separated by space.
          endif.
       endif.
      endif.
    endform.
      FORM CHECK_DATA_ON_MARA                                            *
    form check_data_on_mara.
      check not tab-msgnr = '1'. "no need to go further if already rejected
    get cost center that is from profit center in MARC
      SELECT SINGLE MARA~MATKL                   "material group
        into MARA-MATKL                          "material group
        FROM MARA                                "Material master
        WHERE MATNR = TAB-MATNR.                 "material
      IF SY-SUBRC = 0.
        TAB-MATKL = MARA-MATKL.                  "material group
      ELSE.
        TAB-MSGNR = '1'.
        TAB-MSGTX = 'Material not found (mat.gp./cust code missing) (MARA)'.
      ENDIF.
    ENDFORM.
      FORM CHECK_DATA_ON_MARC                                            *
    form check_data_on_marc.
      check not tab-msgnr = '1'. "no need to go further if already rejected
    get cost center that is from profit center in MARC
      SELECT SINGLE PRCTR
        into MARC-PRCTR
        FROM MARC  "Plant Data for Material
        WHERE MATNR = TAB-MATNR  "material
          AND WERKS = TAB-WERKS. "plant
      IF SY-SUBRC EQ 0.
        TAB-PRCTR = MARC-PRCTR.  "profit center
      ELSE.
        TAB-MSGNR = '1'.
        TAB-MSGTX =
          'Mat. not found in plant. (Profit center missing) (MARC)'.
      ENDIF.
    ENDFORM.
      FORM CHECK_DATA_ON_KNA1                                            *
    form check_data_on_kna1.  "customer number
    data: kunnr_as_numeric(10) type n.
    data: kunnr_as_string(10).
      check not tab-msgnr = '1'. "no need to go further if already rejected
      check not tab-kunnr is initial.
    IF NOT TAB-KUNNR CA 'ABCDEFGHIJKLMNOPQRSTUVWXYZ.,-_#'.
       kunnr_as_numeric = tab-kunnr.
       kunnr_as_string = kunnr_as_numeric.
    else.
       kunnr_as_string = tab-kunnr.
    ENDIF.
      select single kna1~kunnr
        into kna1-kunnr
        from kna1
      where kunnr = kunnr_as_string. " tab-kunnr.
        where kunnr = tab-kunnr. "customer no. (w/ leading zero if numeric)
      if sy-subrc <> 0.
        TAB-MSGNR = '1'.
        concatenate 'Customer number' tab-kunnr 'not found (KNA1)'
          into tab-msgtx separated by space.
      ENDIF.
    endform.
      FORM CHECK_Sub_contract                                            *
    form check_sub_contract.
      check not tab-msgnr = '1'. "no need to go further if already rejected
      if tab-kunnr is initial.
        if ( tab-usafl = 'T' )
          or ( tab-usafl = 'S' ).
          TAB-MSGNR = '1'.
          concatenate 'Cust number should not be blank for usage indicator'
            tab-usafl into tab-msgtx separated by space.
        endif.
      else.
        if ( tab-usafl <> 'T' )
          and ( tab-usafl <> 'S' ).
          TAB-MSGNR = '1'.
          concatenate 'Cust. number should be blank for usage indicator'
            tab-usafl into tab-msgtx separated by space.
        endif.
      endif.
    endform.
      FORM CHECK_DATA_ON_t001k                                           *
    form check_data_on_t001k.
      check not tab-msgnr = '1'. "no need to go further if already rejected
      select single * from t001k  "Valuation area
        where bwkey = tab-werks.  "plant
      if sy-subrc = 0.
        tab-bukrs = t001k-bukrs.  "company code
      else.
        TAB-MSGNR = '1'.
        concatenate 'Company code not found for plant'
                    tab-werks '(T001K)'
          into tab-msgtx separated by space.
      endif.
    endform.
      FORM POST_GOODS_ISSUE                                              *
    form post_goods_issue.
      perform UPDATE_GI_FOR_COST_CTR.
    clear FI_DOC_TEXT.
    FI_DOC_TEXT+0(35) = tab-idnum.
    write: tab-menge to FI_DOC_TEXT+35(15) right-justified.
    write: / '**', tab-matdoc, '**'.
    endform.
      FORM MAIN_UPDATE                                                   *
    FORM MAIN_UPDATE.
    data: current_lock_matnr like mara-matnr.
    *>>1104
    sort tab by post_seq_RAND ascending.
    *>>1104
    Direction: I=Issue, R=Reverse
    Do reverse first since it will increase invenotry
      sort tab by direction  descending "R first, then I
                  werks      ascending
                  matnr      ascending. "Sort by plant and then material
      if p_nor = 'X'. "new posting first step
    read the first record into the last flag to avoid problem when
    processing the 1st record
        loop at tab where msgnr <> '1'. "skip the rejected records
          last_matnr = tab-matnr.
          last_direction = tab-direction.
          last_werks = tab-werks.
          exit.
        endloop.
      loop at tab where msgnr <> '1'. "skip the rejected records
        if ( tab-werks <> last_werks )
          or ( tab-matnr <&

    Yes I had solved this

  • Problem in AT selection screen validation

    Hi,
    I am having problem in AT SELECTION SCREEN Validation.
    I have 2 radiobutton and 6 parameter. if i click first radio button  all the 6 radiobutton should enable and take the user input, that is working fine for me.
    if i click second radiobutton , out of 6 , 3 parameter should disable and remaining 3 should enable. thats also working fine.
    My problem is program has written the validation for this 3 parameter in the AT SELECTION SCREEN.
    For first radioutton all the validation working  fine, for second validation as soon as i press the radiobutton it will display error message. Based on 2 parameter user is filling value for 3 rd parameter.
    I want the same validation to be done for second radio button after user pressing enter.
    PARAMETER: p_single RADIOBUTTON GROUP rad1 DEFAULT 'X' USER-COMMAND f1,
               p_multi RADIOBUTTON GROUP rad1.
    PARAMETERS: s_pwwrk LIKE plaf-pwwrk.          
    PARAMETERS: p_lgort LIKE plaf-lgort.
    PARAMETERS: p_kostl LIKE cobl-kostl.
    here is my code:
    AT SELECTION SCREEN.
    CLEAR t001w.
      CLEAR t001k.
      CLEAR marv.
      SELECT SINGLE * FROM t001w WHERE werks EQ s_pwwrk.
      IF sy-subrc NE 0.
        MESSAGE e999 WITH 'Plant' s_pwwrk 'does not exist'.
      ELSE.
        SELECT SINGLE * FROM t001k WHERE bwkey EQ t001w-bwkey.
        SELECT SINGLE * FROM marv WHERE bukrs EQ t001k-bukrs.
        IF p_budat0(4) NE marv-lfgja OR p_budat4(2) NE marv-lfmon
    IF marv-xruem IS NOT INITIAL.
            IF p_budat0(4) NE marv-vmgja OR p_budat4(2) NE marv-vmmon.
    MESSAGE e999 WITH p_budat4(2) p_budat0(4)
                                'is closed.
                                            Please try again.'.
            ENDIF.
          ELSE.
            MESSAGE e999 WITH p_budat4(2) p_budat0(4)
                              'is closed.
                                          Please try again.'.
          ENDIF.
        ENDIF.
      ENDIF.

    For your Case ,
    If i understand clearly,You can do the validation when you want on AT SELECTION SCREEN ON WP_FIELD.
    If you say your validation to be done only for Selection of Second Radio Button, then..
    AT SELECTION SCREEN.
    if p_multi  eq 'X'. "<- Make Validation to be done only if user select Second Button
    CLEAR t001w.
    CLEAR t001k.
    CLEAR marv.
    SELECT SINGLE * FROM t001w WHERE werks EQ s_pwwrk.
    IF sy-subrc NE 0.
    MESSAGE e999 WITH 'Plant' s_pwwrk 'does not exist'.
    ELSE.
    SELECT SINGLE * FROM t001k WHERE bwkey EQ t001w-bwkey.
    SELECT SINGLE * FROM marv WHERE bukrs EQ t001k-bukrs.
    IF p_budat+0(4) NE marv-lfgja OR p_budat+4(2) NE marv-lfmon
    IF marv-xruem IS NOT INITIAL.
    IF p_budat+0(4) NE marv-vmgja OR p_budat+4(2) NE marv-vmmon.
    MESSAGE e999 WITH p_budat+4(2) p_budat+0(4)
    'is closed.
    Please try again.'.
    ENDIF.
    ELSE.
    MESSAGE e999 WITH p_budat+4(2) p_budat+0(4)
    'is closed.
    Please try again.'.
    ENDIF.
    ENDIF.
    ENDIF.
    endif.

  • How to do the Validations in Report Programming?

    How to do the Validations in Report Programming?
    how to do screen Validations and Field Validations if posssible can any one send the code regarding the Validation ....
    Tks
    Durusoju

    AT SELECTION-SCREEN - selscreen_event
    Syntax
      | { ON {para|selcrit} }
      | { ON END OF selcrit }
      | { ON BLOCK block }
      | { ON RADIOBUTTON GROUP radi }
      | { }
      | { ON {HELP-REQUEST|VALUE-REQUEST}
      |   FOR {para|selcrit-low|selcrit-high} }
      | { ON EXIT-COMMAND }.
    Alternatives:
    1. ... OUTPUT
    2. ... ON {para|selcrit}
    3. ... ON END OF selcrit
    4. ... ON BLOCK block
    5. ... ON RADIOBUTTON GROUP radi
    6. ... { }
    7. ... ON {HELP-REQUEST|VALUE-REQUEST} FOR
          {para|selcrit-low|selcrit-high} }
    8. ... ON EXIT-COMMAND
    Effect
    These additions allow individual evaluation of specific elements of the selection screens of the program. The information as to which selection has triggered the event is contained in the system field sy-dynnr.
    Alternative 1
    ... OUTPUT
    Effect
    This event is triggered at the screen event PBO of a selection screen. In the event block, the selection screen can be prepared through assignments to the data objects of parameters and selection criteria and through dynamic screen modifications.
    Note
    The assignments to input fields in the event block AT SELECTION-SCREEN OUTPUT always affect the selection screen and overwrite the user inputs from previous displays of the same selection screen. Assignments in the event blocks LOAD-OF-PROGRAM oder INITIALIZATION, on the other hand, only have an effect at first program start.
    Alternative 2
    ... ON {para|selcrit}
    Effect
    This event is triggered at the screen event PAI of a selection screen if the content of the input field of a parameter para or a line of a selection criterion selcrit was passed to the ABAP program. In the event block, the user input can be checked. Sending a warning or an error message in the event block makes the fields para and selcrit ready for input again.
    No parameter that is defined as a radio button can be specified. For this purpose, the addition ON RADIOBUTTON GROUP is provided.
    Note
    If a user action takes place in the dialog box for the multiple selection of a selection criterion selcrit, the entries of the selection table are passed to the program, line by line. For each line, the event AT SELECTION-SCREEN ON selcrit is triggered.
    Alternative 3
    ... ON END OF selcrit
    Effect
    This event is triggered after the selection table selcrit has been fully passed to the program after a user action in the dialog box for the multiple selection has taken place. In the event block, the entire selection table can be checked.
    Alternative 4
    ... ON BLOCK block
    Effect
    This event is triggered at the screen event PAI of a selection screen if all the input fields of a block block of the selection screen were passed to the ABAP program. In the event block, the user inputs can be checked. Sending a warning or an error message in the event block makes all the fields of the block block ready for input again.
    Alternative 5
    ... ON RADIOBUTTON GROUP radi
    Effect
    This event is triggered at the screen event PAI of a selection screen if all the fields of a radio button group radi of the selection screen were passed to the ABAP program. In the event block, the user input can be checked. Sending a warning or error message in the event block makes all the radion buttons of the block radi ready for input again.
    Note
    The individual fields of a radio button group are not passed individually and do not trigger the event AT SELECTION-SCREEN ON par.
    Alternative 6
    Effect
    The event AT SELECTION-SCREEN itself is triggered as the last event of selection screen processing if all the input values were passed to the program. In this event block, all the user inputs can be checked. Sending a warning or an error message in the event block makes all the screen fields ready for input once again.
    Alternative 7
    ... ON { HELP-REQUEST | VALUE-REQUEST } FOR
        {para|selcrit-low|selcrit-high} }
    Effect
    The two events ON HELP-REQUEST and ON VALUE-REQUEST are triggered at the screen events POH and POV of a selection screen if - for the input field of a parameter para or one of the input fields of a selection criterion selcrit - the field help F1 or the input help F4 was called. Other selection events are not triggered.
    In the event blocks, a self-defined field or input field can be programmed, which overrides any helps possibly defined in the ABAP Dictionary.
    Notes
    These event blocks can only be implemented for fields of the selection screen that are defined in the same ABAP program and not in a possibly linked logical database.
    With the events for the field and input help, no data is transported between the selection screen and the ABAP program. As with general screens, suitable function modules must be used for these. The parameters and selection criteria changed for the input help are transported to the selection screen.
    Alternative 8
    ... ON EXIT-COMMAND
    Effect
    This event is triggered if the user has called one of the functions Back, Exit or Cancel. In the event block, possible clean-up actions can be executed.
    Example
    In these executable programs, a standard selection screen and a further selection screen are defined. In the event blocks AT SELECTION-SCREEN, the inputs in the selection screens can be specially handled using the name p_carrid and the screen number in sy-dynnr.
    REPORT demo_at_selection_screen.
    Global data
    DATA: sflight_tab TYPE TABLE OF sflight,
          sflight_wa  LIKE LINE  OF sflight_tab.
    Selection screens
    PARAMETERS p_carrid TYPE spfli-carrid.
    SELECTION-SCREEN BEGIN OF SCREEN 500.
      SELECT-OPTIONS s_conn FOR sflight_wa-connid.
      DATA s_conn_wa LIKE LINE OF s_conn.
    SELECTION-SCREEN END OF SCREEN 500.
    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.
    AT SELECTION-SCREEN.
      IF sy-dynnr = '0500'.
        IF s_conn IS INITIAL.
          MESSAGE 'Please enter values' TYPE 'W'.
        ELSE.
          SELECT *
                 FROM sflight
                 INTO TABLE sflight_tab
                 WHERE carrid = p_carrid AND
                       connid IN s_conn.
          IF sy-subrc <> 0.
            MESSAGE 'No flights found' TYPE 'E'.
          ENDIF.
        ENDIF.
      ENDIF.
    Main program
    START-OF-SELECTION.

  • Slection Screen Validations

    Hi Experts,
        Could any one provide me the material for selection screen validations
    Ex: In selection Initial screen, I have 2 radio buttons. Based on selecting the radio button, the input selection screen should be displayed below the radio buttons?
    like these  provide me diff examples and also provide me the materials for these
    Thanks,
    Sanju

    Hi Sanjana,
    U can use the AT SELECTION-SCREEN event to do the necessary validation and checks..so in your case if a particular is mandatory for rd1 and not for rd2..in that case please take out the obligatory clause from the parameter and do the validation in the above event..basically if rd1 is selected and the particular parameter is blank ..display an error message.
    check this sample code.
    REPORT  ztest.
    TABLES: mara,vbak.
    PARAMETERS: r_m  RADIOBUTTON GROUP g1 DEFAULT 'X' USER-COMMAND ABC,
                r_s  RADIOBUTTON GROUP g1.
    parameters: p_matnr like mara-matnr,
                    p_vbeln like vbak-vbeln.
    AT SELECTION-SCREEN OUTPUT.
      IF r_m = 'X'.
        LOOP AT SCREEN.
          IF screen-name = 'P_VBELN'.
            screen-input = 0.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ELSE.
        LOOP AT SCREEN.
          IF screen-name = 'P_MATNR'.
            screen-input = 0.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.
    AT SELECTION-SCREEN.
    <b>  IF sy-ucomm = 'ONLI'.</b>
        IF r_m = 'X'.
          IF P_matnr IS INITIAL.
            MESSAGE e000(zz) WITH 'error'.
          ENDIF.
        ENDIF.
      ENDIF.
    Regards,
    Priyanka.<b></b>

  • Report validations

    Hi frnds,
                    i m giving my selection screen validations code, but its not giving error statement.
    can anyone correct me where i am wrong or what more shuld i write in the code to do the exact validations.
    <code>
    PERFORM VALID_CUST.
    PERFORM VALID_SALES.
    FORM VALID_CUST.
    IF SO_CUST[] IS NOT INITIAL.
    SELECT SINGLE KUNNR FROM KNA1 INTO V_KNA1 WHERE KUNNR IN SO_CUST.
    IF SY-SUBRC EQ 0.
    ELSE.
    MESSAGE E000(ZRAJ) WITH 'PLZ ENTER VALID CUSTOMER DOCUMENT NUMBER'.
    ENDIF.
    ENDIF.
    ENDFORM.
    FORM VALID_SALES.
    IF SO_SALES[] IS NOT INITIAL.
    SELECT SINGLE VBELN FROM VBAK INTO V_VBAK WHERE VBELN IN SO_SALES.
    IF SY-SUBRC EQ 0.
    ELSE.
    MESSAGE E001(ZRAJ) WITH 'PLZ ENTER VALID SALES DOCUMENT NUMBER'.
    ENDIF.
    ENDIF.
    ENDFORM.
    </code>

    Hi
    that validation code should be writen under<b> AT SELECTION SCREEN</b> event
    refer my code
    REPORT  ZNNR_REPORT NO STANDARD PAGE HEADING MESSAGE-ID ZNNR LINE-SIZE 100 LINE-COUNT 65(4).
    ******DATA DECLARATIONS**********
    DATA : BEGIN OF IT_PLANT OCCURS 0,
            MATNR LIKE MARA-MATNR,
            WERKS LIKE MARC-WERKS,
            PSTAT LIKE MARC-PSTAT,
            EKGRP LIKE MARC-EKGRP,
           END OF IT_PLANT.
    DATA : BEGIN OF IT_PONO OCCURS 0,
            EBELN LIKE EKKO-EBELN,
            EBELP LIKE EKPO-EBELP,
            MATNR LIKE EKPO-MATNR,
            WERKS LIKE EKPO-WERKS,
            LGORT LIKE EKPO-LGORT,
           END OF IT_PONO.
    TABLES EKKO.
    ********END OF DATA DECLARATIONS*********
    ********SELECTION SCREEN DESIGN ***********
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETER : P_WERKS LIKE MARC-WERKS MODIF ID S1.
    SELECT-OPTIONS : S_EBELN FOR EKKO-EBELN NO INTERVALS MODIF ID S2.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-004.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS : R1 RADIOBUTTON GROUP G1 DEFAULT 'X'.
    SELECTION-SCREEN COMMENT 5(20) TEXT-002 FOR FIELD R1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS : R2 RADIOBUTTON GROUP G1.
    SELECTION-SCREEN COMMENT 5(20) TEXT-003 FOR FIELD R2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK B2.
    ******END OF SELECTION SCREEN DESIGN****************
    *********INITIALIZATION OF SELECTION SCREEN ELEMENTS.*****
    INITIALIZATION.
    P_WERKS = '1000'.
    S_EBELN-LOW = '4500016926'.
    S_EBELN-OPTION = 'EQ'.
    S_EBELN-SIGN = 'I'.
    APPEND S_EBELN.
    CLEAR S_EBELN.
    ************END OF INITIALIZATION***********************
    ***********SCREEN MODIFICATIONS*******************
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF R1 EQ 'X' AND SCREEN-GROUP1 EQ 'S2'.
          SCREEN-INPUT = 0.
          MODIFY SCREEN.
        ENDIF.
        IF R2 EQ 'X' AND SCREEN-GROUP1 EQ 'S1'.
          SCREEN-INPUT = 0.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    ********END OF SCREEN MODIFICATIONS*****************
    ***************SCREEN VALIDATIONS *****************
    at selection-screen.
      SELECT SINGLE *
               FROM EKKO
               INTO EKKO
               WHERE EBELN IN S_EBELN.
      IF SY-SUBRC <> 0.
        SET CURSOR FIELD 'S_EBELN-LOW'.
        MESSAGE E999 WITH TEXT-005.
      ENDIF.
    ********end of screen validation*****************
    <b>reward if usefull</b>

  • Validations at selection-screen

    hi ,
    how to do validations at selection-screen?
    with regards
    always learner
    points will be rewarded if useful

    Hi Buddy
      Its good to learn alwasys . Here are some progarms which are useful in selection- screen.
    Dont forget to reward points.
    at selection-screen.
    select LIFNR
           from LFB1
           into table
           where lifnr in s_lifnr.
    if sy-subrc ne 0.
    message e888(sabapdocu) with 'no number found'.
    endif.
    in this way u can write the select query.
    selection-screen begin of block b1.
    parameters: p_datum1 type sy-datum,
    p_datum2 type sy-datum.
    selection-screen end of block b1.
    at selection-screen on block b1.
    if p_datum1 is initial
    and p_datum2 is initial.
    message e001(00) with 'Enter at least one date'.
    endif.
    PARAMETERS: TEST1(10) MODIF ID SC1,
                TEST2(10) MODIF ID SC2,
                TEST3(10) MODIF ID SC1,
                TEST4(10) MODIF ID SC2.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
      IF SCREEN-GROUP1 = 'SC1'.
        SCREEN-INTENSIFIED = '1'.
        MODIFY SCREEN.
        CONTINUE.
      ENDIF.
      IF SCREEN-GROUP1 = 'SC2'.
        SCREEN-INTENSIFIED = '0'.
        MODIFY SCREEN.
      ENDIF.
    ENDLOOP.
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
      PARAMETERS: R1 RADIOBUTTON GROUP RAD1 DEFAULT 'X',
                  R2 RADIOBUTTON GROUP RAD1,
                  R3 RADIOBUTTON GROUP RAD1.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME.
      PARAMETERS: R4 RADIOBUTTON GROUP RAD2 DEFAULT 'X',
                  R5 RADIOBUTTON GROUP RAD2,
                  R6 RADIOBUTTON GROUP RAD2.
    SELECTION-SCREEN END OF BLOCK B2.
    AT SELECTION-SCREEN ON RADIOBUTTON GROUP RAD1.
      IF R1 = 'X'.
        MESSAGE W040(HB).
      ENDIF.
    AT SELECTION-SCREEN ON RADIOBUTTON GROUP RAD2.
      IF R4 = 'X'.
        MESSAGE W040(HB).
      ENDIF.

  • Problem in selection screen validation.

    Hi All,
    I am having the following in the selection screen:
    PARAMETERS : p_r1 RADIOBUTTON GROUP grp DEFAULT 'X' USER-COMMAND dlvy,
                 p_r2 RADIOBUTTON GROUP grp .
    SELECTION-SCREEN BEGIN OF BLOCK b1 with frame title text-001.
    SELECT-OPTIONS: s_vbeln FOR lips-vbeln             MODIF ID dly.
    SELECT-OPTIONS: s_lfart FOR likp-lfart  OBLIGATORY MODIF ID dly.
    SELECT-OPTIONS: s_vstel FOR likp-vstel             MODIF ID dly.
    SELECT-OPTIONS: s_matnr FOR lips-matnr             MODIF ID dly.
    SELECT-OPTIONS: s_wadat FOR likp-wadat  OBLIGATORY MODIF ID dly.
    SELECT-OPTIONS: s_wbsta FOR vbup-wbsta             MODIF ID dly.
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 with frame title text-002.
    SELECT-OPTIONS: s1_matnr FOR lips-matnr MODIF ID mat.
    SELECT-OPTIONS: s_extwg  FOR mara-extwg MODIF ID mat.
    SELECT-OPTIONS: s_werks  FOR marc-werks MODIF ID mat.
    SELECTION-SCREEN END OF BLOCK b2.
    If I choose Radio Button 1, only option 1 should be triggered,
    If I choose Radio Button 2, only option 2 should be triggered,
    For this I have:
    AT SELECTION-SCREEN OUTPUT.
      IF p_r1 = 'X'.
        blk_hide = 'MAT'.
        blk_show = 'DLY'.
      ELSE.
        blk_hide = 'DLY'.
        blk_show = 'MAT'.
      ENDIF.
      LOOP AT SCREEN.
        IF screen-group1 = blk_hide.
          screen-active = 0.
        ELSE.
          IF screen-group1 = blk_show.
            screen-active = 1.
          ENDIF.
        ENDIF.
        MODIFY SCREEN.
      ENDLOOP.
    Now I need to validate the selection Screen, I am facing issue in doing selection screen validation:
    Can any one help me in how to go about this?
    Thanks,
    Debrup.

    pls. replace the AT SELECTION-SCREEN OUTPUT event with this one:
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        CASE 'X'.
          WHEN p_r1.
            CASE screen-group1.
              WHEN 'DLY'.
                screen-active = '1'.
              WHEN 'MAT'.
                screen-active = '0'.
            ENDCASE.
          WHEN p_r2.
            CASE screen-group1.
              WHEN 'DLY'.
                screen-active = '0'.
              WHEN 'MAT'.
                screen-active = '1'.
            ENDCASE.
        ENDCASE.
        MODIFY SCREEN.
      ENDLOOP.

  • REGARDING RADIOBUTTON

    HI GURUS,
    I have 2 groups.in one group 2 radiobuttons,pdhplant,pp plant
    in 2nd group , ihave 4 radio buttons,offspec,linespec,line1&line2.
    my requirement is if i click,pdh plant then all the 2nd group radio buttons will disable mode& if i select pp plant then again
    my 2nd group radiobuttons in actibe state.
    how to achive ,  please help me.
    thanks
    subhasis

    Hi,
    Use modif id to ur block which u want to make inactive and active.
    selection screen:
    selection-screen begin of block output1 with frame title
                              text-o01.
    parameters p_outscr type c radiobutton group out1
                               default 'X' user-command uc1.
    parameters p_outfil type c radiobutton group out1.
    selection-screen end of block output1.
    selection-screen begin of block output2 with frame title
                              text-o02.
    parameters p_nonuni as checkbox modif id out.
    parameters p_tstamp as checkbox default 'X'
                              modif id out user-command uc1.
    selection-screen end of block output2.
    selection-screen begin of block output3 with frame title
                              text-o03.
    parameters p_pcfile type c radiobutton group out2
                      modif id out user-command uc1.
    parameters p_fname like rlgrap-filename modif id out
                      default 'C:\SAP Reports\ZVL06O.txt'.
    parameters p_unix type c radiobutton group out2
                      default 'X' modif id out.
    parameters p_uname like rlgrap-filename modif id out.
    skip 1.
    selection-screen comment /1(50) text-o04 modif id out.
    parameters p_yes as checkbox modif id out.
    selection-screen comment /1(50) text-o05 modif id out.
    parameters p_sep type c modif id out.
    selection-screen end of block output3.
    This is validation:
    at selection-screen output.
    IF p_outscr = 'X'.
        CLEAR: p_yes, p_sep.
        LOOP AT SCREEN.
          IF screen-group1 = 'OUT'.
            screen-active = 0.
            MODIFY SCREEN.
          ENDIF.
        ENDLOOP.
      ENDIF.
    Regards,
    Subbu

  • Make fields active on radiobutton selection

    Hello all,
    I have two radiobuttons and two fields.When I select first radiobutton, field1 should be active and when I select second radiobutton field2 should be active.I am able to achieve this using at selection screen output event.But the problem is that when I select first radiobutton, field1 should be mandatory and if I switch to second radiobutton from the first one, field2 should be mandatory. When I switch from radiobutton 1 to radiobutton 2, the validation for the field2 is kicked off even before the field is avaiable for input.How to achieve this?
    Thanks
    Sandeep

    hi ,
    *& Report  ZVENKATTEST0
    REPORT  ZVENKATTEST0.
    TABLES:MARA.
    SELECT-OPTIONS:S_TEST1 FOR MARA-MATNR MODIF ID M1 ,
                   S_TEST2 FOR MARA-MEINS MODIF ID M2 .
    PARAMETERS:P_RAD1 RADIOBUTTON  GROUP G1 USER-COMMAND UC1 DEFAULT 'X',
               P_RAD2 RADIOBUTTON GROUP G1 ,
               P_RAD3 RADIOBUTTON GROUP G1 .
    AT SELECTION-SCREEN OUTPUT .
      LOOP AT SCREEN.
        IF P_RAD1 = 'X'.
          IF SCREEN-NAME = 'S_TEST1-LOW' .
            SCREEN-INPUT = '0'.
            MODIFY SCREEN.
          ENDIF.
          IF SCREEN-NAME = 'S_TEST1-HIGH' .
            SCREEN-INPUT = '0'.
            MODIFY SCREEN.
          ENDIF.
          IF SCREEN-NAME = 'S_TEST2-LOW' .
            SCREEN-INPUT = '0'.
            MODIFY SCREEN.
          ENDIF.
          IF SCREEN-NAME = 'S_TEST2-HIGH' .
            SCREEN-INPUT = '0'.
            MODIFY SCREEN.
          ENDIF.
       ENDIF.
          IF P_RAD2 = 'X'.
            IF SCREEN-NAME = 'S_TEST1-LOW' .
              SCREEN-INPUT = '0'.
              MODIFY SCREEN.
            ENDIF.
            IF SCREEN-NAME = 'S_TEST1-HIGH' .
              SCREEN-INPUT = '0'.
              MODIFY SCREEN.
            ENDIF.
          ENDIF.
            IF P_RAD3 = 'X'.
              IF SCREEN-NAME = 'S_TEST2-LOW' .
                SCREEN-INPUT = '0'.
                MODIFY SCREEN.
              ENDIF.
              IF SCREEN-NAME = 'S_TEST2-HIGH' .
                SCREEN-INPUT = '0'.
                MODIFY SCREEN.
              ENDIF.
            ENDIF.
         ENDLOOP.
    regards,
    venkat.

  • Checking a radiobutton

    Hy !
    I have this :
    SELECTION-SCREEN BEGIN OF LINE.
    SELECTION-SCREEN POSITION 5.
    SELECTION-SCREEN COMMENT (13) text-p03 FOR FIELD sb_wks.
    PARAMETERS: sb_wks RADIOBUTTON GROUP myg.
    And same for another radiobutton from the same group, in another line.
    I want to perform something is the radiobutton is choosed .
    I tried:
    IF NOT sb_wks IS INITIAL.
    PERFORM ods_wks.
    ENDIF.
    Not working ,
    Suggestions? Solutions?
    Thank you.

    hi,
    check the sample pg: declare radio buttons like below in program and use
    if P_list = 'X'.
    perform validation.
    endif.
    REPORT  ZSUDHA_SCREEN.
    **--- Radiobuttons
    PARAMETERS: p_up   RADIOBUTTON GROUP a DEFAULT 'X' USER-COMMAND rb,
                p_list RADIOBUTTON GROUP a.
    PARAMETERS: p_pcfile LIKE rlgrap-filename OBLIGATORY DEFAULT 'C:\'
                MODIF ID ccc,
                p_pctype LIKE rlgrap-filetype OBLIGATORY DEFAULT 'ASC'
                MODIF ID ccc,
                p_unix   LIKE rlgrap-filename OBLIGATORY DEFAULT '.\'
                MODIF ID ccc.
    PARAMETERS: p_dir LIKE rlgrap-filename OBLIGATORY DEFAULT '.'
                MODIF ID ddd,
                p_fp  LIKE rlgrap-filename
                MODIF ID ddd.
    AT SELECTION-SCREEN OUTPUT.
      IF p_up = 'X' .
        LOOP AT SCREEN.
          CASE screen-group1.
            WHEN 'CCC'.
              screen-input = 1.  "Enable
              screen-invisible = 0. "Disable
              MODIFY SCREEN.
            WHEN 'DDD'.
              screen-input = 0.
              screen-invisible = 1.
              MODIFY SCREEN.
          ENDCASE.
        ENDLOOP.
      ENDIF.
      IF p_list = 'X'.
        LOOP AT SCREEN.
          CASE screen-group1.
            WHEN 'CCC'.
              screen-input = 0.
              screen-invisible = 1.
              MODIFY SCREEN.
            WHEN 'DDD'.
              screen-input = 1.
              screen-invisible = 0.
              MODIFY SCREEN.
          ENDCASE.
        ENDLOOP.
      ENDIF.

  • Radiobutton actionmap problem

    I'm implementing a questionnaire consisting mainly of multiple choice questions.
    To speed up inputting I want to bind keys to the radiobuttons (numpad 1 for the first option, 2 for the second etc...) All the questions are embedded in panels that are displayed as cards through the cardLayout.
    But the keybindings only work for the first two cards (there are 30 questions/cards)? I don't understand why.
    Can anyone help?
    (Using Mnemonics results in exact the same problem but I don't want the user having to press the ALT-key.)
    My (stripped) code :
    The for loop that adds the radiobuttons to the panel (this panel is a card - for layout reasons its embedded in another panel) :
              for (Possibility possibility : question.getPossibilities()){
                   possibilityRadioButton = new MultipleChoicePossibilityRadioButton();
                   possibilityRadioButton.setBackground(QuestionPanel.BACKGROUND_COLOR);
                   possibilityRadioButton.setFont(ANSWER_FONT);
                   possibilityRadioButton.addActionListener(this);
                   possibilityRadioButton.setActionCommand(ANSWER_SUBMITTED);
                   KeyStroke keystroke = KeyStroke.getKeyStroke(NumpadKeys.get(question.getPossibilities().indexOf(possibility)),0);
                   possibilityRadioButton.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).
                                                                     put(keystroke,ANSWER_SUBMITTED);
                   possibilityRadioButton.getActionMap().put(ANSWER_SUBMITTED,
                             new AbstractAction() {
                                  public void actionPerformed(ActionEvent ae) {
                                       ((MultipleChoicePossibilityRadioButton) ae.getSource())
                                                 .doClick();
                   c.gridy = layoutRow++;
                   contentPanel.add(mogelijkheidRadioButton,c);
                   buttonGroup.add(mogelijkheidRadioButton);
              }NumpadKeys is a static list :
         private final static ArrayList<Integer> NumpadKeys = new ArrayList<Integer>();
           static {
                NumpadKeys.add(KeyEvent.VK_NUMPAD1);
                NumpadKeys.add(KeyEvent.VK_NUMPAD2);
                NumpadKeys.add(KeyEvent.VK_NUMPAD3);
                NumpadKeys.add(KeyEvent.VK_NUMPAD4);
                NumpadKeys.add(KeyEvent.VK_NUMPAD5);
                NumpadKeys.add(KeyEvent.VK_NUMPAD6);
                NumpadKeys.add(KeyEvent.VK_NUMPAD7);
                NumpadKeys.add(KeyEvent.VK_NUMPAD8);
                NumpadKeys.add(KeyEvent.VK_NUMPAD9);
           }Edited by: Garfke on Jul 23, 2009 4:25 AM

    You should submit an SSCCE to get a better chance of other people reproducing and debugging the problem.
    However, based on your description I'd suspect one thing (which I can't check myself as you didn't provide an SSCCE):
    From the Swing tutorial on [How to use key bindings|http://java.sun.com/docs/books/tutorial/uiswing/misc/keybinding.html] :
    +If more than one binding exists for the key, only the first valid one found is used. Input maps are checked in this order: (...)
    Because the order of searching the components is unpredictable, avoid duplicate WHEN_IN_FOCUSED_WINDOW bindings!+ (highlighting and exclamation marks are not mine, but are present as well in the tutorial!).
    In your case, several JRadioButtons of the CardLayout have the same keystroke "1", "2",... bound (to the same action name, but that's irrelevant since once the action name is found, the action will be fetched from the component's ActionMap). All bindings are valid in the WHEN_IN_FOCUSED_WINDOW mode, and only the "first" one is returned.
    As the order is unpredictable, it's probably only by chance that the "first" card's binding work. I don't get why the first and second both work, although I suspect the ordering or the search may be affected by the cardLayout swapping the cards, with no guarantee of the current card being the first one searched. Indded the javadoc for CardLayout.show(...) makes no such provision.
    Edited by: jduprez on Jul 23, 2009 12:18 PM - added note on action name being the same
    Edited by: jduprez on Jul 23, 2009 12:22 PM - and on cardLayout.show()

  • Tabular Form Validation Help

    Version 2.0
    I have a Tabular Form that represents Show dates. There are three displayed fields: Description (Text Field), Date (Date Picker), and Active (Static Select List: Yes;1,No,0).
    I need help to create a page validation to make sure that only one show is ACTIVE at a time when the row is submitted.
    Thanks,
    Joe

    On the database side, I use the following technique to implement a "radiobutton" constraint. I think I picked it up from AskTom.
    If you have a table like
    create table t
      show_id int,
      show_date varchar2(50),
      active_flag varchar2(1),
      constraint t#pk primary key (show_id,show_date)
    );which is what I think your data model looks like.
    You want to ensure that for a given show, only 1 show_date is active (radiobutton-style).
    Create the following function-based index on the table
    create unique index i on t(decode(active_flag,'Y',show_id));This will prevent invalid data from getting into the table, no matter what.
    Regarding your Apex issue, I would suggest that when you add a row to the tabular form, default the select list to Inactive. You can use client-side Javascript to do some toggling of the select lists, but that really assumes that all the rows are being shown in the tabular form. In any case, the unique index above would guarantee data integrity when the data finally hits the database.
    Hope this helps.

  • Radiobutton in output screen

    i want radiobutton in my output screen , can anyone help me out how can i add this to my out put screen.

    Hi
    see this report and you can understand very easily
    in this report some extra feture also available
    *& Report  ZNNR_REPORT
    REPORT  ZNNR_REPORT NO STANDARD PAGE HEADING MESSAGE-ID ZNNR LINE-SIZE 100 LINE-COUNT 65(4).
    ******DATA DECLARATIONS**********
    DATA : BEGIN OF IT_PLANT OCCURS 0,
            MATNR LIKE MARA-MATNR,
            WERKS LIKE MARC-WERKS,
            PSTAT LIKE MARC-PSTAT,
            EKGRP LIKE MARC-EKGRP,
           END OF IT_PLANT.
    DATA : BEGIN OF IT_PONO OCCURS 0,
            EBELN LIKE EKKO-EBELN,
            EBELP LIKE EKPO-EBELP,
            MATNR LIKE EKPO-MATNR,
            WERKS LIKE EKPO-WERKS,
            LGORT LIKE EKPO-LGORT,
           END OF IT_PONO.
    TABLES EKKO.
    ********END OF DATA DECLARATIONS*********
    ********SELECTION SCREEN DESIGN ***********
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    PARAMETER : P_WERKS LIKE MARC-WERKS MODIF ID S1.
    SELECT-OPTIONS : S_EBELN FOR EKKO-EBELN NO INTERVALS MODIF ID S2.
    SELECTION-SCREEN END OF BLOCK B1.
    SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-004.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS : R1 RADIOBUTTON GROUP G1 DEFAULT 'X'.
    SELECTION-SCREEN COMMENT 5(20) TEXT-002 FOR FIELD R1.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS : R2 RADIOBUTTON GROUP G1.
    SELECTION-SCREEN COMMENT 5(20) TEXT-003 FOR FIELD R2.
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK B2.
    ******END OF SELECTION SCREEN DESIGN****************
    *********INITIALIZATION OF SELECTION SCREEN ELEMENTS.*****
    INITIALIZATION.
    P_WERKS = '1000'.
    S_EBELN-LOW = '4500016926'.
    S_EBELN-OPTION = 'EQ'.
    S_EBELN-SIGN = 'I'.
    APPEND S_EBELN.
    CLEAR S_EBELN.
    ************END OF INITIALIZATION***********************
    ***********SCREEN MODIFICATIONS*******************
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF R1 EQ 'X' AND SCREEN-GROUP1 EQ 'S2'.
          SCREEN-INPUT = 0.
          MODIFY SCREEN.
        ENDIF.
        IF R2 EQ 'X' AND SCREEN-GROUP1 EQ 'S1'.
          SCREEN-INPUT = 0.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    ********END OF SCREEN MODIFICATIONS*****************
    ***************SCREEN VALIDATIONS *****************
    at selection-screen.
      SELECT SINGLE *
               FROM EKKO
               INTO EKKO
               WHERE EBELN IN S_EBELN.
      IF SY-SUBRC <> 0.
        SET CURSOR FIELD 'S_EBELN-LOW'.
        MESSAGE E999 WITH TEXT-005.
      ENDIF.
    ********end of screen validation*****************
    START-OF-SELECTION.
    *set pf-status '100'.
      IF R1 EQ 'X'.
        SELECT MATNR
               WERKS
               PSTAT
               EKGRP
           FROM MARC
           INTO TABLE IT_PLANT
           WHERE WERKS = P_WERKS.
        LOOP AT IT_PLANT.
          WRITE : SY-VLINE , 2 IT_PLANT-MATNR COLOR COL_KEY,
                 21 SY-VLINE , 22  IT_PLANT-WERKS COLOR COL_KEY,
                 27 SY-VLINE ,28 IT_PLANT-PSTAT COLOR COL_NORMAL,
                 43 SY-VLINE ,44 IT_PLANT-EKGRP COLOR COL_NORMAL.
        ENDLOOP.
      ENDIF.
      IF R2 EQ 'X'.
        SELECT EBELN EBELP MATNR WERKS LGORT
               FROM EKPO
               INTO TABLE IT_PONO
               WHERE EBELN IN S_EBELN.
        LOOP AT IT_PONO.
          WRITE : SY-VLINE , 2 IT_PONO-EBELN COLOR COL_KEY,
                 12 SY-VLINE , 13 IT_PONO-EBELP COLOR COL_KEY,
                 18 SY-VLINE , 19 IT_PONO-MATNR COLOR COL_NORMAL,
                 37 SY-VLINE , 38 IT_PONO-WERKS COLOR COL_NORMAL,
                 44 SY-VLINE , 45 IT_PONO-LGORT COLOR COL_NORMAL, 49 SY-VLINE..
        ENDLOOP.
      ENDIF.
    TOP-OF-PAGE.
      IF R1 EQ 'X'.
    *ULINE AT /1(48).
        WRITE : SY-VLINE ,2 'MATERIAL NUMBER',
                21 SY-VLINE , 22 'PLANT',
                27 SY-VLINE , 28 'STATUS',
                43 SY-VLINE , 44 'GRUP', 48 SY-VLINE.
        ULINE AT /1(48).
      ENDIF.
      IF R2 EQ 'X'.
        WRITE : SY-VLINE , 2 'PO NUMBER',
               12 SY-VLINE, 13 'ITEM',
               18 SY-VLINE,19 'MATERIAL NUMBER',
               37 SY-VLINE, 38 'PLANT',
               44 SY-VLINE, 45 'GRUP',
               49 SY-VLINE.
        ULINE AT /1(50).
      ENDIF.
    END-OF-PAGE.
      ULINE AT /1(50).
      WRITE :/10 'PAGE NUMBER', SY-PAGNO.

Maybe you are looking for