Disable the Select-options field in the viewcontainer

Hi,
I  have two select option fields(Date,Number) in a viewcontainer .
Now i need to disable one of the select-option field(Date) in the view container based on the condition.If I give Enability for the view container then both the select options will get diasbled.Is there any way to disable only Date select-option field in the view container.
Thanks in Advance.
Regards,
bala.

Hi,
I just tested this solution and it is working for me....Following on Thomas's suggestion...I did the following....
I just had one select-option on my scr...but it can be done with two too...
step1: 
created three attributes at component level under the attribute tab ( as suggested by Thomas )
ENABLE_PRI_SELECTOPTION type  WDY_BOOLEAN 
M_HANDLER type ref to     IF_WD_SELECT_OPTIONS
M_WD_SELECT_OPTIONS  type ref to     IWCI_WDR_SELECT_OPTIONS
Note: all are with public check box checked....so that all your views can see these attributes
I created a method at componenet controller leverl:  create_select_option....in this method i have following code:
DATA:
  lt_range_table TYPE REF TO data,
*  rt_range_table TYPE REF TO data,
  read_only TYPE abap_bool,
  typename TYPE string.
  DATA:
  lr_componentcontroller TYPE REF TO ig_componentcontroller,
  l_ref_cmp_usage TYPE REF TO if_wd_component_usage.
* create the used component
  l_ref_cmp_usage = wd_this->wd_cpuse_select_options( ).
  IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
    l_ref_cmp_usage->create_component( ).
  ENDIF.
* get a pointer to the interface controller of the select options
*component
  wd_this->m_wd_select_options = wd_this->wd_cpifc_select_options( ).
* init the select screen
  wd_this->m_handler = wd_this->m_wd_select_options->init_selection_screen( ).
* create a range table that consists of this new data element
  lt_range_table = wd_this->m_handler->create_range_table(
  i_typename = 'PERSNO' ).
* add a new field to the selection
  wd_this->m_handler->add_selection_field(
  i_id = 'PERSNO'
I_VALUE_HELP_TYPE = if_wd_value_help_handler=>CO_PREFIX_SEARCHHELP
I_VALUE_HELP_ID = 'ZHELP_WDA_PERNR'
I_NO_INTERVALS = abap_true
  it_result = lt_range_table
  i_read_only = wd_this->ENABLE_PRI_SELECTOPTION ).   <-----pls see here how i am controlling the read only property
