Loop select options in Liquid

Hi,
I have a <select> form field that saves it values into a webapp that customers can edit using edit webapp functionality. Nothing unusual here
A static solution works fine, if I save the webapp and return to the page the right values get selected.
<select name="CAT_Custom_12" id="CAT_Custom_12" multiple>
     <option value="1">Foo</option>
     <option value="2">Bar</option>
</select>
What I want to archive is a dynamic solution, I want the options to be rendered with a for loop in Liquid.
<select name="CAT_Custom_12" id="CAT_Custom_12" multiple>
  {% for item in users.items %}
    <option value="{{ item.customer.id }}">{{ item.customer.firstName }} </option>
  {% endfor %}
</select>
This doesn't work. The field stores the correct values in BC, 1,2 and so on.. The page also render the same option values, but they don't get selected...
Is the problem related to DOM? Are my options rendering after the select already tried to select the equivalent select?

First of all, thank you for pointing me into the right direction that made it possible for me to solve this. Your code showed the logic about how to think.
For further reference, i'm not 100% sure about how your code was supposed to work. As the data is stored in a comma separated string I had to split it before I could loop in it, like so:
<select name="CAT_Custom_12" id="CAT_Custom_12" multiple="multiple">
  {% for user in users.items -%}
    {% assign found = false %}
    {% assign allowedAccess = CAT_Custom_12 | split: ',' %}
    {% for item in allowedAccess -%}
      {% if item == user.customer.id -%}
        <option value="{{ user.customer.id }}" selected>{{ user.customer.firstName }} </option>
        {% assign found = true %}
      {% endif -%}
    {% endfor -%}
    {% if found == false %}
      <option value="{{ user.customer.id }}">{{ user.customer.firstName }} </option>
    {% endif %}
  {% endfor -%}
</select>
I'm however very keen to know if this can be made even easier as i'm going to look for data in loops for almost every project. It's also very interesting what Liam speaks about in another thread, that modules can't take search parameter, instead we have to make this kind of search logic. When webapps enters module_data I will never user the modules anymore. Always limited by 500 in search operation and never able to filter for the exact data I need. That is however another story. Thank you Abhishek and Liam. I hope that someone else will learn by this thread. It could be refactored into a general guide, very handy to be able to search data with another field as search-source.

