How to Disable field in Selection-screen

Hi All,
I want to disable Screen field in my seelction screen. Below is my Code, but it is not working.
I want to perform.
If RB1 = X
Then Parameter P_VBELN should get disabled. Please suggest, find below my code.
*....Selection Screen
selection-screen begin of block b1 with frame title text-001.
parameters: p_vbeln like vbak-vbeln.
selection-screen end of block b1.
selection-screen begin of block b2 with frame title text-002.
parameter: rb1 radiobutton group radi default 'X',
           rb2 radiobutton group radi.
selection-screen end of block b2.
*....At Selection Screen
AT Selection-screen.
  if p_vbeln = ''.
    MESSAGE ID 'ZID' TYPE 'E' NUMBER '000'.
  endif.
*....At selection screen output
AT Selection-screen output.
  if rb1 = 'X'.
    Loop at screen.
      if screen = 'P_VBELN'.
        screen-input = '0'.
      endif.
      modify screen.
    endloop.
  endif.
*....Start of selection
Start-of-Selection.
  select *
  from vbak into table itab1
   where vbeln = p_vbeln.
  if itab1 is initial.
    select *
    from vbap into table itab2
    for all entries in itab1
    where vbeln = itab1-vbeln.
  endif.

Hi Kamaljeet ,
In the code below..see the lines in BOLD..explanation is given as to why they are required
Code----
selection-screen begin of block b1 with frame title text-001.
parameters: p_vbeln like vbak-vbeln.
selection-screen end of block b1.
selection-screen begin of block b2 with frame title text-002.
parameter: rb1 radiobutton group radi default 'X' user-command ucomm,
rb2 radiobutton group radi.
selection-screen end of block b2.
AT Selection-screen output.
if rb1 = 'X'.
Loop at screen.
if screen-name = 'P_VBELN'.
screen-input = '0'.
endif.
modify screen.
endloop.
else.
Loop at screen.
if screen-name = 'P_VBELN'.
screen-input = '1'.
endif.
modify screen.
endloop.
endif.
Explanation----
If the user command is not given,the system will not trigger on the click of radio button..
Once triggered it comes to "At selection screen output"..where we must also mention the case when
radio button 2 is selected RB2 ..the p_vbeln must be input and when RB1 is selected the field
p_vbeln must be display only..Paste the code and see how it works
Then use the logic as desired...
Hope it helps
Regards
Byju

