Lookup from table, which has 1:N relation with  Data package

Hi,
I have to look up for Sales Office, Sales district from 0Cust_Sales Masterdata, while loading data to 0FIAR_C03 (from 0FI_AR_4).
0FI_AR_4 has fields -
0Customer  
10000
While 0CUST_SALES has
Customer  Division  DistrCh. SalesOff   SalesDistr
10000         10          20         1000         120
10000          20         20          1500        121
Whenever I am looking up for Sales Office, Sales Distr, Division,Distr chn. It is loading ONLY FIRST RECORD.
I want to load both the records. I have written following code-
SELECT DIVISION
       DISTR_CHAN
       SALESORG
       CUST_SALES
       OBJVERS
       SALES_DIST
       SALES_OFF
       INTO TABLE GT_REC_SET
       FROM /BI0/MCUST_SALES
       FOR ALL ENTRIES IN DATA_PACKAGE
       WHERE CUST_SALES = DATA_PACKAGE-DEBITOR AND
       OBJVERS = 'A'.
IF SY-SUBRC = 0.
SORT GT_REC_SET BY CUST_SALES.
ENDIF.
READ TABLE GT_REC_SET
WITH KEY CUST_SALES = COMM_STRUCTURE-DEBITOR
INTO GW_REC_SET
BINARY SEARCH.
IF SY-SUBRC = 0.
result value of the routine
  RESULT = GW_REC_SET-DISTR_CHAN.
  ENDIF.
Any solution will be a great help....

" Read table with key" will return only first record.
You may have to "loop at ... where" .
And, even if you find two values, how are you going to set it? You have only one field RESULT, so the second will overwrite the first one.
To make one row into two in this case, this logic will have to be applied in the start routine.