Similar Messages

  • Loop in select options

    Hi,
    In DEV in debugging mode, S_VENDO is showing three entries but
    in PRD in debugging mode it shows one table entry.
    and thats why looping in not happening in PRD properly.
    I am inserting three entries.
    So how to loop in select option field.
    Edited by: Anurodh Jindal on Jun 5, 2008 1:32 PM

    Hi Bala,
    Please let us know why you need to loop in the range table as you can directly use it in your query or condition. Still if you want to loop, you will have to check the low as well as high values, and then adjust the loop accordingly. For ex.
    LOOP AT s-vendo INTO ls_vendo.
       lv_vendo = s_vendo-low.
       IF s_vendo-high IS NOT INITIAL.
         WHILE lv_vendo <= s-vendo-high.
           "write your code here using lv_vendo
           lv_vendo = lv_vendo + 1.
         ENDWHILE.
       ELSE.
         "write your code here using lv_vendo
       ENDIF.
    ENDLOOP.
    Let me know if you have any further doubts.
    Regards,
    Rachna

  • Select options and loop statement

    Dear forum,
    I have the scenario where i need to restrict the loop from the select-options.
    in the select-options, user enter currency.
    then in the loop i need to loop base on the currency user enter.
    may i know what steps should i use for the loop as loop cannot support where.
    thanks

    HI Gengis
    I have the scenario where i need to restrict the loop from the select-options.
    in the select-options, user enter currency.
    then in the loop i need to loop base on the currency user enter.
    may i know what steps should i use for the loop as loop cannot support where.
    as per your requirement.
    you have some data in your internal table also you have a select-options to input values.
    on the basis of the values in your select option you want to fetch the values from your internal table. right???
    then there should be a field like your select option in your internal table.
    select-option: s_matnr for mara-matnr.
    let assume you have an internal table with matnr and other fields also and your select-options is for mara-matnr.
    then you need to select the values in your internal table according to the values in your select-options like below.
    SELECT MATNR field1 field2........ from dbtable into table itab where matnr = s_matnr.
    the above code will give you the values matching the values in your select-options.
    you need not to apply loop becasue you already have only those values for which yo u have found records in the DBTABLE.
    in case you want to apply loop on an internal table on the basis of s_matnr's values, then you can write.
    in this scenario you need to define 2 internal table one with already fethced values and another in which we will fetch the values according to select-options.
    loop at itab into wa_itab.
    read table itab1 into wa_itab1 where matnr = wa_itab-matnr.
    write statement........
    endloop.
    before that youwill have to fetch values in itab according to s_matnr.
    I hope this will clear your query.
    Thanks
    Lalit Gupta.

  • Select option looping

    i have 5 select options on the screen. i want to take each select option .e.g one to one correpondence... I have to use a select query looping on the select option and send mails depending on the select query. also i have to concatenate the select option values in a variable

    hi
    hope it will help you.
    Pls reward if help.
    SELECT-OPTIONS: BEDAT FOR EKKO-BEDAT.
    SELECT-OPTIONS: EBELN FOR EKKO-EBELN.
    SELECT-OPTIONS: MATNR FOR EKPO-MATNR.
    SELECT-OPTIONS: EREKZ FOR EKPO-EREKZ.
    SELECT-OPTIONS: KOSTL FOR EKKN-KOSTL.
    SELECT-OPTIONS: AUFNR FOR EKKN-AUFNR
    DATA: INT LIKE ZSIMM_PO_HISTORY OCCURS 0 WITH HEADER LINE.
    DATA: LW_EKKO TYPE EKKO,
    LW_EKPO TYPE EKPO,
    LW_EKKN TYPE EKKN,
    LW_LFA1 TYPE LFA1.
    SELECT * FROM EKKO INTO LW_EKKO
    WHERE ( EBELN IN EBELN ) AND
    ( BEDAT IN BEDAT ).
    CLEAR: INT.
    IF SY-SUBRC = 0.
    MOVE-CORRESPONDING LW_EKKO TO INT.
    ENDIF.
    SELECT * FROM EKPO INTO LW_EKPO
    WHERE ( EBELN = LW_EKKO-EBELN ) AND
    ( MATNR IN MATNR ) AND
    ( EREKZ IN EREKZ ).
    CLEAR: INT.
    MOVE-CORRESPONDING LW_EKKO TO INT.
    IF SY-SUBRC = 0.
    MOVE-CORRESPONDING LW_EKPO TO INT.
    ENDIF.
    *SELEKCIJSKI EKRAN ZA CC IN ORDER
    CLEAR: EKKN.
    SELECT SINGLE * FROM EKKN WHERE ( EBELN = LW_EKPO-EBELN ) AND
    ( EBELP = LW_EKPO-EBELP ) AND
    ( KOSTL IN KOSTL ) and
    ( AUFNR IN AUFNR ).
    MOVE EKKN-KOSTL TO INT-KOSTL.
    MOVE EKKN-AUFNR TO INT-AUFNR.
    CALL FUNCTION 'ME_READ_HISTORY'
    EXPORTING
    EBELN = LW_EKPO-EBELN
    EBELP = LW_EKPO-EBELP
    WEBRE = ' '
    TABLES
    XEKBES = BETS.
    LOOP AT BETS WHERE ZEKKN EQ SPACE.
    MOVE-CORRESPONDING BETS TO INT.
    APPEND INT.
    ENDLOOP.
    IF SY-SUBRC NE 0.
    APPEND INT.
    ENDIF.
    REFRESH BETS.
    CLEAR: LW_EKPO.
    ENDSELECT.
    CLEAR: LW_EKKO.
    ENDSELECT.

  • How to hide some select-option of Logical Database in report?

    How to hide select-option of  Logical Database in report?eg . In Logical Database 'PNP' , my code is 'GET  PERNR' , excute the report , select-screen is displayed . I want to hide some select-options , such as PNPPERNR-LOW .
    Edited by: rongrong wang  on Mar 26, 2008 9:31 AM

    U need to write code in initialization as
    initialization.
    loop at screen.
    if screen-name = 'PNPPERNR-LOW'.
    screen-active = '0'.
    modify screen.
    endif.
    if screen-name = 'PNPPERNR-HIGH'.
    screen-active = '0'.
    modify screen.
    endif.
    endloop.

  • Select-option in ABAP objects

    Hi Guys,
               I need a small help from you. I want to know how to populate the value from select-option to abap object. Please help me, it is very important

    check this code
    REPORT ZSELOPT_TO_CLASS .
    TABLES: VBRK.
    SELECT-OPTIONS: S_VBELN FOR VBRK-VBELN.
    DATA: IT_VBELN TYPE RSELOPTION.
    DATA: X_VBELN TYPE RSDSSELOPT.
    CLASS C1 DEFINITION.
    PUBLIC SECTION.
    DATA: IT_VBRP TYPE VBRP_TAB,
          X_VBRP LIKE LINE OF IT_VBRP.
    METHODS: GET_DATA IMPORTING S_VBELN TYPE RSELOPTION.
    METHODS: DISP_DATA.
    ENDCLASS.
    CLASS C1 IMPLEMENTATION.
    METHOD GET_DATA.
      *SELECT * FROM VBRP*
       INTO TABLE IT_VBRP
       WHERE VBELN IN S_VBELN.
    ENDMETHOD.
    METHOD DISP_DATA.
      LOOP AT IT_VBRP INTO X_VBRP.
        WRITE:/ X_VBRP-VBELN,
                X_VBRP-POSNR.
      ENDLOOP.
    ENDMETHOD.
    ENDCLASS.
    START-OF-SELECTION.
    DATA OBJ TYPE REF TO ZCL_SELOPT.
    CREATE OBJECT OBJ.
    LOOP AT S_VBELN.
      MOVE S_VBELN-LOW TO X_VBELN-LOW.
      MOVE S_VBELN-HIGH TO X_VBELN-HIGH.
      MOVE S_VBELN-SIGN TO X_VBELN-SIGN.
      MOVE S_VBELN-OPTION TO X_VBELN-OPTION.
      APPEND X_VBELN TO IT_VBELN.
    ENDLOOP.
    CALL METHOD OBJ->GET_DATA
                        EXPORTING
                          S_VBELN = IT_VBELN.
    CALL METHOD OBJ->DISP_DATA.
    Edited by: moazam hai on May 17, 2008 6:17 AM
    Edited by: moazam hai on May 17, 2008 6:19 AM

  • How to get all values in the range of select option into internal table?

    Hi,
    I need to capture all entries coming in the range of select option into one internal table.
    How to do get that?
    For E.g
    select-options: matnr for mara-matnr.(select option)
    IF I enter G0100013507892 as lower value of matnr and G0100014873947 as higher value
    and if there are 10,000 materials in the above range, then I want to capture all theses 10000 materails in one internal table. How to do that?
    Regards,
    Mrunal

    Hello Mrunal Mhaskar  ,
    What i understand you can do one thing  go in debug mode
    Try this code : -
    LOOP AT s_matnr_ex.
      IF s_matnr_ex-low IS NOT INITIAL.
        i_matnr-matnr = s_matnr_ex-low.
        i_matnr-option = s_matnr_ex-option.
        APPEND i_matnr.
        CLEAR : i_matnr.
      ENDIF.
    ENDLOOP.
    LOOP AT s_matnr_ex.
      IF s_matnr_ex-high IS NOT INITIAL.
        i_matnr-matnr = s_matnr_ex-high.
        i_matnr-option = s_matnr_ex-option.
        APPEND i_matnr.
        CLEAR : i_matnr.
      ENDIF.
    ENDLOOP.
    In the i_matnr table high and low values are there.
    Regards,
    Vandana.

  • How to get the values of Select-options from the screen.

    The value of parameter can be obtained by function module 'DYNP_VALUES_READ' but How to get the values of Select-options from the screen? I want the F4 help values of select-options B depending on the values in Select-option A.So I want to read the Select-option A's value.

    Hi,
    Refer this following code..this will solve your problem...
    "Following code reads value entered in s_po select options and willprovide search
    "help for s_item depending upon s_po value.
    REPORT TEST.
    TABLES : ekpo.
    DATA: BEGIN OF itab OCCURS 0,
    ebelp LIKE ekpo-ebelp,
    END OF itab.
    SELECT-OPTIONS   s_po FOR ekpo-ebeln.
    SELECT-OPTIONS s_item FOR ekpo-ebelp.
    INITIALIZATION.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_item-low.
      DATA:
      dyn_field TYPE dynpread,
      temp_fields TYPE TABLE OF dynpread,
      zlv_dynpro TYPE syst-repid.
      zlv_dynpro = syst-repid.
      CALL FUNCTION 'DYNP_VALUES_READ'
        EXPORTING
          dyname     = zlv_dynpro
          dynumb     = syst-dynnr
          request    = 'A'
        TABLES
          dynpfields = temp_fields
        EXCEPTIONS
          OTHERS     = 0.
      LOOP AT temp_fields INTO dyn_field.
        IF dyn_field-fieldname EQ 'S_PO-LOW'.
            SELECT * INTO CORRESPONDING fields OF TABLE itab FROM ekpo
            WHERE ebeln EQ dyn_field-fieldvalue.
            EXIT.
        ENDIF.
      ENDLOOP.

  • Report text element as selection option

    Hi,
      I encounter a performance problem in a report program that include a self define fields in the selection option.  I use the FM READ_TEXT to read those fields and compare with the user input.Then, eliminates those unmatched records with if else statement.
    Here is my code:
    SELECT-OPTIONS: S_WADAT FOR LIKP-WADAT_IST.
      PARAMETERS: P_MAWB LIKE WA_REPORT-KZABE.
      PARAMETERS: P_HAWB LIKE LIKP-BOLNR.
      PARAMETERS: P_MATNR LIKE LIPS-MATNR.
      PARAMETERS: P_LOT(20) TYPE C.
      CLEAR: I_REPORT,I_DELIVERY,I_DELIVERY_INFO.
      REFRESH: I_REPORT,I_DELIVERY,I_DELIVERY_INFO.
      DATA WHERE_TAB(80) OCCURS 10 WITH HEADER LINE.
      DATA: BEGIN OF LTEXT OCCURS 50.
              INCLUDE STRUCTURE TLINE.
      DATA: END OF LTEXT.
      IF NOT P_HAWB IS INITIAL.
        CONCATENATE ' BOLNR = ' WHERE_TAB INTO WHERE_TAB.
        CONCATENATE WHERE_TAB '''' INTO WHERE_TAB.
        CONCATENATE WHERE_TAB P_HAWB INTO WHERE_TAB.
        CONCATENATE  WHERE_TAB '''' INTO WHERE_TAB.
        APPEND WHERE_TAB.
      ENDIF.
      IF NOT P_MATNR IS INITIAL.
        IF NOT WHERE_TAB IS INITIAL.
          CONCATENATE ' AND MATNR = ' WHERE_TAB INTO WHERE_TAB.
        ELSE.
          CONCATENATE ' MATNR = ' WHERE_TAB INTO WHERE_TAB.
        ENDIF.
        CONCATENATE WHERE_TAB '''' INTO WHERE_TAB.
        CONCATENATE WHERE_TAB P_MATNR INTO WHERE_TAB.
        CONCATENATE  WHERE_TAB '''' INTO WHERE_TAB.
        APPEND WHERE_TAB.
      ENDIF.
      SELECT A1~VBELN
             WADAT_IST
             BOLNR
             C1~LIFNR
             B1~MATNR
             LFIMG
             BTGEW
             B1~CHARG
        INTO CORRESPONDING FIELDS OF TABLE TMP_REPORT
        FROM LIKP AS A1 JOIN LIPS AS B1 ON A1~VBELN = B1~VBELN
            JOIN MCHA AS C1 ON B1~MATNR = C1~MATNR
                               AND
                               B1~WERKS = C1~WERKS
                               AND
                               B1~CHARG = C1~CHARG
         WHERE LFART = 'EL'
               AND
               WADAT_IST IN S_WADAT
               AND
               B1~CHARG NE ''
               AND
               B1~WERKS = 'ABC'
               AND
               (WHERE_TAB)
      SORT TMP_REPORT BY VBELN.
      DATA: V_FLAG TYPE I,
            V_EXCLUDE TYPE I,
            V_LOT_EXCLUDE TYPE I.
      V_FLAG = 0.
      V_EXCLUDE = 0.
      V_LOT_EXCLUDE = 0.
      IF SY-SUBRC = 0.
    * trim the parameter space
        SHIFT P_MAWB RIGHT DELETING TRAILING SPACE.
        SHIFT P_MAWB LEFT DELETING LEADING SPACE.
        SHIFT P_LOT RIGHT DELETING TRAILING SPACE.
        SHIFT P_LOT LEFT DELETING LEADING SPACE.
        LOOP AT TMP_REPORT.
          AT NEW VBELN.
            V_FLAG = 1.
            V_EXCLUDE = 0.
          ENDAT.
          IF V_FLAG = 1.
            PERFORM GET_HEADER_TEXT
                  TABLES
                       LTEXT
                  USING
                       'Z3IH'
                        TMP_REPORT-VBELN
            READ TABLE LTEXT INDEX 1.
            SPLIT LTEXT-TDLINE AT ':' INTO
            TMP_REPORT-VERUR TMP_REPORT-VERUR.
            READ TABLE LTEXT INDEX 2.
            SPLIT LTEXT-TDLINE AT ':' INTO
            TMP_REPORT-KZGBE TMP_REPORT-KZGBE.
            READ TABLE LTEXT INDEX 3.
            SPLIT LTEXT-TDLINE AT ':' INTO
            TMP_REPORT-KZABE TMP_REPORT-KZABE.
            READ TABLE LTEXT INDEX 4.
            SPLIT LTEXT-TDLINE AT ':' INTO
            TMP_REPORT-STABE TMP_REPORT-STABE.
            READ TABLE LTEXT INDEX 5.
            SPLIT LTEXT-TDLINE AT ':' INTO
            TMP_REPORT-PRONU TMP_REPORT-PRONU.
            READ TABLE LTEXT INDEX 6.
            SPLIT LTEXT-TDLINE AT ':' INTO
            TMP_REPORT-LADEL TMP_REPORT-LADEL.
            SHIFT TMP_REPORT-KZABE RIGHT DELETING TRAILING SPACE.
            SHIFT TMP_REPORT-KZABE LEFT DELETING LEADING SPACE.
            MOVE-CORRESPONDING TMP_REPORT TO WA_REPORT.
            MOVE-CORRESPONDING TMP_REPORT TO WA_TMPREPORT.
            V_FLAG = 0.
          ELSE.
            MOVE TMP_REPORT-VBELN TO WA_REPORT-VBELN.
            MOVE TMP_REPORT-LIFNR TO WA_REPORT-LIFNR.
            MOVE TMP_REPORT-MATNR TO WA_REPORT-MATNR.
            MOVE TMP_REPORT-LFIMG TO WA_REPORT-LFIMG.
          ENDIF.
          PERFORM GET_LOT_CODE USING
                                     WA_REPORT-MATNR
                                     '3LTU'
                                     WA_TMPREPORT-CHARG
                                     WA_REPORT-LOT.
          IF V_EXCLUDE  1 AND P_MAWB NE ''
            AND WA_TMPREPORT-KZABE NE P_MAWB .
            V_EXCLUDE = 1.
          ENDIF.
          SHIFT WA_REPORT-LOT RIGHT DELETING TRAILING SPACE.
          SHIFT WA_REPORT-LOT LEFT DELETING LEADING SPACE.
          IF P_LOT NE '' AND P_LOT NE WA_REPORT-LOT.
            V_LOT_EXCLUDE = 1.
          ELSE.
            V_LOT_EXCLUDE = 0.
          ENDIF.
          IF V_EXCLUDE  1 AND V_LOT_EXCLUDE  1.
            APPEND WA_REPORT TO I_REPORT.
            CLEAR WA_REPORT.
            CLEAR TMP_REPORT.
          ENDIF.
        ENDLOOP.

    Hi,
    i found one perfromance issue, try to remove the "INTO CORRESPONDING FIELDS OF TABLE " in your select statement, the order of the fields that you are fetching and the oreder for the fields in your internal table structure should be same, then you can remove "INTO CORRESPONDING FIELDS OF TABLE " and while fetching the fields reffer the table and fields you need to fetch here also you need to main the same order...like you have to do the same in where condition.
    Reward if needful.
    Thanks,
    Sreeram.

  • About select option

    Hi experts,
    In my alv report there is one field SERNR serial number, for this i have to put select option. My problem is this field doesn't exist in the table(Zmanifest) from where i'm fetching data. So i'm not able to mention this select option in my select query for that particular table. This field is existing in EQUI table and have no relation defined between zmanifest table & EQUI.
    In my internal table i have all fields of zmanifest & this sernr; to fulfill this field logic is
    Serial Number is combination of P_PREFIX-(dash)P_SERIAL fields in zmanifest. I have fetch all data including SERNR by above logic at my grid; but facing problem in defining SELECT-OPTIONS for Sernr.
    Please help.
    Points Sure.
    Anshuman

    Hi,
    do like this.
    take the lenght of P_PREFIX
    take the lenght of P_SERIAL
    add the length.
    for exmaple :
    P_PREFIX size is 4.
    P_SERIAL size is 10
    now declare the variable like this.
    data : v_selop(15).
    Note : 4101 = 15, so i declared the variable with lenght of 15.
    select-options : so_field for v_selop.
    now use off-set in your select query like this:
    where PREFIX = v_selop+0(4)
       and SERIAL = v_selop+5(10)
    it will work if you are using variable v_selop as a parameter else if you are using select option you have to break v_selop into two different select option like this:
    s_prefix type prefix,
    s_serial type serial.
    loop at v_selop.
    s_prefix-* = v_selop-. "      (  = sign, option)
    s_serial-* = v_selop-*.
    s_prefix-low = v_selop-low+0(4).
    s_serial-low = v_selop-low+5(10).
    s_prefix-high = v_selop-high+0(4).
    s_serial-high = v_selop-high+5(10).
    endloop.
    now use following select query
    where PREFIX in s_prefix
       and SERIAL in s_serial.
    it will surely wrok.
    Regards-
    Gagan Kumar
    Plz Reward if need full. also close the question.
    Edited by: Gagan Kumar on May 18, 2008 7:30 PM

  • Help on Dynamic values in select options

    Hi All,
    I need help for the following.
    1. I have two select options for fields VBAK-VBELN and VBAK-ERDAT one after the other.
    2. When I select VBELN through F4 in the first select option then the corresponding ERDAT should be displayed in second select option.
    Please let me know how to do this

    Use the below code
    tables: pa0000, pa0001.
    parameters: p_chk1 as checkbox user-command rusr,
    p_chk2 as checkbox user-command rusr,
    p_chk3 as checkbox user-command rusr,
    p_chk4 as checkbox user-command rusr,
    p_chk5 as checkbox user-command rusr.
    selection-screen: begin of block blk1 with frame.
    select-options: s_pernr for pa0000-pernr modif id ABC,
    s_stat2 for pa0000-stat2 modif id DEF,
    s_werks for pa0001-werks modif id GHI,
    s_persg for pa0001-persg modif id JKL,
    s_persk for pa0001-persk modif id MNO.
    selection-screen: end of block blk1.
    AT SELECTION-SCREEN output.
    LOOP AT SCREEN.
    IF SCREEN-GROUP1 = 'ABC'.
    IF p_chk1 = 'X'.
    SCREEN-ACTIVE = 1.
    ELSE.
    SCREEN-ACTIVE = 0.
    ENDIF.
    MODIFY SCREEN.
    ENDIF.
    IF SCREEN-GROUP1 = 'DEF'.
    IF p_chk2 = 'X'.
    SCREEN-ACTIVE = 1.
    ELSE.
    SCREEN-ACTIVE = 0.
    ENDIF.
    MODIFY SCREEN.
    ENDIF.
    IF SCREEN-GROUP1 = 'GHI'.
    IF p_chk3 = 'X'.
    SCREEN-ACTIVE = 1.
    ELSE.
    SCREEN-ACTIVE = 0.
    ENDIF.
    MODIFY SCREEN.
    ENDIF.
    IF SCREEN-GROUP1 = 'JKL'.
    IF p_chk4 = 'X'.
    SCREEN-ACTIVE = 1.
    ELSE.
    SCREEN-ACTIVE = 0.
    ENDIF.
    MODIFY SCREEN.
    ENDIF.
    IF SCREEN-GROUP1 = 'MNO'.
    IF p_chk5 = 'X'.
    SCREEN-ACTIVE = 1.
    ELSE.
    SCREEN-ACTIVE = 0.
    ENDIF.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    *Note
    *Titles for check boxes and select options
    *P_CHK1 Personal Number
    *P_CHK2 Employment Status
    *P_CHK3 Personnel Area
    *P_CHK4 Employee Group
    *P_CHK5 Employee Sub group
    *S_PERNR Personal Number
    *S_PERSG Employee Group
    *S_PERSK Employee Sub group
    *S_STAT2 Employment Status
    *S_WERKS Personnel Area

  • Select-Options Help

    Hi.
    I have this small program with a select-options s_tran.
    I need to call function Z_UNLOCK for each entry in s_tran.
    How can I make that?
    Thanks
    Best regards
    PARAMETERS: p_warn TYPE ltap-LGNUM.
    SELECT-OPTIONS:  s_tran FOR LTAK-tanum.
    loop at ......................?????
        CALL FUNCTION 'Z_UNLOCK'
          EXPORTING
            iv_warehouse = p_warn
            iv_tanum     = s_tran-tanum
            language     = sy-langu
          IMPORTING
            return       = return.
        IF return-type = ''.
          EXIT.
        ENDIF.
    Endloop.

    hi,
    try to use this code:
    >PARAMETERS: p_warn TYPE ltap-LGNUM.
    >SELECT-OPTIONS: s_tran FOR LTAK-tanum.
    >data: lt_ltak type ltak occurs 0 with header line.
    >start-of-selection.
    >select * from ltak into table lt_ltak where tanum in s_tran.
    >
    >
    >loop at lt_ltak.
    >
    >CALL FUNCTION 'Z_UNLOCK'
    >EXPORTING
    >iv_warehouse = p_warn
    >iv_tanum = lt_ltak-tanum
    >language = sy-langu
    >IMPORTING
    >return = return.
    >
    >IF return-type = ''.
    >EXIT.
    >ENDIF.
    >
    >Endloop.
    bye
    Marco

  • SELECT OPTIONS DATE.

    Hello , I need your help ,  to access to  every date in an interval of the select option , in order to execute a function module that use date in one of its parameters .
    select-options : dat for sy-datum .
       CALL FUNCTION 'ZPRUEBA''
         EXPORTING
           offic                =
           chdsk                =
           inicio_periodo       =
         FIM_PERIODO          =  dat  "but i need here every date of the interval
         NO_UPDATE            =
       IMPORTING
         NR_COBRANCAS         =
       ENDSELECT.
    How can I do that ? , tnhx.

    hi
    put the function module in the loop.
    data : date like sy-datum.
    select-options : s_date for date.
    while ( s_date-low LE s_date-high ).
    CALL FUNCTION 'ZPRUEBA''
    EXPORTING
    offic =
    chdsk =
    inicio_periodo =
    FIM_PERIODO = s_date-low
    NO_UPDATE =
    IMPORTING
    NR_COBRANCAS =
    add 1 to s_date-low.
    endwhile.
    reward if helpful
    prasanth

  • DYNP_VALUES_READ Limitations for multiple lines select options

    Hi all !
       First post here, but a tough one I think. Here is my inquiry :
       I have worked on an specific abap function used in many long abap list reports. Theses reports are launched in background processing. The aim of this routine is to stop the report execution if a background job with the same selection parameters is already launched for the current user (to Prevent useless several launch of a time-expensive program).
        Because this routine is dynamic, I read the selection screen of the current report with the function 'DYNP_VALUES_READ'. And I compare the result with the variant of the backgroung job (read with function 'RS_VARIANT_CONTENTS').
        The real problem is that function "DYNP_VALUES_READ" only extract the first line of select-options. I found an alternative solution to extract the select options values (a dynamic assign with field symbols), but external conversions (for WBS elements for example ) are lost, so the comparison detects differences between the background job's variant values and the current selection screen values.
        Does anybody know a way to get entire select options values from a selection screen just as they are displayed on screen ?
    Thanks for reading my message
    Message was edited by: Thomas BRICOUT

    Thomas,
    Perhaps the following code will help you.  A function module in the code captures everything on the selection screen into an internal table.  It doesn't actually capture the information the way you want it, but I believe you will be able to work with it to achieve your desired result.  If it doesn't meet your needs, it is still useful for printing selection screen fields and their values.
    Bruce
    report zybttes2.
    tables: zf137,   " 137 General Ledger Document Details Table
            zf137a.  " 137 General Ledger Document Details Table, Archive
    selection-screen begin of block b1 with frame title text-004." BCT003
    parameters: p_zf137   radiobutton group xxx,                " BCT003
                p_zf137a  radiobutton group xxx.                " BCT003
    selection-screen end of block b1.                           " BCT003
    selection-screen begin of block parameter with frame title text-001.
    selection-screen skip 1.
    select-options: s_date for zf137-zzpostdat.
    selection-screen skip 1.
    selection-screen begin of line.
    selection-screen comment 3(6) text-002.
    selection-screen end of line.
    selection-screen skip 1.
    select-options: s_loan for zf137-zzloan.
    selection-screen skip 1.
    selection-screen begin of line.
    selection-screen comment 3(6) text-003.
    selection-screen end of line.
    selection-screen skip 1.
    select-options: s_ccentr for zf137-zzcostctr.
    selection-screen skip 1.
    selection-screen end of block parameter.
    data: ww(3) type n.
    data: zz(3) type c.
    data: c1(1) type c value '0'.
    do 2 times.
      ww = ww + 1.
      zz = ww.  shift zz left  deleting leading  c1.
      write: / zz.
    enddo.
      Capture and then print the selection screen fields and their values
    data: begin of i_info occurs 20,
            flag,
            olength type x,
            line  like raldb-infoline,
          end of i_info.
    call function 'PRINT_SELECTIONS'
      exporting
        mode      = 'TABLE'
        rname     = sy-cprog
        rvariante = sy-slset
      tables
        infotab   = i_info.
    loop at   i_info.
      write: / i_info-line.
    endloop.
    write:  / 'end'.

  • 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

Maybe you are looking for

  • Read directories of an application server

    Hi i asked some question about this topic but i want to know at sure There is wat to Read directories of an application server? thanks

  • Adobe Flash Player Problem with Install

    I too am having the same problem as the many of you with the Flash Player saying that it is installed on internet explorer 8 and yet every website wants me to down load the latest version like I don't have it. I realy am getting tired of see the same

  • How to Number Large Amount of Files?

    Hi. I have a folder with about 600 funny photos that I randomly saved. And you know how pictures you save from sites have random long numbers as names?Well here is what I want: I want to know if there is a way to  automaticaly number all the photos s

  • Where exactly is the 8i JVM?

    I installed iAS 1.0.1 for NT, and chose the standard edition. This supposedly means that I should have gotten the 8i JVM, among other things. But where exactly is the VM located? The only copy of java.exe that I can find within the Oracle directory i

  • Oracle Database Creation without Installing Software

    Hi All guru's, I just have a query, I have 2 Servers with OS Solaris and DB Version is 10.2.0.1.0 which is installed on one server and not on second one. Is there any possibility that i can create a database on the second server where oracle software