I assume you know this much...already....but i am just putting everything down....
step2:
in my view where i want to display the select-options....i added this code under my wddoinit method
DATA lo_componentcontroller TYPE REF TO ig_componentcontroller .
lo_componentcontroller =   wd_this->get_componentcontroller_ctr( ).
lo_componentcontroller->ENABLE_PRI_SELECTOPTION = abap_false.    <--pls see initially we want this field to be open
  lo_componentcontroller->create_select_option(
step3: 
i did not have much logic to control the select option field so i added a button which if user presses the field become disable...
under that button action method i added the following code:
DATA lo_componentcontroller TYPE REF TO ig_componentcontroller .
lo_componentcontroller =   wd_this->get_componentcontroller_ctr( ).
lo_componentcontroller->ENABLE_PRI_SELECTOPTION = abap_true.
   "<---pls see here how i am changing the global *attribute which Thomas has suggested for controlling the "read only" attibute for the select-option field....you can put this under *your "if" statement....
"this step is very important if you do not remove the field you will get the dump...since it will try to add the same field again
"which produces dump from system....
lo_componentcontroller->m_handler->REMOVE_SELECTION_SCREEN_ITEM(
i_id = 'PERSNO' ).
"now call the same method which we created at component level to create the select_options...
lo_componentcontroller->create_select_option(
that is all....it works great for me.....let us know if still have any questions....
Thanks...
AS...

Similar Messages

  • Collective search on the Select-options field on the selection screen

    Hello experts,
                       I have a Y program and a selection screen for it. I have to get the BKPF-BELNR in the search help list. Since the table is too bulky to get all the documents form it. I thought I might need a condition of company code for fetching the documents. I have company code on the selection screen, but if I press F4, on the BELNR, my select-options internal table for <b>company code</b> is remains initial. I think for F4 events the values doesn't get populated in the internal tables, not sure.
                       Can you tell me, how to get the company code entered on the selection screen, on the F4 event. Or If this doesn't work, will collective search help solve my problem? If yes, Please let me know, which function module I can use to add a collective search to my select-options on the selection screen.
    Thanks,
    Ganesh Khumse.
    Points will be rewarded!

    Hi
    do like this
    TYPES : BEGIN OF ST_OBJID_SH,
             OTYPE TYPE HRP1000-OTYPE,
             OBJID TYPE HRP1000-OBJID,
            END OF ST_OBJID_SH.
    DATA : IT_OBJID_SH TYPE STANDARD TABLE OF ST_OBJID_SH.
    DATA : WA_OBJID_SH TYPE ST_OBJID_SH.
    ***********SELECTION SCREEN DESIGN***********************
    SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
    *SELECT-OPTIONS : S_OTYPE FOR HRP1001-OTYPE NO INTERVALS .
    SELECT-OPTIONS : S_OBJID FOR HRP1001-OBJID NO INTERVALS .
    SELECT-OPTIONS : DATE FOR SY-DATUM NO-EXTENSION OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK B1.
    **********END OF SELECTION SCREEN DESIGN*****************
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_OBJID-LOW.
    IF S_OBJID IS NOT INITIAL.
        SELECT OTYPE OBJID FROM HRP1000
                     INTO TABLE IT_OBJID_SH
                     WHERE OTYPE = 'D'.
    IF SY-SUBRC EQ 0.
    SEARCH HELP FOR QUALIFICATION.
        CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
          EXPORTING
                 DDIC_STRUCTURE         = ' '
            RETFIELD               =  'OBJID'
                 PVALKEY                = ' '
           DYNPPROG               = SY-REPID
           DYNPNR                 = SY-DYNNR
           DYNPROFIELD            = 'S_OBJID'
                 STEPL                  = 0
                 WINDOW_TITLE           =
                 VALUE                  = ' '
           VALUE_ORG              = 'S'
                 MULTIPLE_CHOICE        = ' '
                 DISPLAY                = ' '
                 CALLBACK_PROGRAM       = ' '
                 CALLBACK_FORM          = ' '
                 MARK_TAB               =
               IMPORTING
                 USER_RESET             =
          TABLES
            VALUE_TAB              =  IT_OBJID_SH
                 FIELD_TAB              =
                 RETURN_TAB             = RETURN_TAB
                 DYNPFLD_MAPPING        =
               EXCEPTIONS
                 PARAMETER_ERROR        = 1
                 NO_VALUES_FOUND        = 2
                 OTHERS                 = 3
        IF SY-SUBRC <> 0.
              MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                      WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.

  • How to write in selection screen after the select option field?

    Hi
    Please help me with this...
    i need to write format of date after the select option field in the selection screen.
    its like..
    date ___________  to ___________     <b>yyyymmdd</b>
    points will be awarded..
    thanx

    Use  selection-screen comment 1(31) text-005 -> this will give you format option.
    See the below sysntax ,you have to use like this
    Selection-screen begin of block b2 with frame title text-002.
    selection-screen begin of line.
    selection-screen comment 1(31) text-004.
    parameter:        r_1   radiobutton group rad1.
    selection-screen end of line.
    selection-screen begin of line.
    Aging  Report
    selection-screen comment 1(31) text-005.
    parameter:        r_2   radiobutton group rad1.
    selection-screen comment 40(30) text-003.
    parameter: p_expir as checkbox.
    selection-screen end of line.
    selection-screen begin of line.
    Materials with no Expiry Date
    selection-screen comment 1(31) text-006.
    parameter:        r_3   radiobutton group rad1.
    selection-screen comment 40(30) text-007.
    parameter : p_bin as checkbox ."default 'X'.
    selection-screen end of line.
    selection-screen end of block b2.
    selection-screen end of block b0.

  • How to hide the select-options fields on radiobutton select in webdynpro

    hi
    Could you please help how to hide the select-option fields in webdynpro
    there are four radio buttons
    for every radiobutton there is corresponding the select_option filed is associated to it
    user as only provision select  one radio button and reset of the select-option fileds should be hidden
    which ever the radio button is selected corresponding the select-options fileld should be displayed
    please find the attachement below

    Hi Nine,
    To hide select options you should use interface method REMOVE_SELECTION_SCREEN_ITEM of IF_WD_SELECT_OPTIONS.
    Sample code :
    Write the below code in the Event handler of Radio Button.
    DATA lv_r_helper_class TYPE REF TO if_wd_select_options.
    lv_r_helper_class = lo_interfacecontroller->init_selection_screen(
    lv_r_helper_Class->REMOVE_SELECTION_SCREEN_ITEM(exporting i_id = 'Select_option1_id1').
    This will hide first select option of your screen.Similarly pass select_option_id2 to hide it and so on.
    Regards,
    Ravikiran.k

  • How can i used pai in screen 1000 to change the select-options field?

    hi,all.
    I want used pai to change the select-options field,but it can't works.
    the mainly code is:
    REPORT  ZTEST99.
    TABLES :MARA,MAKT,MARC.
    SELECTION-SCREEN BEGIN OF BLOCK B0 WITH FRAME TITLE TITLE0 .
    select-options:s_matnr for mara-matnr,
                   s_werks for marc-werks MODIF ID ID1.
    SELECTION-SCREEN END OF BLOCK B0.
    parameters:p_flag as checkbox.
    at selection-screen OUTPUT.
       LOOP AT SCREEN.
       IF P_FLAG = 'X' .
       IF screen-group1 = 'ID1'.
             screen-input = '0'.
        ELSE.
          screen-input = '1'.
        ENDIF.
        MODIFY SCREEN.
    ENDIF.
        ENDLOOP.
    START-OF-SELECTION.
    CALL SCREEN 1000.
    when i click p_flag,then i want to change s_werks from OBLIGATORY to no OBLIGATORY.
    how can i realized?
    Thanks for all.
    Sun

    Hi ,
    change your code like this.
    Change in your code:
    SELECTION-SCREEN BEGIN OF SCREEN 100.
    SELECT-OPTIONS : s_matnr for mara-matnr,
    s_werks for marc-werks MODIF ID ID1.
    SELECTION-SCREEN END OF SCREEN 100 .
    At selection-screen.
    if sy-dynnr = '100'.
    IF P_FLAG = 'X' .
    LOOP AT SCREEN.
    IF screen-group1 = 'ID1'.
    screen-required = '0'.
    ENDIF.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    else.
    LOOP AT SCREEN.
    IF screen-group1 = 'ID1'.
    screen-required = 1.
    ENDIF.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    my code :
    REPORT  Z50871_SELECTOPS_DYNAMIC.
    PARAMETERS : CH_EBELN AS CHECKBOX,
                 CH_VBELN AS CHECKBOX.
    DATA: V_EBELN TYPE EKKO-EBELN,
          V_VBELN TYPE VBAK-VBELN.
    SELECTION-SCREEN BEGIN OF SCREEN 100.
    SELECT-OPTIONS : EBELN FOR V_EBELN MODIF ID G1,
                     VBELN FOR V_VBELN MODIF ID G2.
    SELECTION-SCREEN END OF SCREEN 100 .
    AT SELECTION-SCREEN OUTPUT.
      IF SY-DYNNR = 100.
        IF CH_EBELN = 'X' AND
           CH_VBELN = ''.
          LOOP AT SCREEN.
            IF SCREEN-GROUP1 EQ 'G1'.
              SCREEN-ACTIVE = '1'.
            ELSE.
              SCREEN-ACTIVE = '0'.
            ENDIF.
            MODIFY SCREEN.
          ENDLOOP.
        ELSEIF CH_VBELN = 'X' AND
           CH_EBELN = '' .
          LOOP AT SCREEN.
            IF SCREEN-GROUP1 EQ 'G2'.
              SCREEN-ACTIVE = '1'.
            ELSE.
              SCREEN-ACTIVE = '0'.
            ENDIF.
            MODIFY SCREEN.
          ENDLOOP.
        ELSEIF CH_EBELN = 'X' AND CH_VBELN = 'X'.
          LOOP AT SCREEN.
            IF SCREEN-GROUP1 EQ 'G1'
               OR SCREEN-GROUP1 EQ 'G2' .
              SCREEN-ACTIVE = '1'.
            ENDIF.
            MODIFY SCREEN.
          ENDLOOP.
        ENDIF.
      ENDIF.
    AT SELECTION-SCREEN.
    IF SY-DYNNR = 1000.
      IF CH_EBELN = 'X' OR CH_VBELN = 'X'.
        CALL SELECTION-SCREEN 100.
      ELSE.
        MESSAGE I000(Z50871MSG) WITH 'Please select atleast one checkbox'.
      ENDIF.
    ENDIF.
    regards
    Sandeep Reddy

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

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

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

  • How to change the select-options fields length to long

    Dear friends:
       I had develop a program for sent email,and it have a field for fill mail address as below:
       data: lmail like adr6-smtp_addr.
       select-options: mailadd for lmail no intervals.
       my customer complain that the field is too short,but I can not change it to longer,the select-options component limit the visible length , how can i do for this problem!

    Dear All:
      I had realized this function.
      I defined a parameter and a pushbutton to replace the select-option componet,
    the code share as below.
    data: lmail like adr6-smtp_addr.
    SELECTION-SCREEN BEGIN OF LINE.
    parameters: mailCopy like lmail.
    selection-screen:pushbutton 64(5) pubu user-command mailButt.
    SELECTION-SCREEN END OF LINE.
    select-options: mailadd for lmail NO INTERVALS no-display.
    at selection-screen output.
      CLEAR l_count.
      DESCRIBE TABLE mailadd LINES l_count.
      IF l_count > 1.
        write ICON_DISPLAY_MORE as icon to pubu.
      ELSE.
        write ICON_ENTER_MORE  as icon to pubu.
      ENDIF.
    at selection-screen.
      CLEAR l_count.
      DESCRIBE TABLE mailadd LINES l_count.
      IF NOT mailCopy IS INITIAL AND mailadd[] IS INITIAL.
        MailAdd-low = mailCopy.
        Append mailadd.
      ENDIF.
      IF l_count = 1 and mailCopy IS INITIAL.
        refresh mailadd.
        clear mailadd.
      endif.
      if sy-ucomm = 'MAILBUTT'.
        perform show_box.
      endif.
    *       FORM show_box                                                 *
    FORM show_box.
      TYPE-POOLS aqadh .
      DATA: tab_and_field TYPE  rstabfield.
      tab_and_field-tablename = 'ADR6'.
      tab_and_field-fieldname = 'SMTP_ADDR'.
      CALL FUNCTION 'COMPLEX_SELECTIONS_DIALOG'
           EXPORTING
                TEXT           = 'SET E-Mail To '
                tab_and_field  = tab_and_field
           TABLES
                range          = MAILADD
           EXCEPTIONS
                no_range_tab   = 1
                cancelled      = 2
                internal_error = 3
                OTHERS         = 4.
      IF NOT MAILADD[] IS INITIAL.
        READ TABLE MAILADD INDEX 1.
        MAILCopy = MAILADD-LOW.
      ELSE.
        CLEAR MAILCopy.
      ENDIF.
    ENDFORM.

  • Reading from select-options field into the internal table

    Hi,
      I have to read the low and high ranges from the select-options fields into a field in the internal table in order to update the same field in line item table. since the user may change the screen fields, i need to pass the values directly from the screen and store it in a variable in the internal table. Is there a way to pass both ranges, low and high to one variable which holds the entire range?
    Thanks,
    Sruthy

    Hi,
    In the Selection screen you can directly read the field(Select-option)value using read statement as follows:
    READ TABLE <SELECT-OPTIONS field name> [using index] INTO <work area>.
    After reading you can directly access all the values as follows and can store them in the variables:
    var1 = <work area>-LOW
    var2 = <work area>-HIGH
    var3 = <work area>-SIGN
    var4 = <work area>-OPTION
    as per your requirement.
    I think this will help you.
    <b>Kindly reward if helpful.</b>
    Regards,
    Shakuntala.

  • Restricting the Select-options by using the FM   "SELECT_OPTIONS_RESTRICT"

    Hi ,
    Thank You very much for reading this query.
    My requirement is, I need to display 3 select-option fields on my selection screen.
    1) Field1 is S_periods which is to populate the Numbers.For this field I need to provide the options single and ranges (First 2 options).
    2) Field 2 is S_RECIPIENTS which should contain user IDs.For this field I need to give first option which is single values.
    3) Field 3 is S_TRANSACTIONS which should contain 3 options (Select singles, ranges and Exclude singles).
    So by calling the FM "SELECT_OPTIONS_RESTRICT' only once, Can i provide all these options or I need to call this FM 3 times for 3 fields .
    Can any one help me on this.
    If possible plz provide me some pseudo code on this.I have gone through so many forum points on this but I havenot seen this kind of requirement.
    Thanks and Regards,
    K.krishna Chaitanya.

    Check this code for first and second case.
    I don't think third case is possible.
    * T A B L E S
    TABLES: afko, mara.
    * D A T A   D E C L A R A T I O N S
    TYPE-POOLS: sscr.
    DATA:  gt_restrict TYPE sscr_restrict,
           gs_selopt   TYPE sscr_***,
           gs_opt_list TYPE sscr_opt_list.
    SELECT-OPTIONS: s_aufnr FOR afko-aufnr,
                    s_matnr FOR mara-matnr.
    * INITIALIZATION
    INITIALIZATION.
    * MATERIAL
      CLEAR gs_opt_list.
      gs_opt_list-name          = 'OBJ_MATNR'.
      gs_opt_list-options-eq    = 'X'.
      gs_opt_list-options-bt    = 'X'.
      APPEND gs_opt_list TO gt_restrict-opt_list_tab.
      CLEAR gs_selopt.
      gs_selopt-kind            = 'S'.
      gs_selopt-name            = 'S_MATNR'.
      gs_selopt-sg_main         = 'I'.
      gs_selopt-op_main         = 'OBJ_MATNR'.
      APPEND gs_selopt  TO gt_restrict-***_tab.
    * ORDER
      CLEAR gs_opt_list.
      gs_opt_list-name          = 'OBJ_AUFNR'.
      gs_opt_list-options-eq    = 'X'.
      APPEND gs_opt_list TO gt_restrict-opt_list_tab.
      CLEAR gs_selopt.
      gs_selopt-kind            = 'S'.
      gs_selopt-name            = 'S_AUFNR'.
      gs_selopt-sg_main         = 'I'.
      gs_selopt-op_main         = 'OBJ_AUFNR'.
      APPEND gs_selopt  TO gt_restrict-***_tab.
      CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
        EXPORTING
          restriction            = gt_restrict
        EXCEPTIONS
          too_late               = 1
          repeated               = 2
          selopt_without_options = 5
          selopt_without_signs   = 6
          invalid_sign           = 7
          empty_option_list      = 9
          invalid_kind           = 10
          repeated_kind_a        = 11
          OTHERS                 = 12.

  • Overlapping of an Select-Option Field and the Extension Button.

    Hi,
    I have declared a Select-Option as follows:
    Tables:  agr_define  .
    select-options: s_role for agr_define-agr_name obligatory
                                                 no intervals .
    It is not throwing any error.
    If I execute this program, On the selection screen, I find one field where I can enter the Role and an extension button to enter multiple roles.
    But the F4 help overlaps on the Extension Button and the customer wants this overlapping to be removed, I mean this F4 help button and the Extension button should not overlap with each other.
    Can you help me acheive this.
    Thanks and Regards,
    Ishaq.

    Boss,
    You cannot avoid that overlapping.
    yes, one can change the system screen 1000.
    but, in future it will definitely create problems like if you add any extra field and if are using that code in some other server it will never get reflected.So, will you go to Screen 1000 of that server and change the screen attributes again??
    okay even i would like to find the answer for that.
    If you find the solution, do send me the real answer in this same thread.

  • How to use the select option to get the multiple bom explosion

    hi friends,
              i have completed the bom exp using parameters to get one material
    input,but i need to adopt select option to give from and to materials
    i ll gives from and to materials with description and bom deails
    i here gave the coding also, pl give me a suggestion how to adpot the select
    optoins instead of parameters ,very urgent
    REPORT PP_BOM_EXPLOSION.
    tables :mara,marc,stpo.
    TYPE-POOLS : SLIS.
    *parameters: p_werks like t001w-werks obligatory.
    SELECT-OPTIONS : p_matnr FOR mara-matnr obligatory.
    **select-options : p_matnr for mara-matnr obligatory.
    PARAMETERS : P_WERKS LIKE T001W-WERKS OBLIGATORY,
            P_MATNR LIKE MARA-MATNR OBLIGATORY.
    *parameters: p_werks like marc-werks obligatory,
    *p_matnr like marc-matnr obligatory.
    constants c_x value 'X'.
    data: begin of it_comp occurs 0,
    matnr like mara-matnr,
    maktl like makt-maktx,
    idnrk like stpox-idnrk,
    ojtxp like stpox-ojtxp,
    menge like stpox-menge,
    meins like stpox-meins,
    matkl like stpox-matmk,
    end of it_comp.
    data : topmat like cstmat.
    data: w_topmat like cstmat.
    DATA : IT_MARA LIKE MARA OCCURS 0 WITH HEADER LINE.
    DATA : IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA : WA_FIELDCAT_LN LIKE LINE OF IT_FIELDCAT.
    DATA : IT_EVENTCAT  TYPE SLIS_T_EVENT.
    DATA : WA_EVENTCAT_LN  LIKE LINE OF IT_EVENTCAT.
    DATA : IT_LAYOUT TYPE SLIS_LAYOUT_ALV.
    DATA: S_COL_POS TYPE I.
    start-of-selection.
    perform explode_assembly.
    PERFORM BUILD_FIELDCATALOG.
    PERFORM DATA_DISPLAY.
    *end-of-selection.
    *perform write_report.
    *top-of-page.
    *perform print_header.
    *form print_header.
    *write: /(18) 'Component'(h00),
    *(40) 'Description'(h01),
    *'Mat.Group'(h02),
    *(18) 'Quantity'(h03).
    *uline.
    *endform.
    *form write_report.
    *write: / w_topmat-matnr under text-h00 color col_heading,
    *w_topmat-maktx under text-h01 color col_heading.
    *loop at it_comp.
    *write: /
    *it_comp-idnrk under text-h00,
    *it_comp-ojtxp under text-h01,
    *it_comp-matkl under text-h02,
    *it_comp-menge unit it_comp-meins under text-h03,
    *it_comp-meins.
    *endloop.
    *uline.
    *endform.
    form explode_assembly.
    data: it_stb like stpox occurs 0 with header line,
    it_stb2 like stpox occurs 0 with header line,
    it_stb3 like stpox occurs 0 with header line,
    w_msg(255) type c.
    SELECT MATNR FROM MARA INTO CORRESPONDING FIELDS OF TABLE IT_MARA
                               WHERE MATNR IN P_MATNR.
    Explode highest level:
    *LOOP AT IT_MARA.
    call function 'CS_BOM_EXPL_MAT_V2'
    exporting
    auskz = c_x
    capid = 'PP01'
    cuols = c_x
    datuv = sy-datum
    knfba = c_x
    ksbvo = c_x
    mbwls = c_x
    mdmps = c_x
    BGIXO = c_x
    MKMAT = c_x
    MMAPS = c_x
    FBSTP = c_x
    FTREL = c_x
    mtnrv = P_MATNR
    werks = p_werks
    importing
    topmat = w_topmat
    tables
    stb = it_stb
    exceptions
    alt_not_found = 1
    call_invalid = 2
    material_not_found = 3
    missing_authorization = 4
    no_bom_found = 5
    no_plant_data = 6
    no_suitable_bom_found = 7
    conversion_error = 8
    others = 9.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
    into w_msg.
    *write: / w_msg.
    exit.
    endif.
    Don't process documents
    delete it_stb where idnrk is initial.
    Don't process valid from furure:
    delete it_stb where datuv >= sy-datum.
    Explode phantom assemblies up to last level
    *do.
    it_stb2[] = it_stb[].
    *delete it_stb2 where dumps is initial.
    *if it_stb2[] is initial.
    *exit.
    *endif.
    *delete it_stb where not dumps is initial.
    delete it_stb where VPRSV <> 'S' OR MMSTA = '61'.
    loop at it_stb2.
    call function 'CS_BOM_EXPL_MAT_V2'
    exporting
    capid = 'PP01'
    auskz = c_x
    cuols = c_x
    datuv = sy-datum
    knfba = c_x
    ksbvo = c_x
    mbwls = c_x
    mdmps = c_x
    FBSTP = c_x
    FTREL = c_x
    mtnrv = it_stb2-idnrk
    werks = p_werks
    tables
    stb = it_stb3
    exceptions
    alt_not_found = 1
    call_invalid = 2
    material_not_found = 3
    missing_authorization = 4
    no_bom_found = 5
    no_plant_data = 6
    no_suitable_bom_found = 7
    conversion_error = 8
    others = 9.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
    into w_msg.
    *write: / w_msg.
    else.
    delete it_stb3 where idnrk is initial.
    delete it_Stb3 where sobsl = 50.
    loop at it_stb3 .
    multiply it_stb3-menge by it_stb2-menge.
    modify it_stb3 transporting menge.
    endloop.
    append lines of it_stb3 to it_stb.
    endif.
    *ENDLOOP.
    endloop.
    *enddo.
    Build table of components collecting the same components from
    all levels
    loop at it_stb.
    it_comp-matkl = it_stb-matmk.
    it_comp-idnrk = it_stb-idnrk.
    it_comp-ojtxp = it_stb-ojtxp.
    it_comp-menge = it_stb-menge.
      CALL FUNCTION 'CONVERSION_EXIT_CUNIT_OUTPUT'
        EXPORTING
        INPUT                = IT_STB-MEINS
        LANGUAGE             = SY-LANGU
        IMPORTING
      LONG_TEXT            =
       OUTPUT               = IT_STB-MEINS
      SHORT_TEXT           =
    EXCEPTIONS
       UNIT_NOT_FOUND       = 1
       OTHERS               = 2
        IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    it_comp-meins = it_stb-meins.
    collect it_comp.
    clear it_comp.
    endloop.
    *READ TABLE IT_COMP INDEX 1.
    *IF SY-SUBRC = 0.
    IT_COMP-MATNR = w_topmat-matnr.
    IT_COMP-MAKTL = w_topmat-maktx.
    INSERT IT_COMP index 1.
    *ENDIF.
    ENDFORM.
    FORM TO APPEND DATA INTO ALV FORM
    FORM BUILD_FIELDCATALOG.
    PERFORM BUILD_FIELDCAT USING 'MATKL' 'Component'.
    PERFORM BUILD_FIELDCAT USING 'MATKL' 'Component'.
    *loop at it_comp.
       PERFORM BUILD_FIELDCAT USING 'MATNR' 'Material'.
      PERFORM BUILD_FIELDCAT USING 'MAKTL' 'Material Description'.
      PERFORM BUILD_FIELDCAT USING 'IDNRK' 'Component'.
      PERFORM BUILD_FIELDCAT USING 'OJTXP' 'Description'.
      PERFORM BUILD_FIELDCAT USING 'MATKL' 'Material Group'.
      PERFORM BUILD_FIELDCAT USING 'MENGE'  'Quantity'.
      PERFORM BUILD_FIELDCAT USING 'MEINS' 'Unit Of MEASUREMENT'.
    *endloop.
    ENDFORM.
    FORM TO BUILD IN FIELD CATALOG FOR ALV FORM
    FORM BUILD_FIELDCAT USING L_FIELDNAME LIKE DD03L-FIELDNAME S_TEXT LIKE DD03P-SCRTEXT_M.
      CLEAR WA_FIELDCAT_LN.
      ADD 1 TO S_COL_POS.
      WA_FIELDCAT_LN-REF_TABNAME  = 'IT_COMP'.
      WA_FIELDCAT_LN-FIELDNAME    = L_FIELDNAME.
      WA_FIELDCAT_LN-SELTEXT_M    = S_TEXT.
      WA_FIELDCAT_LN-COL_POS      = S_COL_POS.
      WA_FIELDCAT_LN-QFIELDNAME   = SPACE.
      WA_FIELDCAT_LN-HOTSPOT      = SPACE.
      WA_FIELDCAT_LN-JUST         = 'R'.
      APPEND WA_FIELDCAT_LN TO IT_FIELDCAT.
    ENDFORM.
    FORM TO BUILD IN FIELD CATALOG FOR ALV FORM
    FORM DATA_DISPLAY.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
       I_GRID_TITLE                      = TEXT-001
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
       IT_FIELDCAT                       = IT_FIELDCAT
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        T_OUTTAB                          = IT_COMP
       EXCEPTIONS
       PROGRAM_ERROR                     = 1
       OTHERS                            = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    endform.
    Thanks in advance
                                                                                    Regards
    senthilkumar D

    tables :mara,marc,stpo.
    parameters: p_werks like t001w-werks obligatory.
    *p_matnr like mara-matnr obligatory.
    *select-options : p_matnr for mara-matnr obligatory.
    select-options : P_matnr for mara-matnr.
    *parameters: p_werks like marc-werks obligatory,
    *p_matnr like marc-matnr obligatory.
    constants c_x value 'X'.
    data: begin of it_comp occurs 0,
    idnrk like stpox-idnrk,
    ojtxp like stpox-ojtxp,
    menge like stpox-menge,
    meins like stpox-meins,
    matkl like stpox-matmk,
    end of it_comp.
    data: w_topmat like cstmat.
    data : begin of itab occurs 0,
            matnr like mara-matnr,
            end of itab.
    *data : itab type table of mara with header line.
    start-of-selection.
    perform explode_assembly.
    end-of-selection.
    perform write_report.
    top-of-page.
    perform print_header.
    form print_header.
    write: /(18) 'Component'(h00),
    (40) 'Description'(h01),
    'Mat.Group'(h02),
    (18) 'Quantity'(h03).
    uline.
    endform.
    form write_report.
    write: / w_topmat-matnr under text-h00 color col_heading,
    w_topmat-maktx under text-h01 color col_heading.
    loop at it_comp.
    write: /
    it_comp-idnrk under text-h00,
    it_comp-ojtxp under text-h01,
    it_comp-matkl under text-h02,
    it_comp-menge unit it_comp-meins under text-h03,
    it_comp-meins.
    endloop.
    uline.
    endform.
    form explode_assembly.
    data: it_stb like stpox occurs 0 with header line,
    it_stb2 like stpox occurs 0 with header line,
    it_stb3 like stpox occurs 0 with header line,
    w_msg(255) type c.
    select matnr from mara into table itab where matnr  between p_matnr-low and p_matnr-high.
    loop at p_matnr.
      itab-matnr = p_matnr-low.
       append itab.
       itab-matnr = p_matnr-high.
       append itab.
       clear itab.
       endloop.
    Explode highest level:
    loop at itab.
    call function 'CS_BOM_EXPL_MAT_V2'
    exporting
    auskz = c_x
    capid = 'PP01'
    cuols = c_x
    datuv = sy-datum
    knfba = c_x
    ksbvo = c_x
    mbwls = c_x
    mdmps = c_x
    BGIXO = c_x
    MKMAT = c_x
    MMAPS = c_x
    FBSTP = c_x
    FTREL = c_x
    mtnrv = itab-matnr
    werks = p_werks
    importing
    topmat = w_topmat
    tables
    stb = it_stb
    exceptions
    alt_not_found = 1
    call_invalid = 2
    material_not_found = 3
    missing_authorization = 4
    no_bom_found = 5
    no_plant_data = 6
    no_suitable_bom_found = 7
    conversion_error = 8
    others = 9.
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
    into w_msg.
    write: / w_msg.
    exit.
    *else.
    endif.
    loop at it_stb.
    it_comp-matkl = it_stb-matmk.
    it_comp-idnrk = it_stb-idnrk.
    it_comp-ojtxp = it_stb-ojtxp.
    it_comp-menge = it_stb-menge.
    it_comp-meins = it_stb-meins.
    collect it_comp.
    clear it_comp.
    endloop.
    endloop.
    endform.
    i got the low and high from selectoption and then move it into itab.
    then i pass itab-matnr into fm. using loop.
    but i got only one output
    but ineet to got from and to output.
    give me a solution
    Regards
    ds

  • Drop down box for the selection screen field of the classical report

    Hi all.
    i want to have the drop down list to choose from, for the region(table:zbwcntry-field:zregion1) on the selection screen.
    what is to be added to the code for this requirement.Also,please note that this is the classical report.
    thanks for this answered.

    hi,
    data  : gv_name  TYPE vrm_id,        " used for vrm id
               gv_repid TYPE sy-repid,      " used to hold program name
    work area to provide drop down list
    DATA :  gs_value TYPE vrm_value,
    Internal table to provide drop down list
    DATA :  gt_values TYPE vrm_values,
    PARAMETER : p_run(12) TYPE c AS LISTBOX VISIBLE LENGTH 12
                                     DEFAULT 'DEFAULT' OBLIGATORY,
    CONSTANTS : gc_run(5) TYPE c VALUE 'P_RUN',    "constant for run mode
    gv_name = gc_run.
      gs_value-key = gc_v1.
      gs_value-text = text-010.
      APPEND gs_value TO gt_values.
      gs_value-key = gc_v2.
      gs_value-text = text-011.
      APPEND gs_value TO gt_values.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          id              = gv_name
          values          = gt_values
        EXCEPTIONS
          id_illegal_name = 1
          OTHERS          = 2.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    Hope this is helpful.
    Rgds.,
    subash

  • Select Options: How to preallocate the select options values?

    Hi All,
    I have been trying to preallocate my select options. I want to read all values a user is authorized for and set them in the range of the select options fields (before the are actually shown to the user). However, I wasn't able to..
    Does anybody know how to do that and can provide codong examples?
    Thanks, Johannes

    Hi Johannes,
    Refer to the below link which has an article on the same topic with code snippets-
    http://www.divulgesap.com/blog.php?p=NjY=
    Regards,
    Ravikiran

  • Disable select options field

    Hi,,
    I need to disable one of the select option field s_date in my selection screen.
    I need to it to have the values that are populated in the initialization event and disable it for further entries.
    Can someone please let me know how to do this.
    Thanks in advance.

    Use the following FM for that purpose:
    SELECT_OPTIONS_RESTRICT
    Refer the code:
    * Include type pool SSCR
    TYPE-POOLS SSCR.
    * Define the object to be passed to the RESTRICTION parameter
    DATA RESTRICT TYPE SSCR_RESTRICT.
    * Auxiliary objects for filling RESTRICT
    DATA OPT_LIST TYPE SSCR_OPT_LIST.
    DATA ***      TYPE SSCR_***.
    * Define the selection screen objects
    * First block: 3 SELECT-OPTIONS
    SELECTION-SCREEN BEGIN OF BLOCK BLOCK_0 WITH FRAME TITLE TEXT-BL0.
      SELECT-OPTIONS SEL_0_0 FOR SY-TVAR0.
      SELECT-OPTIONS SEL_0_1 FOR SY-TVAR1.
      SELECT-OPTIONS SEL_0_2 FOR SY-TVAR2.
      SELECT-OPTIONS SEL_0_3 FOR SY-TVAR3.
    SELECTION-SCREEN END   OF BLOCK BLOCK_0.
    * Second block: 2 SELECT-OPTIONS
    SELECTION-SCREEN BEGIN OF BLOCK BLOCK_1 WITH FRAME TITLE TEXT-BL1.
      SELECT-OPTIONS SEL_1_0 FOR SY-SUBRC.
      SELECT-OPTIONS SEL_1_1 FOR SY-REPID.
    SELECTION-SCREEN END   OF BLOCK BLOCK_1.
    INITIALIZATION.
    * Define the option list
    * ALL: All options allowed
      MOVE 'ALL'        TO OPT_LIST-NAME.
      MOVE 'X' TO: OPT_LIST-OPTIONS-BT,
                   OPT_LIST-OPTIONS-CP,
                   OPT_LIST-OPTIONS-EQ,
                   OPT_LIST-OPTIONS-GE,
                   OPT_LIST-OPTIONS-GT,
                   OPT_LIST-OPTIONS-LE,
                   OPT_LIST-OPTIONS-LT,
                   OPT_LIST-OPTIONS-NB,
                   OPT_LIST-OPTIONS-NE,
                   OPT_LIST-OPTIONS-NP.
      APPEND OPT_LIST TO RESTRICT-OPT_LIST_TAB.
    * NOPATTERN: CP and NP not allowed
      CLEAR OPT_LIST.
      MOVE 'NOPATTERN'  TO OPT_LIST-NAME.
      MOVE 'X' TO: OPT_LIST-OPTIONS-BT,
                   OPT_LIST-OPTIONS-EQ,
                   OPT_LIST-OPTIONS-GE,
                   OPT_LIST-OPTIONS-GT,
                   OPT_LIST-OPTIONS-LE,
                   OPT_LIST-OPTIONS-LT,
                   OPT_LIST-OPTIONS-NB,
                   OPT_LIST-OPTIONS-NE.
      APPEND OPT_LIST TO RESTRICT-OPT_LIST_TAB.
    * NOINTERVLS: BT and NB not allowed
      CLEAR OPT_LIST.
      MOVE 'NOINTERVLS' TO OPT_LIST-NAME.
      MOVE 'X' TO: OPT_LIST-OPTIONS-CP,
                   OPT_LIST-OPTIONS-EQ,
                   OPT_LIST-OPTIONS-GE,
                   OPT_LIST-OPTIONS-GT,
                   OPT_LIST-OPTIONS-LE,
                   OPT_LIST-OPTIONS-LT,
                   OPT_LIST-OPTIONS-NE,
                   OPT_LIST-OPTIONS-NP.
      APPEND OPT_LIST TO RESTRICT-OPT_LIST_TAB.
    * EQ_AND_CP: only EQ and CP allowed
      CLEAR OPT_LIST.
      MOVE 'EQ_AND_CP'  TO OPT_LIST-NAME.
      MOVE 'X' TO: OPT_LIST-OPTIONS-CP,
                   OPT_LIST-OPTIONS-EQ.
      APPEND OPT_LIST TO RESTRICT-OPT_LIST_TAB.
    * JUST_EQ: Only EQ allowed
      CLEAR OPT_LIST.
      MOVE 'JUST_EQ' TO OPT_LIST-NAME.
      MOVE 'X' TO OPT_LIST-OPTIONS-EQ.
      APPEND OPT_LIST TO RESTRICT-OPT_LIST_TAB.
    * Assign selection screen objects to option list and sign
    * KIND = 'A': applies to all SELECT-OPTIONS
      MOVE: 'A'          TO ***-KIND,
            '*'          TO ***-SG_MAIN,
            'NOPATTERN'  TO ***-OP_MAIN,
            'NOINTERVLS' TO ***-OP_ADDY.
      APPEND *** TO RESTRICT-***_TAB.
    * KIND = 'B': applies to all SELECT-OPTIONS in block BLOCK_0,
    *             that is, SEL_0_0, SEL_0_1, SEL_0_2
      CLEAR ***.
      MOVE: 'B'          TO ***-KIND,
            'BLOCK_0'    TO ***-NAME,
            'I'          TO ***-SG_MAIN,
            '*'          TO ***-SG_ADDY,
            'NOINTERVLS' TO ***-OP_MAIN.
      APPEND *** TO RESTRICT-***_TAB.
    * KIND = 'S': applies to SELECT-OPTION SEL-0-2
      CLEAR ***.
      MOVE: 'S'          TO ***-KIND,
            'SEL_0_2'    TO ***-NAME,
            'I'          TO ***-SG_MAIN,
            '*'          TO ***-SG_ADDY,
            'EQ_AND_CP'  TO ***-OP_MAIN,
            'ALL'        TO ***-OP_ADDY.
      APPEND *** TO RESTRICT-***_TAB.
    * KIND = 'S': Applies to SELECT-OPTION SEL_0_3
      CLEAR ***.
      MOVE: 'S'        TO ***-KIND,
            'SEL_0_3'  TO ***-NAME,
            'I'        TO ***-SG_MAIN,
            'N'        TO ***-SG_ADDY,
            'JUST_EQ'  TO ***-OP_MAIN.
      APPEND *** TO RESTRICT-***_TAB.
    * Call function module
      CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
           EXPORTING
                 RESTRICTION                = RESTRICT
    *           DB                          = ' '
           EXCEPTIONS
                 TOO_LATE                   = 1
                 REPEATED                   = 2
                 NOT_DURING_SUBMIT          = 3
                DB_CALL_AFTER_REPORT_CALL  = 4
                SELOPT_WITHOUT_OPTIONS     = 5
                 SELOPT_WITHOUT_SIGNS       = 6
                 INVALID_SIGN               = 7
                REPORT_CALL_AFTER_DB_ERROR = 8
                  EMPTY_OPTION_LIST          = 9
                 INVALID_KIND               = 10
                 REPEATED_KIND_A            = 11
                 OTHERS                     = 12.
    * Exception handling
      IF SY-SUBRC NE 0.
      ENDIF.

  • How to get all the values in the Select-option.

    Hi,
    I got the select-option field so_week, for eg. If I give 200923 to 200926 (year and week)  in the selection screen and then I need to pass this value (200923) to the FM 'ZWEEK_GET_FIRST_DAY' to get the first day of the week.
    My question is how can i get all the values from the select option, (i.e) i need to get 200923, 200924,200925, 200926.
    Regards,
    Anbu.

    Hello,
    I will prefer Max's solution. But just for the sake of this req.
    i need to get 200923, 200924,200925, 200926
    i am proposing my soln:
    DATA: V_WEEK TYPE RSCALWEEK.
    SELECT-OPTIONS: S_WEEK FOR V_WEEK NO-EXTENSION OBLIGATORY.
    AT SELECTION-SCREEN.
      DATA:
      V_COUNT TYPE I,
      V_ADD   TYPE I,
      RT_WEEK TYPE RANGE OF RSCALWEEK,
      RS_WEEK LIKE LINE OF RT_WEEK.
      V_COUNT = ( S_WEEK-HIGH - S_WEEK-LOW ) + 1.
      DO V_COUNT TIMES.
        RS_WEEK-SIGN = 'I'.
        RS_WEEK-OPTION = 'EQ'.
        RS_WEEK-LOW = S_WEEK-LOW + V_ADD.
        APPEND RS_WEEK TO RT_WEEK. "RT_WEEK--> Will contain the week values
        CLEAR RS_WEEK.
        V_ADD = V_ADD + 1.
      ENDDO.
    @Max: I was stupid enough not to think of your solution. Need to leave office
    Cheers,
    Suhas