Similar Messages

  • How to disable fields on selection screen?

    hi,
    i have two fields f1 and f2 on selection screen and two radio buttons r1 and r2.
    if i select r1, f1 should be input enable and f2 shuld be disabled.
    and if i select r2, f2 should be input enable and f1 shuld be disabled.
    i hav code like this
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    PARAMETERS: p_Pfile TYPE rlgrap-filename,      "presentation server input file
                p_afile TYPE rlgrap-filename.      "application server input file
               p_efile TYPE rlgrap-filename.                "error file
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
    PARAMETERS: R_ps TYPE c RADIOBUTTON GROUP rd default 'X', "radio button for presentation server
                R_as TYPE c RADIOBUTTON GROUP rd .            "radio button for application server
    SELECTION-SCREEN END OF BLOCK blk2.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
    IF R_PS = C_X.
      IF SCREEN-NAME = P_PFILE.
       SCREEN-ACTIVE = 0.
       MODIFY SCREEN.
      ELSE.                           "IF SCREEN-NAME = P_AFILE.
       SCREEN-ACTIVE = 1.
       SCREEN-INPUT = 1.
        MODIFY SCREEN.
        ENDIF.
    ELSEIF R_AS = C_X.
      IF SCREEN-NAME = P_PFILE.
       SCREEN-ACTIVE = 0.
       MODIFY SCREEN.
      ELSE.                           "IF SCREEN-NAME = P_AFILE.
       SCREEN-ACTIVE = 1.
       SCREEN-INPUT = 1.
        MODIFY SCREEN.
        ENDIF.
    ENDIF.
    ENDLOOP.
    but i could not get that .
    plz help me

    Hi ,
    This is my test code look at "at selection screen output" part you will get it.
    data: g_user_has_auth(1) TYPE c,
           v_key LIKE sy-pfkey,
           it_ucomm TYPE TABLE OF sy-ucomm.
    CONSTANTS : c_yes TYPE c VALUE '1' ,
                c_no TYPE c VALUE '0' .
    INITIALIZATION.
    Code to remove standard execute button from selection screen.
      v_key = sy-pfkey.
      APPEND : 'ONLI' TO it_ucomm.
      CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
        EXPORTING
          p_status  = v_key
          p_program = ' '
        TABLES
          p_exclude = it_ucomm.
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
    SELECTION-SCREEN SKIP 1.
    PARAMETERS:      r_iobj  RADIOBUTTON GROUP rb1 USER-COMMAND OP1.
    PARAMETERS:      r_ods  RADIOBUTTON GROUP rb1.
    PARAMETERS:      r_cubes  RADIOBUTTON GROUP rb1.
      SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02 .
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(20) text-t02 FOR FIELD p_info MODIF ID OP1.
    PARAMETERS: p_info TYPE string MODIF ID OP1.
    SELECTION-SCREEN: PUSHBUTTON 68(10) but1 USER-COMMAND cli1 MODIF ID OP1.
    SELECTION-SCREEN : END OF LINE.
      SELECTION-SCREEN END OF BLOCK b2.
    SELECTION-SCREEN BEGIN OF BLOCK b3 WITH FRAME TITLE text-t04.
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN COMMENT 1(20) text-t02 FOR FIELD p_ods MODIF ID OP2.
    PARAMETERS: p_ods TYPE string MODIF ID OP2.
    SELECTION-SCREEN: PUSHBUTTON 68(10) ods1 USER-COMMAND cli3 MODIF ID OP2.
    SELECTION-SCREEN : END OF LINE.
    *SELECTION-SCREEN SKIP 1.
    *PARAMETERS:      r_exe  RADIOBUTTON GROUP rb2.
    *PARAMETERS:      r_st1  RADIOBUTTON GROUP rb2.
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN: PUSHBUTTON /1(20) ods_cr USER-COMMAND cli4 MODIF ID OP2.
    SELECTION-SCREEN END OF BLOCK b3.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF SCREEN-GROUP1 = 'OP1'.
          IF R_IOBJ = 'X'.
            SCREEN-INVISIBLE = C_NO.
            SCREEN-ACTIVE = C_YES.
            ELSE.
              SCREEN-INVISIBLE = C_YES.
              SCREEN-ACTIVE = C_NO.
              ENDIF.
              MODIFY SCREEN.
              ENDIF.
              IF SCREEN-GROUP1 = 'OP2'.
                IF R_ODS = 'X'.
                  SCREEN-INVISIBLE = C_NO.
                  SCREEN-ACTIVE = C_YES.
                  ELSE.
                    SCREEN-INVISIBLE = C_YES.
                    SCREEN-ACTIVE = C_NO.
                    ENDIF.
                    MODIFY SCREEN.
                    ENDIF.
                    ENDLOOP.

  • How to disable a standard selection screen of LDB?

    Hi Friends,
       My requirement is to disable a standard selection screen of a standard LDB and use my own Selection screen instead.How to go about it?.
    Prompt replies would be rewarded.
    Regards,
    Tamilarasan.

    Hi Tamilarasan,
      U can hide LDB field, in the following way.
    1.In tables statement remove the table name for the fields
      you done require.
    2.You can modify the screen fields. LOOP AT SCREEN
    3.In the program attributes you can choose the SAP defined
      selection screen if provided.
    Add can add new field, in the following way,
    1.If it is Customer program then as normal way like
    SELECTION-SCREEN: BEGIN OF BLOCK 1
    SELECT-OPTIONS:
    SELECTION-SCREEN END OF BLOCK 1.
    2. Goto SE36 and modify the selection views by creating  'CUS'.
    All LBD will not have dynamic selection. If you want you can copy to Z* version and add the following statement to have dynamic selction
    "SELECTION-SCREEN DYNAMIC SELECTIONS FOR TABLE" XXXX
    Regards,
    Prabhu Rajesh.

  • How to disable parameter in selection screen

    hi experts,
    SELECTION-SCREEN BEGIN OF BLOCK server WITH FRAME TITLE text-009.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: data_app RADIOBUTTON GROUP csbi.
    SELECTION-SCREEN COMMENT  4(35) text-006 FOR FIELD data_app."744242
    parameters : p_fname1 like rlgrap-filename default 'D:\usr\sap\ESP\DVEBMGS32\work\.boma1.dat' modif id s1.
    SELECTION-SCREEN END   OF LINE.
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: data_frn RADIOBUTTON GROUP csbi DEFAULT 'X'.
    SELECTION-SCREEN COMMENT  4(35) text-007 FOR FIELD data_frn."744242
    PARAMETERS: p_fname2 LIKE rlgrap-filename DEFAULT 'D:\Documents and Settings\czfnct\Desktop\boma.xls' modif id s2.
    SELECTION-SCREEN END   OF LINE.
    SELECTION-SCREEN END   OF BLOCK server.
    my requirement is when data_frm radio button is active p_fname1 should be disabled or disappeared.
    and when data_app radio button is active p_fname2 should be disabled or disappeared.
    kindly suggest how to acheive it.
    regards,
    pavan

    hi,
    try like this
    SELECTION-SCREEN BEGIN OF BLOCK server WITH FRAME TITLE text-010.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: data_app RADIOBUTTON GROUP csbi  DEFAULT 'X' USER-COMMAND ucom.
    SELECTION-SCREEN COMMENT 4(35) text-008 FOR FIELD data_app. "744242
    PARAMETERS : p_fname1 LIKE rlgrap-filename DEFAULT 'D:\usr\sap\ESP\DVEBMGS32\work\.boma1.dat' modif id s1..
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN SKIP 1.
    SELECTION-SCREEN BEGIN OF LINE.
    PARAMETERS: data_frn RADIOBUTTON GROUP csbi.
    SELECTION-SCREEN COMMENT 4(35) text-009 FOR FIELD data_frn. "744242
    PARAMETERS: p_fname2 LIKE rlgrap-filename DEFAULT 'D:\Documents and Settings\czfnct\Desktop\boma.xls' modif id s2. .
    SELECTION-SCREEN END OF LINE.
    SELECTION-SCREEN END OF BLOCK server.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF data_app = 'X'.
          IF screen-name = 'P_FNAME1' .
           p_fname1 = 'D:\usr\sap\ESP\DVEBMGS32\work\.boma1.dat' .
            screen-input = 1.
          ENDIF.
          IF screen-name = 'P_FNAME2'  .
            screen-input = 0.
            CLEAR p_fname2.
          ENDIF.
          MODIFY SCREEN.
        ELSEIF data_frn = 'X'.
          IF screen-name = 'P_FNAME2' .
           p_fname2 = 'D:\Documents and Settings\czfnct\Desktop\boma.xls' .
            screen-input = 1.
          ENDIF.
          IF screen-name = 'P_FNAME1'.
            screen-input = 0.
            CLEAR p_fname1.
          ENDIF.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    reward if useful...

  • How to Add field to Selection screen of Tx. FBL5N

    Hi All,
    In Tx. FBL5N, there is a field Customer number (on Customer selection screen).
    In addition to the above we need to add field Customer name in Selection screen.
    How do we go about it ?
    PS :- We have found steps to add fields to FBL5N output. But, we dont want it on output, we want to add it on Selection screen.
    Regards,
    Ashish

    Hi,
    Only certain table fields are allowed in dynamic selection, please see this sap note for detail :
    Sap Note 310886 - Line items: Dynamic selections ignored
    Permitted tables:
    SKA1: all fields
    SKB1: all fields
    BSIS: all fields
    So BKPF-CPUDT field is not allowed for dynamic selection.
    check this thread Add new Fields to Dynamic Selection FBL5n
    Or
    Enhancing Selection Views in the dynamic selection of some SAP transactions like FB03, FBL3N, FBL5N
    This enhancing related to SAP OSS Note: 188663 and 832997
    Requirement: The business requires the Doc. Header Text be added in the dynamic selection in SAP transactions FB03
    ■Execute Transaction code SE36. Click F4. Enter the SAP table name wherein you think the field could be found. In this case the SAP table is BKPF and the logical database is BRF
    ■From the initial screen of SE36, Choose from the path EXTRAS >> Selection Views
    ■Copy Selection View u201CSAPu201D to u201CCUSu201D
    ■Change the selection views u201CCUSu201D
    ■In the right corner, double click your table BKPF.
    ■In the right corner, check whether what functional groups does your field belong. If it is 01 then input it beside your field name.
    ■Then Save it afterwards.
    Prabhudas

  • How to do field in selection screen

    Hi,
    Could you please let me know, how to add a field in selection view of KAEP_SCOVP. This view is used in KSB1 transaction code for selection.
    Thanks,
    Sriram Ponna.
    Message was edited by:
            Sriram Ponna

    Would you be able to tell me how you did it?
    I'm working on the same issue also.  I need to add a field to the selection screen of KSB1.
    Thanks.

  • Problem:  Disabling fields on selection screen

    There are two date fields on my selection screen that should always remain disabled.  In the INITIALIZATION event I have the following code:
    LOOP AT SCREEN.
        IF screen-name EQ 'S_BEGDA' OR screen-name EQ 'S_ENDDA'.
          screen-input = 0.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    This works fine when the screen starts up.  However, in the AT SELECTION-SCREEN event Iu2019m getting these two dates from the database based on some other fields and want to put the dates in these fields but have them remain disabled.  However, after the AT SELECTION-SCREEN event the fields are editable.
    Here's my AT SELECTION-SCREEN event code (s_begda s_endda are the selection screen param names)
    AT SELECTION-SCREEN.
      DATA: lt_t549q TYPE TABLE OF t549q WITH HEADER LINE.
      SELECT * INTO TABLE lt_t549q
        FROM t549q
        WHERE permo = '02' AND pabrj = '2008' AND pabrp = '01'.
      IF sy-subrc EQ 0.
        READ TABLE lt_t549q INDEX 1.
        s_begda = lt_t549q-begda.
        s_endda = lt_t549q-endda.
      ELSE.
        MESSAGE text-m01 TYPE 'E' DISPLAY LIKE 'I'.
      ENDIF.
      LOOP AT SCREEN.
        IF screen-name EQ 'S_BEGDA' OR screen-name EQ 'S_ENDDA'.
          screen-input = 0.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    I tried using the above loop again at the end of this event but it seems to be being ignored. 
    Anyone have a suggestion?

    Hi,
    Check this code,
    REPORT  ZTEST.
    TABLES: t549q.
    SELECT-OPTIONS: S_BEGDA FOR t549q-BEGDA,
                    S_ENDDA FOR t549q-ENDDA.
    INITIALIZATION.
      DATA: lt_t549q TYPE TABLE OF t549q WITH HEADER LINE.
      SELECT * INTO TABLE lt_t549q
        FROM t549q
        WHERE permo = '02' AND pabrj = '2008' AND pabrp = '01'.
      IF sy-subrc EQ 0.
        READ TABLE lt_t549q INDEX 1.
        s_begda-SIGN = 'I'.
        s_begda-LOW = lt_t549q-begda.
        s_begda-OPTION = 'EQ'.
        APPEND S_BEGDA.
        s_ENDda-SIGN = 'I'.
        s_ENDda-LOW = lt_t549q-endda.
        s_ENDda-OPTION = 'EQ'.
        APPEND S_ENDda.
      ELSE.
        MESSAGE text-m01 TYPE 'E' DISPLAY LIKE 'I'.
      ENDIF.
      LOOP AT SCREEN.
        IF screen-name EQ 'S_BEGDA-LOW' OR screen-name EQ 'S_ENDDA-LOW'
                    OR SCREEN-NAME EQ S_BEGDA-HIGH OR SCREEN-NAME EQ S_ENDDA-HIGH.
          screen-input = 0.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    Thanks & regards,
    nagaraj kalbavi

  • How i can show the selection screen input field in the top of page in alv

    hi ,
              how i can show the selection screen input field in the top of page in alv  grid output.
    tell me the process

    Hi,
    excample from my program:
    FORM topof_page.
      DATA: l_it_header   TYPE TABLE OF slis_listheader WITH HEADER LINE,
            l_info        LIKE l_it_header-info.
      DATA: l_it_textpool TYPE TABLE OF textpool WITH HEADER LINE.
      DATA: l_key LIKE l_it_textpool-key.
      READ TEXTPOOL c_repid INTO l_it_textpool LANGUAGE sy-langu.
      DEFINE m_selinfo.
        if not &1 is initial.
          clear l_it_header.
          l_it_header-typ   = 'S'.
          l_key = '&1'.
          translate l_key to upper case.
          read table l_it_textpool with key key = l_key.
          if sy-subrc = 0.
            shift l_it_textpool-entry left deleting leading space.
            l_it_header-key = l_it_textpool-entry  .
          endif.
          loop at &1.
            case &1-option.
              when 'EQ'
                or 'BT'
                or 'CP'.
                write &1-low to l_it_header-info.
              when others.
                write &1-low to l_it_header-info.
                concatenate &1-option
                            l_it_header-info
                       into l_it_header-info
                       separated by space.
            endcase.
            if not &1-high is initial.
              write &1-high to l_info left-justified.
              concatenate l_it_header-info
                          l_info
                     into l_it_header-info
                     separated by space.
            endif.
            if &1-sign = 'E'.
              concatenate ']'
                          l_it_header-info
                     into l_it_header-info.
            endif.
            append l_it_header.
            clear: l_it_header-key,
                   l_it_header-info.
          endloop.
        endif.
      END-OF-DEFINITION.
      m_selinfo: s_trmdat,
                 s_trmext,
                 s_trmint,
                 s_fkdat,
                 s_delno,
                 s_vbeln,
                 s_deact,
                 s_kdmat.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
           EXPORTING
                it_list_commentary = l_it_header[].
    ENDFORM.
    I hope, this will help you.
    Regards
    Nicole

  • How can i declare a single radio button field in selection-screen ?

    How can i declare a single radio button field in selection-screen ?

    >
    Rob Burbank wrote:
    > And how will you turn it off once it is turned on??
    >
    > Rob
    Thats correct ;)...See ravi if users will ask so many things its our Job to convay the correct solution ....
    Just post your org requirement..SOo some body guide you better//
    Sas

  • How to make a field in selection screen as READ_ONLY !!

    Hi,
       How to make a field in selection screen as READ_ONLY !!.
    Thanks,
    Senthil

    This is the code you need to have in your program.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
      IF SCREEN-NAME = 'MYSELFLD'.
        SCREEN-INPUT = 0.
        MODIFY-SCREEN.
      ENDIF.
    ENDLOOP.

  • How gray out the fields in selection screen with parameters

    Hi,
    Can any one help me how to gray out the selection screen fields
    Start-of-selection----
    Parameters : p_status TYPE edids-status MODIF ID xyz DEFAULT co_51.
    End-of-selection----
    i want to grayed out the field p_status.
    except At selection-screeen output, can any one suggest the other method of gray out the above field.
    Thank u
    B Ravi Kumar

  • How to add Material type(MTART) field on Selection screen of MB5B transaction code.

    Hi All,
        Please let me know how to add material type field on selection screen of MB5B transaction
    For that i made copy ZMB5B_COPY of original report RM07MLBD.
    Thanks in adv .
    Samadhan

    Hi,
    Once you copied the standard report to Z report, you can MTART in selection screen like below.
    and in order to inlcude the same in programming logic, we have three option.
    1) Check all related select queries, and include MTART in SELECT query using inner join with MARA.
    2) In START-OF-SELECTION event fill MATNR as shown below.
    3) If user entered any value in MTART, then before displaying the report just check material type of each material in the final internal table(which is used to display report) delete enteries from internal table accordingly.
    START-OF-SELECTION.
    IF MTART[] IS NOT INITIAL AND MATNR[] IS INITIAL.
        SELECT MATNR FROM MARA INTO MATNR-LOW WHERE MTART IN MTART.
          MATNR-OPTION = 'EQ'.
          MATNR-SIGN = 'I'.
          APPEND MATNR.
          CLEAR MATNR.
        ENDSELECT.
    ENDIF.
    The above option has one limitation: The selection screen variables has some restriction, please read the below thread.
    Facing problem in select statement dump DBIF_RSQL_INVALID_RSQL CX_SY_OPEN_S
    Getting Dump in the select query has more than 2000 entries
    Hope this will work for you .
    regards,
    Rajesh Sadula.

  • How to hide input fields on selection screen using variant attribute

    Hello all,
    I want to know how to hide input fields on selection screen using variant attribute conpletely.
    As you know, when setting the attribute of variant "Hide field" checked, the field is temporarily hidden, but when clicking "All Selections(F7)" button on the selection screen, the fileds become appeared.
    I want to hide the field completely. Di you know how to do ?
    Thank you for your support.
    Regards,
    Hideki Kozai

    Use this attribute hide field and save the variant. Then create transaction for this program setting default variant for parameter Start with variant . The user who runs it will have it by defualt set.
    Otherwise
    in PBO simply use LOOP at screen and output = 0 for this field. This will ensure that field is invisible in any case.
    Regards
    Marcin

  • How to make required field on selection screen in Query

    i'm now working with query(SQ01).
    but don't know how to make required field on selection screen in Query.
    thanks in advance

    i'm now working with query(SQ01).
    but don't know how to make required field on selection screen in Query.
    thanks in advance

  • How can I add a new field in selection screen for this report

    *& Report  ZGS_BARKODLA_HIZLI_GIRIS
    report  zgs_barkodla_hizli_giris.
    tables: mara,
            mseg,
            mch1,
            *mch1,
            mkpf,
            mchb ,
            makt.
    type-pools: esp1.
    data: i_message_tab  type esp1_message_tab_type,
          wa_message_tab type esp1_message_wa_type ,
          sc_count type i.
    ALV
    type-pools: slis, kkblo.
    data: gs_layout   type slis_layout_alv                     ,
          gt_fldcat   type slis_t_fieldcat_alv with header line,
          gt_header   type slis_t_listheader   with header line,
          gt_sortin   type slis_t_sortinfo_alv with header line,
          g_repid     like sy-repid                            .
    define add-fieldcat.
      gt_fldcat-fieldname     = &1.
      gt_fldcat-ref_tabname   = &2.
      gt_fldcat-seltext_s     = &3.
      gt_fldcat-seltext_m     = &3.
      gt_fldcat-seltext_l     = &3.
      gt_fldcat-reptext_ddic  = &3.
      gt_fldcat-ddictxt       = 'M'.
      append gt_fldcat.
      clear  gt_fldcat.
    end-of-definition.
    types: begin of titab,
            sel   type xfeld,
            matnr type matnr,
            maktx type maktx,
            charg type charg_d,
            menge type menge_d,
            erfmg type erfmg,
           end of titab.
    data : witab type titab.
    data : itab type table of titab.
    data : ok_code type sy-ucomm.
    controls: tc_itab type tableview using screen 0100.
    data: gv_header like bapi2017_gm_head_01,
          gv_code   like bapi2017_gm_code.
    BAPI export parameters
    data: gv_headret type bapi2017_gm_head_ret,
          gv_matdoc  type bapi2017_gm_head_ret-mat_doc,
          gv_matyear type bapi2017_gm_head_ret-doc_year.
    data : lv_objek like inob-objek .
    data : ls_inob  like inob .
    data : imseg type ty_t_mseg.
    data : wmseg type mseg.
    data : answer.
    data : count type i.
    data : v_atinn type atinn.
    BAPI movement details
    data: i_goodsmvt_items type bapi2017_gm_item_create occurs 0
          with header line.
    data: i_return type bapiret2 occurs 0 with header line.
    start-of-selection.
    call function 'CONVERSION_EXIT_ATINN_INPUT'
       exporting
         input  = 'Z_ORAN'
       importing
         output = v_atinn.
      call screen 100.
    *&      Module  status_0100  OUTPUT
    module status_0100 output.
      set pf-status '100'.
      set titlebar '100'.
      mseg-werks = 1000.
      mseg-umwrk = 1000.
    **added
      sc_count = sc_count + 1.
      if sc_count eq 1.
        mseg-bwart = 313.
      endif.
      mkpf-budat = sy-datum.
    **added
      describe table itab lines tc_itab-lines.
    endmodule.                 " status_0100  OUTPUT
    *&      Module  user_command_0100  INPUT
    module user_command_0100 input.
      data field(20).
      data: line_t like sy-index.
      data: lines  like sy-index.
      data line_count like sy-loopc.
      data: begin of cols,
             screen      like screen,
             index       type i,
             selected(1) type c,
             vislength   like icon-oleng,
             invisible(1) type c,
           end   of cols.
      case ok_code.
        when 'DELE'.
          delete itab where sel eq 'X'.
        when 'ENTE'.
          check *mch1-charg is not initial.
          read table itab into witab with key charg = *mch1-charg.
          if not sy-subrc is initial.
            witab-charg = *mch1-charg.
            select single matnr from mch1 into witab-matnr
                               where charg eq witab-charg.
            if not syst-subrc is initial.
              set cursor field '*MCH1-CHARG'.
              message e115(12) with *mch1-charg.
            endif.
            select single maktx from makt into witab-maktx
                               where matnr eq witab-matnr
                                 and spras eq syst-langu.
            witab-erfmg = 1.
            concatenate witab-matnr witab-charg into lv_objek .
            clear ls_inob .
            select single * into ls_inob
                            from inob
                            where objek = lv_objek and
                                  klart = '023'    and
                                  obtab = 'MCH1' .
            select single atflv from ausp into witab-menge
                     where objek = ls_inob-cuobj and
                           klart = '023' .
            append witab to itab.
    **added
            clear *mch1-charg.
    **added
          endif.
        when 'SAVE'.
          if mkpf-budat is initial.
            set cursor field 'MKPF-BUDAT'.
            message e055(00).
          endif.
          if mseg-lgort is initial.
            set cursor field 'MSEG-LGORT'.
            message e055(00).
          endif.
          if mseg-umlgo is initial.
            set cursor field 'MSEG-UMLGO'.
            message e055(00).
          endif.
          if mseg-bwart is initial.
            set cursor field 'MSEG-BWART'.
            message e055(00).
          endif.
          refresh imseg.
          loop at itab into witab.
            move-corresponding witab to wmseg.
            append wmseg to imseg.
          endloop.
          call function 'ZMM_POPUP_WITH_DATA'
            exporting
              imseg  = imseg
            importing
              answer = answer.
          if answer eq 'Y'.
            perform create_goods_movement.
          endif.
        when 'P--'.
          clear ok_code.
          perform paging using 'P--'.
          set cursor field 'MARA-MATNR' line 1.
        when 'P-'.
          clear ok_code.
          perform paging using 'P-'.
          set cursor field 'MARA-MATNR' line 1.
        when 'P+'.
          clear ok_code.
          clear lines.
          perform paging using 'P+'.
          set cursor field 'MARA-MATNR' line 1.
        when 'P++'.
          clear ok_code.
          perform paging using 'P++'.
          set cursor field 'MARA-MATNR' line 1.
        when 'SORA'.
          read table tc_itab-cols into cols with key selected = 'X'.
          if sy-subrc is initial.
            field = cols-screen.
            field = field+5(10).
            sort itab ascending by (field).
          endif.
        when 'SORZ'.
          read table tc_itab-cols into cols with key selected = 'X'.
          if sy-subrc is initial.
            field = cols-screen.
            field = field+5(10).
            sort itab descending by (field).
          endif.
        when 'PRNT'.
          perform write_alv.
      endcase.
    endmodule.                 " user_command_0100  INPUT
    *&      Module  read_table  OUTPUT
    module read_table output.
      mara-matnr = witab-matnr.
      makt-maktx = witab-maktx.
      mch1-charg = witab-charg.
      mseg-menge = witab-menge.
      mseg-erfmg = witab-erfmg.
      line_count = sy-loopc.
    endmodule.                 " read_table  OUTPUT
    *&      Module  write_table  INPUT
    module write_table input.
      witab-matnr = mara-matnr.
      witab-maktx = makt-maktx.
      witab-charg = mch1-charg.
      witab-menge = mseg-menge.
      witab-erfmg = mseg-erfmg.
      modify itab from witab index tc_itab-current_line.
    endmodule.                 " write_table  INPUT
    *&      Module  exit  INPUT
    module exit input.
      leave to screen 0 .
    endmodule.                 " exit  INPUT
    *&      Form  create_goods_movement
    form create_goods_movement .
      clear : gv_header, i_return[], i_goodsmvt_items[].
      gv_header-doc_date = gv_header-pstng_date = mkpf-budat.
      gv_header-pr_uname = sy-uname.
    GM with reference to reservation
      loop at itab into witab.
        i_goodsmvt_items-material   = witab-matnr.
        i_goodsmvt_items-entry_qnt  = witab-erfmg.
        i_goodsmvt_items-entry_uom  = 'ST'.
        i_goodsmvt_items-move_type  = mseg-bwart.
        i_goodsmvt_items-plant      = mseg-werks.
        i_goodsmvt_items-stge_loc   = mseg-lgort.
        i_goodsmvt_items-move_plant = mseg-umwrk.
        i_goodsmvt_items-move_stloc = mseg-umlgo.
        i_goodsmvt_items-batch      = witab-charg.
        append i_goodsmvt_items.
      endloop.
    find BAPI processing transaction
      if gv_code is initial.
        perform determine_bapi_code using mseg-bwart
                                 changing gv_code.
      endif.
      call function 'BAPI_GOODSMVT_CREATE'
        exporting
          goodsmvt_header  = gv_header
          goodsmvt_code    = gv_code
        importing
          goodsmvt_headret = gv_headret
          materialdocument = gv_matdoc
          matdocumentyear  = gv_matyear
        tables
          goodsmvt_item    = i_goodsmvt_items
          return           = i_return[].
    cancel blocking process
      loop at i_return where type eq 'E' or type eq 'A' or type eq 'X'.
        exit.
      endloop.
      if sy-subrc ne 0.
        refresh i_message_tab.
        call function 'BAPI_TRANSACTION_COMMIT'
          exporting
            wait = 'X'.
        wa_message_tab-msgid = 'M7'..
        wa_message_tab-msgty = 'S'.
        wa_message_tab-msgno = '060'.
        wa_message_tab-msgv1 = gv_matdoc.
        wa_message_tab-msgv2 = ''.
        wa_message_tab-msgv3 = ''.
        wa_message_tab-msgv4 = ''.
        append wa_message_tab to i_message_tab.
      else.
        refresh i_message_tab.
        call function 'BAPI_TRANSACTION_ROLLBACK'.
    write a message as there is an unexpected error.
        loop at i_return.
          wa_message_tab-msgid = i_return-id.
          wa_message_tab-msgty = i_return-type.
          wa_message_tab-msgno = i_return-number.
          wa_message_tab-msgv1 = i_return-message_v1.
          wa_message_tab-msgv2 = i_return-message_v2.
          wa_message_tab-msgv3 = i_return-message_v3.
          wa_message_tab-msgv4 = i_return-message_v4.
          append wa_message_tab to i_message_tab.
        endloop.
      endif.
      call function 'C14Z_MESSAGES_SHOW_AS_POPUP'
        tables
          i_message_tab = i_message_tab.
    endform.                    " create_goods_movement
    *&      Form  determine_bapi_code
    form determine_bapi_code using p_bwart type bwart
    changing p_code type bapi2017_gm_code.
      data: lt_t158b type table of t158b with header line.
      clear p_code.
      select tcode from t158b into corresponding fields of table lt_t158b
      where bwart eq p_bwart.
      loop at lt_t158b.
        select single gmcode from t158g into p_code
        where tcode eq lt_t158b-tcode.
        if sy-subrc is initial.
          exit.
        endif.
      endloop.
    endform. " determine_bapi_code
    *&      Form  paging
    form paging using code.
      data: i type i,
            j type i.
      case code.
        when 'P--'. tc_itab-top_line = 1.
        when 'P-'.
          tc_itab-top_line = tc_itab-top_line - line_count.
          if tc_itab-top_line le 0.
            tc_itab-top_line = 1.
          endif.
        when 'P+'.
          i = tc_itab-top_line +  line_count.
          j = tc_itab-lines -  line_count + 1.
          if j le 0.
            j = 1.
          endif.
          if i le j.
            tc_itab-top_line = i.
          else.
            tc_itab-top_line = j.
          endif.
        when 'P++'.
          tc_itab-top_line = tc_itab-lines - line_count + 1.
          if tc_itab-top_line le 0.
            tc_itab-top_line = 1.
          endif.
      endcase.
    endform.                    " paging
    *&      Form  write_alv
    form write_alv .
      perform find_list_header.
      perform fill_field_cat.
      perform fill_sortinfo.
      g_repid = sy-repid.
      gs_layout-colwidth_optimize = 'X'.
      gs_layout-zebra             = 'X'.
      answer = 'Y'.
      call function 'REUSE_ALV_GRID_DISPLAY'
        exporting
          i_buffer_active        = ''
          i_callback_program     = g_repid
          i_save                 = 'A'
        i_callback_top_of_page = 'TOP_OF_PAGE'
          is_layout              = gs_layout
          it_fieldcat            = gt_fldcat[]
         it_sort                = gt_sortin[]
        tables
          t_outtab               = itab[].
    endform.                    " write_alv
         Form  find_list_header
    form find_list_header.
      data : v_datum(10),
             v_datlo(10),
             v_dathi(10),
             v_uzeit(8).
      clear: gt_header, gt_header[].
      gt_header-typ  = 'H'.
      gt_header-info = sy-title.
      append gt_header.
      clear gt_header.
      gt_header-typ  = 'S'.
      gt_header-key  = 'Çalıştırma Zamanı : '.
      write syst-datum to v_datum.
      write syst-uzeit to v_uzeit.
      concatenate v_datum '/' v_uzeit into gt_header-info.
      append gt_header.
    endform.                    " find_list_header
         Form  fill_field_cat
    form fill_field_cat.
      refresh gt_fldcat.
      clear   gt_fldcat.
      gt_fldcat-key = 'X'.
      add-fieldcat 'MATNR'  'MARA' ''.
      add-fieldcat 'MAKTX'  'MAKT' ''.
      add-fieldcat 'CHARG'  'MSEG' ''.
      gt_fldcat-do_sum = 'X'.
      add-fieldcat 'MEINS'  'MARA' 'Olcu Birimi '.
      gt_fldcat-do_sum = 'X'.
      add-fieldcat 'ERFMG'  'MSEG' 'Adet'.
    endform.                    " fill_field_cat
         Form  fill_sortinfo
    form fill_sortinfo.
      gt_sortin-up            = 'X'.
      gt_sortin-fieldname     = 'MATNR'.  append gt_sortin.
    endform.                    " fill_sortinfo
         Form  top_of_page                                              *
    form top_of_page.
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        exporting
          i_logo             = 'ZKUTAS'
          it_list_commentary = gt_header[].
    endform.                    " top_of_page

    HI,
    if it is a normal report program then you can directly create a Selection screen field.
    After the Type-pool you can use Parameters or Select-options to create the selection screen field..
    If it is a Modulpool program then you can create a selection scren field like
    SELECTION-SCREEN BEGIN OF SCREEN 1100 AS SUBSCREEN.
    PARAMETERS: p1(10) TYPE c.
    SELECTION-SCREEN END OF SCREEN 1100.
    defines a selection screens – 1100 – as subscreens.
    The next screen number of screen 100 is 100 (statically-defined).
    PROCESS BEFORE OUTPUT.
      MODULE status_0100.
      CALL SUBSCREEN area INCLUDING sy-repid number.
    PROCESS AFTER INPUT.
      MODULE cancel AT EXIT-COMMAND.
      CALL SUBSCREEN area.
      MODULE user_command_0100.
    look at the below link
    http://help.sap.com/saphelp_nw2004s/helpdata/en/e7/deb237b9a9a968e10000009b38f8cf/content.htm
    Regards
    Sudheer

Maybe you are looking for