Eliminate the values from internal table

I have an internal table with fields..
begin of it occurs 0,
ebeln
matkl
werks
end of it.
its filled with values..
ebeln |  matkl | werks |
12111 |   A123 | LK
12111 |   A123 | LK
12111 |   A123 | LK
12111 |   A123 | LK
12111 |   A123 | LK
12111 |   A123 | LN
12121 |   A124 | LK
12121 |   A124 | LK
12121 |   A124 | LK
12122 |   A125 | LK
12122 |   A125 | LK
12122 |   A125 | LK
12123 |   A126 | LN
12123 |   A126 | LN
Now I want to eliminate the values from the internal table where all ebeln and werks are different..for example..all 12111's should be eliminated from the internal table as the it has different werks assighned to one of the ebeln's..and I need only ebeln's with 12121 and 12123.
Any suggention would be helpful..
Thanks,
M/

Hi,
DATA : v_ebeln LIKE  table name-ebeln,
            v_werks LIKE table name--werks.
SORT itab BY ebeln werks .
LOOP AT ITAB.
  ON CHANGE OF  itab-ebeln.
      Move : itab-ebeln TO v_ebeln,
                itab-werks TO v_werks.
   ENDON.  
   IF ITAB-ebeln  NE  v_ebeln OR
      ITAB-werks NE v_werks.
   DELETE ITAB WHERE ebeln EQ ITAB-ebeln .
    clear  : v_ebeln , v_werks.
ENDIF.
ENDLOOP.