Maybe you are looking for

  • How will I connect everything to Thunderbolt?

    I'm considering upgrading to a new MBP and am curious about Thunderbolt.  Currently, I hook my current MBP to a 27" Cinema Display.  The ACD plugs into my MBP with two connectors - USB and DisplayPort.  This leads me to a few questions ... 1)  If I u

  • Is there any inbuilt function to split a comma seperated text

    Dear Friends, Is there any inbuilt function to split a comma seperated text for inserting the values thus split in to a table. Text Ex: Mango, Orange, Pinapple, Jack Fruit Output: Mango Orange Pineapple Jack Fruit Thanking you, With regards, Franklin

  • Looking Document for jdbc troubleshooting issues

    Hi, Can someone post links to get a good jdbc related issues and troubleshooting tools?

  • Table relation between Sales Organization and Profit centre

    Hi everybody, I hava a question: How do I know wich Sales organitzation (VKORG) belongs to a Profit centre(PRCTR), which table relation do I need to do to find it, or from wich table do I get this relation because I haven't found anything. I've been

  • 0WBS_ELEMT_ATTR Master Data - Delta Mode extraction

    Hi experts, I am trying to test the Delta mechanism for Master Data on 0WBS_ELEMT_ATTR but have a query.  Basically, i have set my extractor to Delta mode.  then did an INITload - which pulled thought all records.  I then made a change in ECC6 to one