Similar Messages

  • To Get List of Tables from Database which has the data 'AAAA' - T-SQL Query

    Hi,
    I have a database "Adventureworks", I need to get list of tables, which has the data 'AAAA' in their rows.
    Is there any optimised or simple way to do this task?
    Any T-SQL Query Available
    --- Thanks in advance..

    You can refer the same below URL provided by Praveen:
    https://gallery.technet.microsoft.com/scriptcenter/c0c57332-8624-48c0-b4c3-5b31fe641c58
    It has the SQL SP - "SP_SearchTables". You can pass parameters the way you want and get the expected output.
    -- Search for 'bike' instead of 'AAAA'
    Use AdventureWorks2012
    EXEC SP_SearchTables @Tablenames = '%', @SearchStr = '%bike%'
    -Vaibhav Chaudhari

  • INSERTING DATA INTO A SQL SERVER 2005 TABLE, WHICH HAS A IDENTITY COLUMN

    Hi All,
    I have to insert the data into a SQL SERVER 2005 Database table.
    I am able to insert the data into a normal SQL Server table.
    When I am trying to insert the data into a SQL Server table, which has a identity column (i.e. auto increment column in Oracle) I am getting error saying that can't insert value explicitly when IDENTITY_INSERT is set to OFF.
    Had anybody tried this??
    There are some SRs on this issue, Oracle agreed that it is a bug. I am wondering if there is any workaround from any one of you (refer Insert in MS-SQL database table with IDENTITY COLUMN
    Thanks
    V Kumar

    Even I had raised a SR on this in October 2008. But didn't get any solution for a long time, finally I had removed the identity column from the table. I can't to that now :).
    I am using 10.1.3.3.0 and MS SQL SERVER 2005, They said it is working for MS SQL SERVER TABLE, if the identity column is not a primary key and asked me to refer to note 744735.1.
    I had followed that note, but still it is not working for me.
    But my requirement is it should work for a MS SQL SERVER 2005 table, which has identity column as primary key.
    Thanks
    V Kumar

  • Need to make a copy/clone of a table which has sdo_geometry data type

    Folks,
    We are running Oracle 11gr1 on Suse Linux platform.
    We have a requirement, where we need to make a copy of a table, in the same database but in a difference schema, the source table has about 130 millions rows and also has the sdo_getometry data type.
    I tried materialized view, but MV does not support sdo_geometry data type.
    According to one of my DBAs, doing it via data pump , will take few days, which is not acceptable.
    Is there a way, we can make a copy of this table in the same db ?
    Thanks
    Ashish

    Siva,
    This is not for backup purpose.
    Here is the background information on this requirement.
    I need to have a static copy of a table, which has spatial column, sdo_geometry in it.
    So we can run another application against this table, just read-only, since we need static data, data in the source table changes quite often.
    One of my DBA suggested to have another instance/database, to keep the copy of the source table, I thought idea of having another database just to keep a copy of a table is an over kill.
    That is why I had asked this question and you had provided a viable solution.
    Then we need to refresh this table , with the data (changes) from the source table, maybe once in 2- 3 weeks.
    I tried creating a Materialized view, but it does not support Spatial columns.
    So now I am trying to figure out, the most efficient way to refresh the clone table from the source table.
    Regards,
    Ashish

  • How to find tables which has more than 1000 Partitions

    Hi All,
    Is there any other way to find out the tables which has more than 1000 Partitions ?
    Apart from SAP report RSDD_MSSQL_CUBEANALYZE. Because this report is not working for me as job getting cancel again and again with ABAP dump DBIF_DSQL2_SQL.I already check SAP Note 1309838, but itu2019s not applicable for us because we are on highest support package level SAP_BW 701 SP06.
    Thanks,
    Harshal

    If you are running SQL Server as your database platform run this query:
    select o.object_id,o.name,p.Partition_count from sys.objects o
    inner join
    (select object_id,count(distinct partition_number) as Partition_count
    from sys.partitions
    group by object_id)
    p
    on o.object_id = p.object_id
    where o.type = 'U'
    order by p.Partition_count desc

  • To select table which has TAB as data column with in

    Hi All
    I have a table which has column type defined as TAB type. When I try selecting the table in PL/SQL developer, I got below error.
    What should I do? Even SQL* Plus shows the same error!
    SQL> select *
      2  from my_tab_cap
      3  /
    from my_tab_cap
    ERROR at line 2:
    ORA-00904: : invalid identifierThanks in advance.
    Message was edited by:
    guru paran
    Changed the table name.

    You probably want to help us out with all your ddl:
    create table tab2 (my_tab_col my_type ) nested table my_tab_col store as my_tab;
    create type my_type as table of varchar2(100);
    declare
    v_type my_type := my_type();
    begin
    v_type.extend(4);
    v_type(1) := 'I like table types1';
    v_type(2) := 'I like table types2';
    v_type(3) := 'I like table types3';
    v_type(4) := 'I like table types4';
    insert into tab2(my_tab_col) values (v_type);
    end;
    select * from tab2;
    MY_TAB_COL                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
    VARCHAR(I like table types1,I like table types2,I like table types3,I like table types4)     

  • How to find table which has no index?

    Hi,
    How to find a table which has no index?
    Please provide the query to find the above.
    Thanks
    Jafar

    select owner,
           table_name
      from dba_tables dt
    where not exists(select 'x'
                        from dba_indexes di
                       where dt.owner=di.table_owner
                         and dt.table_name = di.table_name)

  • How to update table which has column name as Oracle keyword?

    Hi All,
    Somebody has created one table which has column name as "OPTION", now i am trying update this table column value and its throwing an error. "Invalid Identifier".
    Could you please help me in this?
    Thanks in advance.
    Regards,
    Ganesh Patil

    check this :
    batch@DOLN1> create table "from" ("select" varchar2(10));
    Table created.
    batch@DOLN1> desc "from";
    Name                                                                                                  Null?    Type
    select                                                                                                         VARCHAR2(10)
    batch@DOLN1> update "from" set "select" = 'hello World';
    0 rows updated.
    batch@DOLN1> insert into "from" values('hello World');
    insert into "from" values('hello World')
    ERROR at line 1:
    ORA-12899: value too large for column "TCM_BATCH"."from"."select" (actual: 11, maximum: 10)
    batch@DOLN1> update "from" set "select" = 'hello';
    0 rows updated.
    batch@DOLN1> insert into "from" values('hello');
    1 row created.
    batch@DOLN1> commit;
    Commit complete.
    batch@DOLN1> update "from" set "select" = 'World' where "select" = 'hello';
    1 row updated.
    batch@DOLN1> select * from "from";
    select
    World

  • Delete records from tableA which are not in tableB

    Table A contains milions of records which is the best way to delete records from tableA which are not in tableB
    delete from tableA where empno not in (select empno from tableb)
    or
    delete from tableA where empno not exists (select empno from tableb
    where b.empno=a.empno)
    any help

    Hi
    If you can do this, do with this:
    create table tableC
    as select a.*
    from tableA a,
    (select empno from tableA
    minus
    select empno from tableB) b
    where a.empno = b.empno;
    drop table tableA;
    rename table tableC to tableA;
    Ott Karesz
    http://www.trendo-kft.hu

  • Output from tables which I mention in select options of the screen as input

    Dear All,
    I want to fetch the data in the form of output from tables which I will mention in select options of the screen as input.
    In selection screen option if I write any table name then how can i select this table in select query of ABAP program ?.
    I may select any tables in select options of screen. But In select query I should get that table name automatically.. How ?
    e.g. If i put table name as an input i.e.  MARA  in select option .
    In program how to write select query to get records from that table ?
    SELECT MTART MATKL from MARA
    Every time I should not go to select query of program  & replace the tablename.
    How to solve this problem ?

    Hi,
    PARAMETERS p_table(30)." type string.
    "This is a Tested code Just Execute and Check
    START-OF-SELECTION.
      DATA: lt_tmp TYPE REF TO data.
      DATA : line TYPE REF TO data.
      FIELD-SYMBOLS: <lt_tmp> TYPE STANDARD TABLE, <wa>, <dyn_field>.
      CREATE DATA lt_tmp TYPE STANDARD TABLE OF (p_table).
      ASSIGN lt_tmp->* TO <lt_tmp> .
      CREATE DATA line LIKE LINE OF <lt_tmp>.
      ASSIGN line->* TO <wa>.
      SELECT * FROM (p_table) INTO TABLE <lt_tmp>.
      IF sy-subrc = 0.
        LOOP AT <lt_tmp> ASSIGNING <wa>.
          DO.
            ASSIGN COMPONENT  sy-index
               OF STRUCTURE <wa> TO <dyn_field>.
            IF sy-subrc NE 0.
              EXIT.
            ENDIF.
            IF sy-index = 1.
              WRITE:/ <dyn_field>.
            ELSE.
              WRITE: <dyn_field>.
            ENDIF.
          ENDDO.
        ENDLOOP.
      ENDIF.
    Cheerz
    Ram

  • I downloaded a song (Matt Corby Winter) from itunes which has disapeared from my computer.  I have followed the instructions to locate it but haven't been able to.  I need to download it again from itunes.  How do I do this?

    I downloaded a song (Matt Corby Winter) from itunes which has disapeared from my computer.  I have followed the instructions to locate it but haven't been able to.  I need to download it again from itunes.  How do I do this?

    A simple search finds this article:
    Download past purchases - Apple Support

  • Ive deleted movies from itunes which has removed them from apple tv, i still have them on my ipad, is there any way i can get them back into itunes?

    ive deleted movies from itunes which has removed them from apple tv, i still have them on my ipad, is there any way i can get them back into itunes?

    If the movies were rentals then no.
    If the movies are purchases and you have the iTunes 10.4 then you should be able to access the 'cloud' option from in the main iTunes page  - purchases - (upper right corner) and go from there.
    You should also have the option to transfer purchases from the iPad back into iTunes. I don't have an iPad but you can transfer purchases from the iPod/iPhone back to iTunes.
    MJ

  • I really need help. I try to contact support to no avail. There simply is no option on the site, You are always referred to a further topic which has notihing to do with my problem. I bougnt a full master pack CS6 which I had installed on a mac for one ye

    I really need help. I try to contact support to no avail. There simply is no option on the site, You are always referred to a further topic which has notihing to do with my problem. I bougnt a full master pack CS6 which I had installed on a mac for one year. Then, I decided to change it to another computer, so I sisintalled it according to instructions. In the meantime I got a free trial of creative cloud on that computer, but I gave up and decided to reinstall my cd-roms. However, everytime I try to use acrobat for instance it says that my trial period ran out! I disinstalled my cloud products, I am using my registered full master series items, they have nothing whatsoever to do with my creative cloud FREE subscription. If I try to cancel my free membership, it is to no avail, there simply is no such possiblity. I want to use the software I paid dearly for, not the cloud items I disinstalled and which do not interest me. How can I contact Adobe to fix it? It was no fault of mine, I did all I was supposed to, disintalling items before installing the right ones, but the system must have some error i am not responsible for.

    open an app and click help>activate.
    if you try to open an app and see a 'your trial has expired" window, click license this software and enter your serial number.
    if you can't do either, run the cleaner and make sure cc is cleaned from your computer, Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6

  • Hideing a Column in ALV Table which is Displaying the POWL Query data

    Hi SDNers,
    I want to hide a column of ALV Table which is displaying my POWL Query data in it and hideing should be based on the Role as well. i.e few of the role the column shoudl be hidden and few of the roles should have the Column visible.
    waiting for the Valueble Answers.
    Thanks & Regards,
    Govindu

    Hai Kris,
        I took help from ur link and i declared a global attribute request_number.
    and i created an event handler ON_ALV_INSERT and did the follwing coding for giving default value wen ever am inserting new row.
    FIELD-SYMBOLS: <wa_row> LIKE LINE OF r_param->t_inserted_rows.
      DATA bill_details TYPE REF TO zdom_bill_detail.
      LOOP AT r_param->t_inserted_rows ASSIGNING <wa_row>.
        bill_details ?= <wa_row>-r_value.
        IF bill_details->REQ_NUMBER IS INITIAL.
      DATA lo_nd_bill_detail TYPE REF TO if_wd_context_node.
      DATA lo_el_bill_detail TYPE REF TO if_wd_context_element.
      DATA ls_bill_detail TYPE wd_this->Element_bill_detail.
    navigate from <CONTEXT> to <BILL_DETAIL> via lead selection
      lo_nd_bill_detail = wd_context->get_child_node( name = wd_this->wdctx_bill_detail ).
    lo_el_bill_detail = lo_nd_bill_detail->get_element( index = <wa_row>-index ).
          lo_el_bill_detail->set_attribute(
            EXPORTING
              name  = 'REQ_NUMBER'
              value = wd_comp_controller->request_number
    Wen am  setting the value of wd_comp_controller->request_number to my context attribute am getting NULL object ref error.
    lo_el_bill_detail->set_attribute(
        name =  `REQ_NUMBER`
        value = wd_comp_controller->request_number ).
    Pls give some suggestions,
    Thanks in Advance,
    Nalla.B

  • I have a brand new 8gb iPod touch 4g which has 0.43gb of other data right out of the box.

    I have a brand new 8gb iPod touch 4g which has 0.43gb of other data before I've even put anything on it.I appreciate the OS takes up about 1.5gb, but this is in addition to that. There is absolutely nothing on the iPod and I've already done a factory reset.
    The amount of yellow "other" data seems to go up and down if I click sync (although it is not syncing anything). There is no other data on the device. Is this normal?

    That is about right.  Normally it is about 1/2 GB.  If can grow because of corrupt files.  Then it is necessary to restore the iPod sometimes from backup works but sometimes a restore to factory defaults/new iPod is required.  The other is made of ite items that do not fit the other categories listed.

Maybe you are looking for

  • How to import a class not in the package from a package

    how to import a class not in the package from a package?

  • Syncing Notes 'On My Mac' to iPhone/iPad no longer possible...??

    Since moving to Mountain Lion i am no longer able to sync notes that are 'on my mac' to my iphone/ipad.  This used to be controlled by iTunes (you simply check the box or don't).  This has worked as it should from from the beginning of itunes syncing

  • Issue in Excel to XML Conversion

    Hi Gurus, I am creating a custom java module in sap nwds 7.3 for Excel to XML Conversion. But I am getting following error Classpath dependency validator message. Classpath entry  will not be exported or published. Runtime ClassNotFoundExceptions may

  • ACS 4.2 trial ver installation problem

    Hi, I have been searching the net for quite some time, for what it could be the reason why the admin page on http://127.0.0.1:2002 do not open, after successfully installed the ACS 4.2 on Win-2003 SP1. I did installed Java 6.0 and the two JRE patches

  • Home Movies not looking HD?

    Hello All, Here is my breakdown: iMac Canon HV20 HD camcorder imovie 08 50" Panasonic Plasma When i publish out of imovie to Apple TV(large file) then watch the home movie on Apple TV it does not look well, i see banding in flat areas....renting HD m