Similar Messages

  • Fetch the values from internal table inside an internal table (urgent!!)

    data : BEGIN OF PITB2_ZLINFO occurs 0,
             BEGDA LIKE SY-DATUM,
             ENDDA LIKE SY-DATUM,
             PABRJ(4) TYPE N,                       "Payroll Year
             PABRP(2) TYPE N,                       "Pay. Period
             ZL LIKE PC2BF OCCURS 0,
           END OF PITB2_ZLINFO.
    I have a internal table like this,
    How to Fetch the values from internal table inside an internal table.
    Kindly Help me on this..
    Regards,
    Ram.

    Hi,
    Try this....
    Loop at PITB2_ZLINF0.
    Loop at PITB2_ZLINF0-ZL.
    endloop.
    Endloop.
    Thanks...
    Preetham S

  • How to pass the values from internal table to field groups

    hi all,
    how can i pass the internal  table values to field groups?
    already field groups are holding some values.. INSERT STATEMENT IS NOT WORKING as it is ovewriting the existing values..
    Use full answers will be rewared.
    Thanks.
    Moderator message - duplicate post locked
    Edited by: Rob Burbank on Jun 23, 2009 9:51 AM

    Hi,
    You can use INSERT statement to put a work area of an Internal table in Field-group
    and use Extract to get info out of it.
    Hope it helps,
    Raj

  • How to retrieve the values from a table if they differ in Unit of Measure

    How to retrieve the values from a table if they differ in Unit of Measure?

    If no data is read
    - Insure that you use internal code in SELECT statement, check via SE16 desactivating conversion exit on table T006A. ([ref|http://help.sap.com/saphelp_nw70/helpdata/en/2a/fa0122493111d182b70000e829fbfe/frameset.htm])
    If no quanity in result internal table
    - There is no adqntp field in the internal table, so no quantity is copied in itab ([ref|http://help.sap.com /abapdocu_70/en/ABAPINTO_CLAUSE.htm#&ABAP_ALTERNATIVE_1@1@]).
    - - Remove the CORRESPONDING, so quantity will fill the first field adqntp1.  ([ref|http://help.sap.com/abapdocu_70/en/ABENOPEN_SQL_WA.htm])
    - - Then loop at the internal table and move the quantity when necessary to the 2 other fields.
    * Fill the internal table
    SELECT msehi adqntp
      INTO TABLE internal table
      FROM lipso2
      WHERE vbeln = wrk_doc1
        AND msehi IN ('KL','K15','MT').
    * If required move the read quantity in the appropriate column.
    LOOP AT internal_table ASSIGNING <fs>.
      CASE <fs>-msehi.
        WHEN 'K15'.
          <fs>-adqnt2 = <fs>-adqnt1.
          CLEAR <fs>-adqnt1.
        WHEN 'MT'.
          <fs>-adqnt3 = <fs>-adqnt1.
          CLEAR <fs>-adqnt1.
      ENDCASE.
    ENDLOOP.
    - You could also create another table with only fields msehi and adqntp and then collect ([ref|http://help.sap.com/abapdocu_70/en/ABAPCOLLECT.htm]) the data to another table.
    Regards,
    Raymond

  • Gui_download for transferring the data from internal table to excel sheet.

    hi all,
    i am using gui_download for transferring the data from internal table to excel sheet.
    I have a internal table with 3 columns col1,col2,col3 and I am getting the file at the specified path,but my problem is that,in the excel sheet(path specified) all the 3 columns values are printed in one column.Please help me.
    Thanks in advance.

    Hi Venkata,
    plz use FM 'SAP_CONVERT_TO_XLS_FORMAT' :
      call function 'SAP_CONVERT_TO_XLS_FORMAT'
        exporting
    *   I_FIELD_SEPERATOR          =
    *   I_LINE_HEADER              =
          i_filename                 = p_file
    *   I_APPL_KEEP                = ' '
        tables
          i_tab_sap_data             = t_mbew
    * CHANGING
    *   I_TAB_CONVERTED_DATA       =
    * EXCEPTIONS
    *   CONVERSION_FAILED          = 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 helps,
    Erwan

  • Passing a value from internal table to a powerpoint slide

    Hi,
    Does anyone know how to pass a value from internal table to a powerpoint slide?  I would also need some codes with regards to the coding to open the powerpoint and insert the value in.
    Thanks.
    Points will be awarded.
    Hope to hear from you soon.
    Lawrence

    geez!! do feel sorry for you
    you can fire FM WS_EXECUTE to open power point but passing a variable at run-time i'm not sure, sorry.

  • How to generate a text file with values from internal table

    hi,
    can anybody help me out to get the values from different internal table written into a text file.
    regs,
    raja

    used gui_download,ws_download,cl_gui_file_save.
    data: ld_filename type string ;
    ld_filename = 'c:\demo.txt'.
    DATA: begin of it_datatab occurs 0,
    row(500) type c,
    end of it_datatab.
    HII
    call function 'GUI_DOWNLOAD'
    exporting
    filename = ld_filename
    filetype = 'ASC'
    tables
    data_tab = it_datatab[]
    exceptions
    file_open_error = 1
    file_write_error = 2
    others = 3.
    gui_download

  • How to extract the values from WPBP table

    Hi experts,
    We are in preparation of a custom report.
    In the report we want to have a  value from WPBP table.
    We want to extract the value of Capacity utilization level from WPBP table.
    Could you please let me know the way to extract the value.
    Please advice.
    Regards,
    Sairam.

    Hi Sairam,
    Why do you try to get capacity utilization level from WBPB. Even if there is split in payroll capacity utilizatian level in WPBP shows the value in IT0008 basic pay.
    So instead you can get the required information from table PA0008 Field for capacity utilization level is BSGRD
    Regards;
    Okan

  • Query based report to pick up the value from differences table

    Hi,
    I am trying to pick up the value from change log differences feild but since it is system variable i am unable to pick it.which table i should pick up to get that .
    Regards-
    Monica.

    Hi Monica,
    This would be a tough job if you know the structure of the historical record tables.  You need to familiar with all those A tables first.  Any changes to one of the record would create a instance of the record before change.  AITM is for OITM, AIT1 is for ITM1 etc.  Which tables are you looking for?
    Thanks,
    Gordon

  • Getting unique values from internal table

    Hi Gurus,
    From time to time I hit this problem and so far I havn't found any nice solution. I've an internal table with several fields. I would like to get all unique values for one (or several) of these fields. However let say that this table has a lot of entries so making a copy is not an option. Also changing this table in any way is forbiden.
    For example for table below I would like to get all unique values for field Number. In this case it would be 1,2,3,4.
    Name  | Number |
    name1 | 1|
    name2 | 2|
    name3 | 2|
    name4 | 3|
    name5 | 4|
    name5 | 3|
    Can anyone propose me better solution than going in the loop through all entries in table? Maybe there is some ABAP functionality that I don't know about?
    BR
    Marcin Cholewczuk

    Let's say that if I sort this table I won't be able to restore it to previous order which is important for me
    True...If you sort the table you won't be able to restore. So the only option is to copy/move all the records into another table.
    Sorting If you need to retrive unique values. I don't think without sorting the table would be a nice idea and proper programming to proceed ahead.
    Regarding logic, as replied earlier
    Either we can go with DELETE ADJACENT DUPLICATES or proceed as replied in my earlier post. There might be number of algorithms to resolve this. But we cannot go ahead without sorting or looping.

  • Update value from internal table into table control

    hi friends,
    i have two text field and a button in a screen.if give the value and click the button it should get updated in the table control which is in the next screen.plz
    help me with some sample coding.

    hi Karthik ,
    Here you go with the sample coding of moving internal table values to table control on module pool programs :
    in screen painter flow-logic ............
    process before output.
    module status_3000.
    loop at g_tab_con_01_itab
         into g_tab_con_01_wa
         with control tab_con
         cursor tab_con-current_line.
    module tab_con_move.
    endloop.
    process after input.
    module exit at exit-command.
    module user_command_3000.
    module clear_ok_code.
    loop at g_tab_con_01_itab.
    module read_tab_con.
    endloop.
    in your program .............
    include z_tab_ctrl_top                          .    " global Data
    program  z_tab_ctrl.
    tables : sflight,sbook,zsflight.
    types:begin of t_tab_con_01 ,
            carrid like sflight-carrid,
            connid like sflight-connid,
            sel type c,
           end of t_tab_con_01.
    data: g_tab_con_01_itab type  t_tab_con_01 occurs 0 with header line,
          g_tab_con_01_wa type t_tab_con_01,
          g_tab_con_01_copied ,
          g_tab_con_01_lines like sy-loopc,
          ok_code like sy-ucomm,
          lines type i,
          init ,
          fill type i.
    controls: tab_con type tableview using screen 3000.
    module status_3000 output.
      set pf-status 'ST100'.
      set titlebar 'T100'.
    endmodule. 
    module update_table_control input.
      describe table g_tab_con_01_itab lines tab_con-lines.
    endmodule.  
    module exit input.
      ok_code = sy-ucomm.
      if ok_code eq 'BACK' or ok_code eq 'EXIT' or ok_code eq 'CANCEL'.
        leave program .
      endif.
    endmodule.        
    module clear_ok_code input.
    clear ok_code.
    endmodule.      
    module fill_tab_con output.
    read table g_tab_con_01_itab into zsflight index tab_con-current_line.
    endmodule.                 " fill_tab_con  OUTPUT
    module read_tab_con input.
    *lines = sy-loopc.
    read table g_tab_con_01_itab into g_tab_con_01_wa index tab_con-current_line.
    if sy-subrc eq 0.
    move-corresponding sflight to g_tab_con_01_wa.
    modify g_tab_con_01_itab from g_tab_con_01_wa index tab_con-current_line.
    else.
    move-corresponding sflight to g_tab_con_01_wa.
    append g_tab_con_01_wa to g_tab_con_01_itab.
    endif.
    module tab_con_move output.
    move-corresponding g_tab_con_01_wa to sflight.
    endmodule.                 " tab_con_move  OUTPUT
    module tab_con_get_lines output.
    g_tab_con_01_lines = sy-loopc.
    endmodule.                 " tab_con_get_lines  OUTPUT
    module tab_con_modify input.
    move-corresponding sflight to g_tab_con_01_wa.
      modify g_tab_con_01_itab
          from g_tab_con_01_wa
          index tab_con-current_line.
    endmodule.                 " tab_con_modify  INPUT
    module populate_tab_ctrl input.
    if sy-subrc eq 0.
    endif.
    endmodule.
    Look at the following modules in the above program ....
    fill_tab_con
    tab_con_modify
    tab_con_get_lines
    update_table_control
    This will definately solve your problem or give an idea for solution ....
    reward if helpful,
    Regards,
    Ranjita

  • Joining 3 tables based on the Value from 1 Table

    Dear Oracle Guru's
    I have a Table called Resourcemaster , which stores the details of Resources for the project , The Resources can be of 2 types either our own employees as well as Hired Developers from other consultancies. The following is the proposed Resourcemaster table structure
    Resourcemaster
    Project_id
    Resource_ID
    Resource_type (E - Employees /H - Hired)
    Resource_code
    Employeemaster
    Emp_code
    Emp_Name
    Emp_address
    Hiredresourcemaster
    Hired_code
    Hired_Name
    Hired_Address
    I need to query the resourcemaster , my result should be containing Project id, resource id , Resource type, Resource Name and Resource Address. for which the details are in the above 3 tables . How these 3 tables can be joined and the join is based on the condition, if the resource type is E then resource code = Emp_code from employee master or if the resource type is H then resource_code = Hired_code.
    I am not clear how to join them in a single query and i got stuck
    Kindly Clarify me
    With Warm Regards
    ssr

    ssr wrote:
    I have a Table called Resourcemaster , which stores the details of Resources for the project,So this table should really be called PROJECT_RESOURCES :-)
    The Resources can be of 2 types either our own employees as well as Hired Developers from other consultancies. So you have a table called RESOURCES (id [PK], code [UK?], name, address, resource_type [E or H])
    And the PROJECT_RESOURCES table is this: (project_id [FK to PROJECTS], resource_id [FK to RESOURCES])
    And by modelling your data like this, you'll also find that querying because much easier.
    Hope this helps.
    Regards,
    Rob.

  • Get the values from a table comparing fields of different data types

    Hi Experts,
    I want to fetch AFVC-AUFPL and AFVC- APLZL by passing WBS element from a ztable.
    select aufpl aplzl
      from  afvc
      into TABLE gt_afvc
      FOR ALL ENTRIES IN gt_boq
      where projn = gt_boq-posid.
    AFVC-PROJN - NUMC 8  (WBC ELEMENT)
    ZTABLE-POSID - CHAR24 (WBC ELEMENT)
    How to get aufpl and aplzl by comparing those 2?
    Regards
    Mani

    WBS element does have an conversion routine at the domain level. So sometimes you work with one format (8 digits) and sometimes with 24 digits.
    You use FMs
    CONVERSION_EXIT_ABPSP_INPUT
    CONVERSION_EXIT_ABPSP_OUTPUT
    to convert between values. Do your conversion before your select and do not forget to use a large enough data element for the field, which gets the 24-digits long value of the field.

  • How to get the value from Advanced table

    Hi,
    In the Advanced table have 2 LOV fields, I need LOV field value dynamically in the controller to validate the save button, if iam not selected any value in lov save button will not allow to save the data. In the table i am using 'Add another row'. How to get the lov field value in the process form request??? and how to do this requirement
    Thanks
    Naresh

    1. You can specify required property on LOV field to "yes". For events where you wish to disable the client side validations, set the property disable client side validation to "true".
    2. If above behavior is not what you are looking for, then you need to handle in AM and not CO.
    a. Call an AM method from CO.
    b. In that AM method, get handle of VO.
    c. Iterate the VO Rows and check for your validation rules.
    -Prince
    http://www.princekapoor82.blogspot.com

  • Get the values from a table

    Hi,
    I am new to webdynpro. I have created one table with four columns in MAX DB. I have to write a webdynpro application such that when the first page loads, all the records will be display.
    How to proceed for this using webdynpro for java..Please give the procedure so that I will try..
    Thanks & Regards,
    Mastanvali Shaik.

    Hello Mastan,
    i would suggest you next steps:
    1) Define a new DataSource in your JDBC service setting in Visual Admin app.
        This new DataSource should be pointed to your MAX DB. There you should select an Java class (sort of driver) to work with this DB type.
    <b>Then you have 2 possibilities:</b>
    2a) You can build an SQL script to read your DB and send it via jdbc connection:
    Context ctx = new InitialContext();
    DataSource ds = (DataSource) ctx.lookup(jdbc/<your DS alias>);
    Connection cn = ds.getConnection();
    PreparedStatement stm = cn.prepareStatement("Your SQL");
    ResultSet rsl = stm.executeQuery();
    Then you go through your ResultSet and fill-in some of your context nodes (datasource for an TableView).
    2b) Or you can define a new dictionary project, create your table in there and deply. Don't forget to set right DS alias. And then you can import and use that dict. object in your WD application. From programming point of view it's even easier because you can use it as data Model.
    Hope it helps.
    regards.
    mz

Maybe you are looking for

  • SSL-VPN Anyconnect fails after rebooting 2811

    Hello all, I have setup an Anyconnect SSL-VPN in my 2811 and it works just great, but then after the reboot it fails.  I think it has something to do with the SSL Cert being ereased.  Here is my configuration, please let me know if you need anything

  • All files on new iPod are grayed out when connected and viewed in iTune 7.6

    I just bought a new 80GB iPod classic. I have been able to get everything loaded and it works fine (I have to get used to the new interface but that's OK). What is odd is that when I click on "music" on the now fully loaded iPod contents list of some

  • My iPad quit recognizing my bluetooth speaker but my iPhone has no problems

    My iPad was working fine with my bluetooth speaker in December then in January it no longer can find the speaker. I have updated (8.1.3) and checked to make certain the bluetooth is turned on. My iPhone 5 has no problem finding the speaker.

  • Add work contract tax

    i m having a purchase order,now i want to add a work contract tax of 2%, in change mode it is not allowing to do so.....what may be the reason....where to add this? condition for the same is not maintain, plz guide.... Edited by: krish.rajshekhar on

  • SMTP Authentication (SASL on Postfix)

    I am migrating my personal mail server from Tiger Server to Snow Leopard Server. I have had Postfix on the Tiger Server working for years. I am having trouble configuring Snow Leopard to do the same. My set up for SMTP is to relay email from my respe