How to Fill Internal Table with contents of Select-Option

Hi all:
     There is a select-option s_matnr on the self-made screen.   An internal table t_int is declared in the program. The requirement is that users makes selection with multiple  material numbers.  I want to put the values of s_matnr  into internal table  t_int directly. Would you please tell me how?
     Thank you very much in advance.
Edited by: dongdong guo on Jun 13, 2008 3:40 AM

Hi,
Select option works like an internal table only.
For table selection you can use it directly using IN operator in where clause
eg : where matnr IN s_matnr.
Before that you may need to validate the content of the select-option. For that also you need to transfer the content to a new internal table.
u can loop at the select-option.
eq: loop at s_matnr.
      if s_matnr-low = 'MAT1'.
        condition.
      endif.
     endloop.
if you just want to check whether any single valid material number exist in your user screen, then u can use a select single option with s_matnr directly.
  select single matnr from mara
            where matnr in s_matnr.
  select-option s_matnr behaves like an internal table with four fields.
sign, option, low, high.

Similar Messages

  • How to fill internal table with selection screen field.

    Hi all,
    i am new to sap . pls tell me how to fill internal table with selection screen field.

    Hi,
    Please see the example below:-
    I have used both select-options and parameter on the selection-screen.
    Understand the same.
    * type declaration
    TYPES: BEGIN OF t_matnr,
            matnr TYPE matnr,
           END OF t_matnr,
           BEGIN OF t_vbeln,
             vbeln TYPE vbeln,
           END OF t_vbeln.
    * internal table declaration
    DATA : it_mara  TYPE STANDARD TABLE OF t_matnr,
           it_vbeln TYPE STANDARD TABLE OF t_vbeln.
    * workarea declaration
    DATA : wa_mara  TYPE t_matnr,
           wa_vbeln TYPE t_vbeln.
    * selection-screen field
    SELECTION-SCREEN: BEGIN OF BLOCK b1.
    PARAMETERS : p_matnr TYPE matnr.
    SELECT-OPTIONS : s_vbeln FOR wa_vbeln-vbeln.
    SELECTION-SCREEN: END OF BLOCK b1.
    START-OF-SELECTION.
    * I am adding parameter value to my internal table
      wa_mara-matnr = p_matnr.
      APPEND wa_mara TO it_mara.
    * I am adding select-options value to an internal table
      LOOP AT s_vbeln.
        wa_vbeln-vbeln =  s_vbeln-low.
        APPEND  wa_vbeln TO  it_vbeln.
      ENDLOOP.
    Regards,
    Ankur Parab

  • How to fill internal table with no data in debugging mode

    Hi all,
             I modified one existing program.Now I want to test it.I am not given test data.So in the middle of my debugging, I found that one internal table with no data.My problem is how to fill that internal table with few records in that debugging mode just as we change contents in debugging mode.If I want to proceed further means that internal table must have some records.
    Please I dont know how to create test data so I am trying to create values temporarily in debugging mode only.
    Thanks,
    Balaji

    Hi,
    In the debugging do the following..
    Click the Table button..
    Double click on the internal table name..
    Then in the bottom of the screen you will get the buttons like CHANGE, INSERT, APPEND, DELETE..
    Use the APPEND button to insert records to the internal table..
    Thanks,
    Naren

  • Getting error of Defining an internal table with header line, SELECT-OPTIO

    Hi all,
    i have a coding for my smart form,In this coding i have define an structure which being used,but when i execute it it give me
    error of Defining an internal table with header line, SELECT-OPTIONS, and RANGES is not allowed within a structure.Even tough you can see that in  my coding im not using SELECT-OPTION or RANGES,but can't understand why it gives me this error.
    Following are the code:
      DATA: BEGIN OF traptab OCCURS 50.
            INCLUDE STRUCTURE mseg.
      DATA: vgart LIKE mkpf-vgart,
            blart LIKE mkpf-blart,
            blaum LIKE mkpf-blaum,
            bldat LIKE mkpf-bldat,
            budat LIKE mkpf-budat,
            cpudt LIKE mkpf-cpudt,
            cputm LIKE mkpf-cputm,
            aedat LIKE mkpf-aedat,
            usnam LIKE mkpf-usnam,
            tcode LIKE mkpf-tcode,
            xblnr LIKE mkpf-xblnr,
            bktxt LIKE mkpf-bktxt,
            frath LIKE mkpf-frath,
            frbnr LIKE mkpf-frbnr,
            wever LIKE mkpf-wever,
          END OF traptab. 
    Thanks & Regards,
    sappk25

    thanks

  • Fill internal table with mutliple entries for nested structure

    Dear ABAP Experts,
    I have a question related to fill internal tables with nested structures.
    I have a structure like this:
    BEGIN OF proto,
              sicht TYPE ysicht,
              version TYPE FAGLFLEXA-RVERS,
              BEGIN OF kons,
    kon TYPE YKONSEINHEIT,
              END OF kons,
              jahr TYPE CHAR04,
    END OF proto.
    Now I need to fill this structure with values (over an internal table), but how can I achieve that I save multiple datas für element "kon" für one single entry of structure "proto"?
    An example could be:
    sicht = '01'
    version = '100'
    kon = 1001 (first entry)
    kon = 1002 (second entry)
    usw... (n entry)
    jahr = '2008'
    Thanks in advance for every helpful answer.
    Regards
    Thomas

    BEGIN OF proto,
               sicht TYPE ysicht,
               version TYPE FAGLFLEXA-RVERS,
               kons TYPE STANDARD TABLE OF YKONSEINHEIT WITH NON-UNIQUE KEY TABLE_LINE,
               jahr TYPE CHAR04,
    END OF proto.
    DATA: ls_proto TYPE proto,
          lt_proto TYPE STANDARD TABLE OF proto,
          ls_kon
    ls_proto-sicht = '01'.
    ls_proto-version = '100'
    INSERT '1001' INTO TABLE ls_proto-kons.
    INSERT '1002' INTO TABLE ls_proto-kons.
    ls_proto-jahr = '2008'.
    INSERT ls_proto INTO TABLE lt_proto
    If you're going to use a more complicated inner table with several components, then you need to define a type for those components. 
    matt

  • How to fill internal table dynamically

    Hi All,
       how to fill internal table dynamically.
    for example:
    begin of itab occurs 0,
    empid like pa0000-pernr,
    empname like pa0001-ename,
    grade(5),
    end of itab.
    now i want to append dynamically field itab-grade along with rest fields.
    is this possible?? if yes kindly let me know how to do that.
    Regards,
    Kiran I

    Hi kiran,
    To fill and create and internal table dynamically you can use this code.
    TYPE-POOLS: slis.
    DATA: it_fcat TYPE slis_t_fieldcat_alv,
          is_fcat LIKE LINE OF it_fcat.
    DATA: it_fieldcat TYPE lvc_t_fcat,
          is_fieldcat LIKE LINE OF it_fieldcat.
    DATA: new_table TYPE REF TO data.
    DATA: new_line  TYPE REF TO data.
    FIELD-SYMBOLS: <l_table> TYPE ANY TABLE,
                   <l_line>  TYPE ANY,
                   <l_field> TYPE ANY.
    is_fieldcat-fieldname = 'FIELD1'.
    is_fieldcat-ref_field = 'MATNR'.
    is_fieldcat-ref_table = 'MARA'.
    APPEND is_fieldcat TO it_fieldcat.
    is_fieldcat-fieldname = 'FIELD2'.
    is_fieldcat-ref_field = 'SPRPS'.
    is_fieldcat-ref_table = 'PA0001'.
    APPEND is_fieldcat TO it_fieldcat.
    is_fieldcat-fieldname = 'FIELD3'.
    is_fieldcat-ref_field = 'BEGDA'.
    is_fieldcat-ref_table = 'PA0002'.
    APPEND is_fieldcat TO it_fieldcat.
    Create a new Table
    CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
        it_fieldcatalog = it_fieldcat
      IMPORTING
        ep_table        = new_table.
    Create a new Line with the same structure of the table.
    ASSIGN new_table->* TO <l_table>.
    CREATE DATA new_line LIKE LINE OF <l_table>.
    ASSIGN new_line->* TO <l_line>.
    Test it...
    DO 40 times.
      ASSIGN COMPONENT 'FIELD1' OF STRUCTURE <l_line> TO <l_field>.
      <l_field> = '12345'.
      ASSIGN COMPONENT 'FIELD2' OF STRUCTURE <l_line> TO <l_field>.
      <l_field> = 'X'.
      ASSIGN COMPONENT 'FIELD3' OF STRUCTURE <l_line> TO <l_field>.
      <l_field> = '20030101'.
      INSERT <l_line> INTO TABLE <l_table>.
    ENDDO.
    LOOP AT <l_table> ASSIGNING <l_line>.
    ASSIGN COMPONENT 'field1' OF STRUCTURE <l_line> TO <l_field>.
      WRITE  / <l_line>.
    ENDLOOP.
    regards,
    Aashish Garg

  • How to disply internal table with grid format .

    HI ,
    how to disply internal table with grid format .
    Regards
    venkat

    Grid format can be disaplyed using two ways,
    1. Using reuse_alv_grid_display
    2. using object oriented ABAP with the methos set_table_for_first_display.
    For example program search in where used list for standard SAP programs.
    If this is not the answer then please explain your issue in detail
    Thanks,
    Rama Krishna

  • How to pass internal table with data in ABAP OO

    Hi experts ,
    Here is the problem...
    I create a screen 100 and use the internal table to get data from database, and then press the button on screen 100 , it will call screen 200.
    I use ABAP OO code in screen 200, and i want to keep the internal table with data that i get from the sceen 100 parts, but it seems that it just supports to create a new internal table and get data from database in ABAP OO. That means i need to create a new table to save the data in internal table ? Or there is any other solution something like exporting or memory id ...
    ps . the internal table in screen 100 is declared in global area, the beginning of the code.
    Please give me some advice, thanks a lot!
    Regards ,
    Claire

    I have already know how to do, here is my code:
    METHODS fill_tree importing itab2 like itab1.
    CALL METHOD: me->fill_tree exporting itab2 = itab1.
    In METHOD fill_tree,
    declare
    data: itab3 TYPE STANDARD TABLE OF itab,
    itab3[] = itab1[].
    It is useful to me, thanks a lot.

  • How to convert internal table with dynamic fields to XML

    Dear all,
    I met a problem like the following:
    The aim is to transform the following parameter to XML
    IT_FIELD stores the dynamic filed name of the internal table,with these fields, the dynamic internal can be created by cl_abap_tabledescr=>create(it_field)
    IT_VALUE stores the value of the internal table dynamically created with dynamic fields.
    For example
    IT_FIELD =>
    line1: FIELD1
    line2: FIELD2
    line3: FIELD3,
    three lines in this internal table.
    dynamically created internal table structure FIELD1 FIELD2 FIELD3
    And IT_VALUE=>
    1          2          3   (First line)
    11        22        33
    two lines of data.
    Do you have any idea about how to transform the IT_VALUE to XML here? And also the transformed XML to the IT_VALUE.( we may need remember IT_FIELD here for later XML to IT_VALUE.)
    Hope I describe the problem clearly.
    Any inputs will be appreciated.
    Edited by: Max Tang on Jan 12, 2009 3:46 PM
    Edited by: Max Tang on Jan 12, 2009 4:14 PM

    Hi,
    you need to implement a bit of coding for that.
    With the 'do varying' statement abap provides a loop over those fields. Within this loop you can build up a new internal table with one entry for each period and amount.
    kind regards
    Siggi
    PS: I am not very familiar with CO, but I guess there will be a standard extractor for that.

  • In sm30, when save, how to fill the table with the system data in the table

    Hi all, in SM30, we have user name and time fields, when we create record, after we click the SAVE button, it will automatically fill the fields with the system data, how can we realize it?

    Hi ,
    Do like this.
    1. Go to SE11 -> give your table name and press on change button .
    2.Go to Menu->Utilities-> Table Maintainance Generator , then it will take you another screen .
    3.Assign Functin group if already have one , other wise create function group and assign
    4.Go to Menu->Environment->Modification->Events , again it will take you to another screen
    5.Click on new entries
    ->Now press F4 in T column . Select<u> "01" - Before saving the data in the database</u> and in form routinue give any name of the routinue like "SAVE_USER_DATA" and press enter then u can see an editor symbol in next column click on that it will take you ABAP editor there type this code .
    ztable-username = sy-uname.
    ztable-createtime = sy-uziet.
    check and activate the code .
    With this your job will be complete . Now while entering data just leave columns blank , they will insert corresponding username and time
    Don't forget award points if it helps you.
    Regards,
    Raghav

  • How to get internal table with maximum value of a field in other internal

    Let say I have an table itab consisting of:
    itab-matnr = marm-matnr.
    itab-umren = marm-umren.
    itab-ean11 = marm-ean11.
    there are many "ean11" for one "matnr"
    How could I create itab2 with only "biggest" "ean11". could you give me examlple

    Hi,
    data: mat_no type MATNR.
    Loop at ITAB1.
    IF mat_no = itab1-matnr.
    here check the  ean11 with previos ean11(Store it like matnr), and move the biggest one andf modify that row or move that in ITAB2 with a Modify statment, so that there will no second row with same material No
    ENDIF.
    MAT_NO = ITAB1-Matnr     (Moving Itab1 material no to a Local field)
    ENDLOOP.
    Endloop.

  • Populate separate internal table(alpha num) for select option value entered

    Hi Experts,
    Please tell me, How to read, validate and populate wage types field entered in select option selection screen to a separate internal table, Here wage types is alpha numeric(contains special chars '/' also). Thanks in advance....

    Hi:
    have a look
    [Link|http://www.sap-img.com/abap/check-length-and-alpha-numeric-variable.htm]
    Regards
    Shashi

  • How to fill a table with data from columns & rows from a txt file

    I am trying to fill say:
    Myname     Myclass     Mycollege
    Mohan     MD     Stanford
    from a txt file into 3 columns of a table. I can easily do it into a textarea component by
    clicking a button:
    try{
    FileReader fr = new FileReader("F:/CreatorProjects1/stan.txt");
    BufferedReader br = new BufferedReader(fr);
    String s1="";
    String s="";
    stantxtarea.setValue(s);
    while((s=br.readLine())!=null) {
    s1 = s1+s;
    s1=s1+"\n";
    stantxtarea.setValue(s1);
    br.close();
    fr.close();
    } catch(Exception e) {
    e.printStackTrace();
    return null;
    All table components seem to need a database. I do not use any database. I run exe files that give output to txt files. How to solve it?
    I appreciate any help in this regard...
    dr.mohan rao

    there may be another way. This is some thing some thing I can recommend. You can create property type of ObjectListDataProvider in session or application based on the scope you required. Create web bean class with property you want to show in the column (say col1, col2, col2). Initialize the list property like similar below
    List dataList = new ArrayList();
    ObjectListDataProvider mytableprops = new ObjectListDataProvider();
    try {
    //start loop read data from your txt file
    //create instance of web bean for each line
    //add web bean instance into dataList
    //end of loop readind data from txt file
    oldpins.setList(dataList );
    oldpins.setObjectType(NotificationProfileBean.class);
    } catch (Exception ee1){;}
    return oldpins;
    Sri Thuraisamy

  • How to modify internal table with new value after data processing

    Hi,
    My code is as below:
    LOOP AT i_raw INTO wa_raw.
       IF  ( wa_raw-/BIC/ZOUASCLS = 'BA') OR ( wa_raw-/BIC/ZOUASCLS = 'CO' ) .
          LOOP AT i_crrs INTO wa_crrs.
            IF wa_raw-/BIC/ZOUIDCIF = wa_crrs-ZCBGCIFNO.
              wa_raw-/BIC/ZOUINDAP = '03'.
            ELSE.
              wa_raw-/BIC/ZOUINDAP = '02'.
            ENDIF.
          ENDLOOP.
        ENDIF.
      ENDLOOP.
    Initially column /BIC/ZOUINDAP is empty and I want to populate either value '02' or '03' as shown above.
    How do I insert those values into each i_raw records ?
    Pls help!

    Hello,
    try this code:
    IF ( i_raw-/BIC/ZOUASCLS = 'BA') OR ( i_raw-/BIC/ZOUASCLS = 'CO' ) .
    LOOP AT i_raw INTO wa_raw.
    WHERE wa_raw-/BIC/ZOUIDCIF = i_crrs-ZCBGCIFNO.
    IF SY-SUBRC = 0.
    wa_raw-/BIC/ZOUINDAP = '03'.
    ELSE.
    wa_raw-/BIC/ZOUINDAP = '02'.
    APPEND wa_raw INTO i_raw.
    ENDLOOP.
    ELSE.
    i_raw-/BIC/ZOUINDAP = ' '.
    ENDIF.
    Hope it helps.
    Best regards.
    Simone.

  • How to fill a table with a query?

    Hi experts,
    J'ai une table que je veux remplir avec ma requête. J'ai aussi un bouton sur lequel je veux cliquer pour exécuter ma requête et afficher le résultat dans le tableau. Quelqu'un peut il m'aider?
    Regards.

    oDBs_Detail1 = oForm.DataSources.DBDataSources.Item("@HIS_OPDINVD")
                                            oDBs_Head = oForm.DataSources.DBDataSources.Item("@HIS_OPDINVH")
                                            Dim oRS As SAPbobsCOM.Recordset
                                            oRS = objMain.objCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)
                                            Dim Str1 As String
                                            Str1 = "Select T3.U_Qty,T3.U_PList,T3.U_TLName,T3.U_TLID, T3.U_TLPrice from [@UPDATE]    T0,[@UPDATE4] T3"
                                            Str1 = Str1 & " where T0.DocEntry = T3.DocEntry"
                                            Str1 = Str1 & " and T0.U_PID='" & PID & "' and  U_VisitID='" & VisitID & "' and T3.U_TLID IS NOT NULL "
                                            oRS.DoQuery(Str1)
                                            For i As Integer = 1 To oRS.RecordCount
                                                oBillMat.AddRow()
                                                oBillMat.FlushToDataSource()
                                                oDBs_Detail1.Offset = i
                                                Total = oRS.Fields.Item("U_TLPrice").Value
                                                oDBs_Detail1.SetValue("LineID", oDBs_Detail1.Offset, i)
                                                oDBs_Detail1.SetValue("U_SID", oDBs_Detail1.Offset, oRS.Fields.Item("U_TLID").Value)
                                                oDBs_Detail1.SetValue("U_Price", oDBs_Detail1.Offset, oRS.Fields.Item("U_TLPrice").Value)
                                                oDBs_Detail1.SetValue("U_Desc", oDBs_Detail1.Offset, oRS.Fields.Item("U_TLName").Value)
                                                oDBs_Detail1.SetValue("U_PL", oDBs_Detail1.Offset, oRS.Fields.Item("U_PList").Value)
                                                oDBs_Detail1.SetValue("U_TB", oDBs_Detail1.Offset, oRS.Fields.Item("U_TLPrice").Value)
                                                oDBs_Detail1.SetValue("U_Qty", oDBs_Detail1.Offset, oRS.Fields.Item("U_Qty").Value)
                                                oBillMat.SetLineData(i)
                                                oBillMat.FlushToDataSource()
                                                oRS.MoveNext()
                                            Next

Maybe you are looking for

  • Back up plan

    We have an xServe and xRAID with 2 3.7TB RAID 5 drives. One of the drives is used for production work. I would like to have an incremental back-up made on the other drive. In the past we used Retrospect to back up files to tape but then you are force

  • What is the best way to update a help file once it's already been compiled

    As programs get updated, many of the programmers I write for don't highlight their Microsoft Word help document changes.  This leaves me to re-compile their newest document - creating many headaches for me if the previous document needed hyperlinks a

  • "Ask to buy" requests not appearing in notification center (family sharing)

    I understand that if one misses an "ask to buy" request from a family member from the lock screen, it is supposed to be available in the notification center.  However, these requests are not being logged in my notification center.  There doesn't seem

  • IPhone causing iTunes crash

    I'm connecting my iPhone to the computer I am using and it has never had problems before but suddenly it is. It's been synced with it several times and the settings have not been changed. The computer reads that it's there because the iPhone camera w

  • Is Verizon OK w/ losing feature phone customers to the HTC Freestyle?

    Is Verizon OK with losing customers to the HTC Freestyle? This phone is by far the best feature phone available among all the service providers. Does Verizon plan to compete at this level of feature phones? Or are the customers who would buy into thi