Select Distinct Fields from non related table

Hi Experts,
I have to fetch Distinct Fields from table zdcxy along with the fields from the table zvend but there is no primary key forigen key relationship also if I wanted use join condition. I need to move fields from both the table into output file and 1 part I implemented but I am unable to do second part plz any body can help me its argent. below I pasted part of code along with two requirements.
1.Select all data (Location - LIFNR, Descr u2013 ZPLTNAMEC, CJI_CUSTOMER u2013 CJI customer flag) from ZVEND table.
2.Select all distinct DCs and BUs from zdcxy table.
SELECT * FROM ZVENDPLT INTO CORRESPONDING FIELDS OF TABLE IT_VENDPLT.
*select distinct zdc from zdcxy into corresponding fields of table it_map.
*select distinct zbu from zdcxy into corresponding fields of table it_map.
  IF SY-SUBRC  = 0.
    LOOP AT IT_VEND.
      MOVE :  IT_VENDPLT-LIFNR              TO IT_TAB-FIELD1,
              IT_VENDPLT-ZPLTNAMEC          TO IT_TAB-FIELD2,
              IT_VENDPLT-CJI_CUSTOMER       TO IT_TAB-FIELD3,
       CONCATENATE :IiT_TAB-FIELD1   IT_TAB-FIELD2   IT_TAB-FIELD3   IT_TAB-FIELD4
INTO IT_LOAD-RECORD SEPARATED BY SEPARATOR.
      TRANSFER IT_LOAD TO OUT_FILE.
ENDLOOP.
Can any body explain me hw to fetch DC and Bu from the table zdcxy and keep in the same loop of   it_vend.
Second thing is that I need to give information about records into second output file hw to do that means I opened one more file and I am unable to move the record history there plz help me.
Thanks in advance

Plz any body can help me it's argent.
Thanks
Basu

Similar Messages

  • Generate xml from non-relational table

    Hi
    I would like to create hierarchical xml from non-relational table as below, can anybody share some idea?
    I have tried the XMLAgg/XmlElement and could not get the desired result. Any help would be greately appreciated.
    create table testing
    ( super_cat varchar2(30)
    , normal_cat varchar2(30)
    , sub_cat varchar2(30)
    , detail varchar2(30));
    CREATE UNIQUE INDEX IDX_TESTING ON TESTING(SUPER_CAT,NORMAL_CAT,SUB_CAT);
    insert into testing values ('SUPER_A','NORMAL_A','SUB_A', 'DETAIL1');
    insert into testing values ('SUPER_A','NORMAL_A','SUB_B', 'DETAIL2');
    insert into testing values ('SUPER_A','NORMAL_B','SUB_A', 'DETAIL3');
    insert into testing values ('SUPER_A','NORMAL_B','SUB_B', 'DETAIL4');
    COMMIT;The result should be like :
    <Document>
    <SuperCategory>
    <SuperCategoryName>SUPER_A</SuperCategoryName>
    <NormalCategory>
    <NormalCategoryName>NORMAL_A</NormalCategoryName>
    <SubCategory>
    <SubCategoryName>SUB_A</SubCategoryName>
    <ResultDetail><Detail>DETAIL1</Detail></ResultDetail>
    </SubCategory>
    <SubCategory>
    <SubCategoryName>SUB_B</SubCategoryName>
    <ResultDetail><Detail>DETAIL2</Detail></ResultDetail>
    </SubCategory>
    </NormalCategory>
    <NormalCategory>
    <NormalCategoryName>NORMAL_B</NormalCategoryName>
    <SubCategory>
    <SubCategoryName>SUB_A</SubCategoryName>
    <ResultDetail><Detail>DETAIL3</Detail></ResultDetail>
    </SubCategory>
    <SubCategory>
    <SubCategoryName>SUB_B</SubCategoryName>
    <ResultDetail><Detail>DETAIL4</Detail></ResultDetail>
    </SubCategory>
    </NormalCategory>
    </SuperCategory>
    </Document>

    user563940 wrote:
    Hi
    I would like to create hierarchical xml from non-relational table as below, can anybody share some idea?
    I have tried the XMLAgg/XmlElement and could not get the desired result. Any help would be greately appreciated.I think you should be able to achieve this with the addition of XMLFOREST.
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions244.htm#SQLRF06169

  • Select distinct (field) from [@tab]

    Hello,
    *i tried select with distinct query in SDK but it id not working... how we will use this functionality in SDK but same query
    working fine in SQL server*
    By
    Firos.C

    Why can we not use DISTINCT?
    Rune

  • Need of SQL query in selecting distinct values from two tables

    hi,
    I need a query for selecting distinct values from two tables with one condition.
    for eg:
    there are two tables a & b.
    in table a there are values like age,sex,name,empno and in table b valuses are such as age,salary,DOJ,empno.
    here what i need is with the help of empno as unique field,i need to select distinct values from two tables (ie) except age.
    can anybody please help me.
    Thanks in advance,
    Ratheesh

    Not sure what you mean either, but perhaps this will start a dialog:
    SELECT DISTINCT a.empno,
                    a.name,
                    a.sex,
                    b.salary,
                    b.doj
    FROM    a,
            b
    WHERE   a.empno = b.empno;Greg

  • How to compare two fields from the same table in the select statement

    Hi, friends
    I try to compare tow fields from the same table, but no result,
    For example, this
    data: cptotchek tyep i.
    select count(*) into cptotchek
    from aufk where erdat = aufk-idat2 .
    The result is  cptotchek = 0, but there are the records in aufk , where,  aufk-erdat = aufk-idat2.
    Please, help me, i don't use the loop statement for optimize my program.
    Regards

    Hi  ,
           it will not return  any value   when you are using   column of same table 
           such as Date Field   , Because  while Using Aggregate Function  it will not check with self column
    .      For that you have to take data in one internal table and then you can work on it  .
         And if you are worried about Performance  it will not affect  , untill you are selecting only required data  .
    you can try this way  .
    data: cptotchek type i.
    types : begin of  w_aufk.
            include structure aufk  .
          types : end of  w_aufk .
    data : it_aufk type standard table of w_aufk with header line  .
    select * into corresponding fields of table it_aufk
    from aufk  .
    loop at it_aufk .
    if it_aufk-erdat  = it_aufk-idat2 .
    write : / it_aufk-erdat , it_aufk-idat2 .
    else .
    delete it_aufk .
    endif  .
    endloop.
    Regards
    Deepak.

  • Urgent......  how to select few fields, from database table, (dynamic ita.)

    Dear all experts,
    I am able to populate all fields data from database table, using dynamic table creation.
    eg,
    SELECT *    FROM (w_tabname)    INTO    TABLE <t_itab>.
    where w_tabname is the table name given by the user, and t_itab is field symbol.
    but some requirement is like that i need to pick up only few fields, <b>which user will give at the runtime.</b>
    <b>I can</b> take those fields from file into any internal table,
    but the problem is that instead of <b>select *</b>, i need to put selected the fields given by user.
    i have tried with field symbol, it is not working (as per my knowledge.)
    do i need to create any structures dynamically ?
    Can anybody please help in this regards ?
    Your help will be surely rewarded with points.
    Waiting for reply..
    Regards
    Vinay

    Hi Vinay ,
    Adding to the below code , you can use some more fields in the select stmt as below:-
    REPORT ychatest.
    PARAMETERS : p_field1 LIKE dd03l-fieldname,
                             P_field2 LIKE dd03l-fieldname,
                             p_table LIKE dd03l-tabname.
    FIELD-SYMBOLS : <fs> TYPE STANDARD TABLE.
    SELECT (p_field1) (p_field2) ( FROM (p_table) INTO TABLE <fs>.
    Now p_field1 & p_field2  belong to the same table since you have give the user to enter only one table name.
    This should work fine.
    please try & let me know .
    Thanks & Regards,
    Daniel

  • Selecting desired fields from extract structure to datasource in CRM

    hi guys... coming back to this forum with new problem...
    how are you guys...
    i'm using ds 0CRM_SALES_ACT_1 in CRM to extract activities related data...
    by standard this data source is not supplying some fields which i needed... but when i checked in 'roosfield' table and even in extract structure 'CRMT_BW_DS_ACTIVITY' it is showing the those fields which i required...
    how can i get these fields to data source...
    in LO its like...we can select required field from extract sturcture right???
    is there any procedure do same with CRM data sources...
    thnaking you...
    regards...
    nithin
    Message was edited by: nith l

    Hi,
    If the fields are available in ES but not available in DS , then we can Modify the table ROOSFIELD. But, I think, this is some what rude mothod.
    Before doing this, It is better to Raise a OSS. They may come out with some SP upgradation.
    Search this forum with ROOSFIELD.
    With rgds,
    Anil Kumar Sharma .P

  • How to select alternate entries from the database table

    Hi Experts,
    can u help me, how to select alternate entries from the database table.
    Thanks

    As there is no concept of sequence (unless there is a field specifically included for the purpose), there is no meaning to "alternate" records.
    What table do you have in mind, what data does it hold, and why do you want alternate records?
    matt

  • Select MAX(BUDAT) from ztab (custom table) where... NOT work!

    We use the following statement where BUDAT is one of the fields in our custom table ztab:
    Select MAX(BUDAT) from ztab (custom table) where...
    When activating the above code, get the following error:
    "Unknown column name "MAX(BUDAT)". not determined until runtime, you cannot specify a field list."
    How to resolve this problem to get a max value of the field BUDAT in custom table ztab (it's not an internal table)?
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Apr 10, 2008 3:56 PM

    HI,
    Tyr having a space after and before BUDAT.
    ( BUDAT ).
    Hope it helps,
    Shreekant

  • How to join  fields from different internal tables and display into one int

    hai i have one doubt...
    how to join  fields from different internal tables and display into one internal table..
    if anybody know the ans for this qus tell me......

    hii
    you can read data as per condition and then can join in one internal table using READ and APPEND statement..refer to following code.
    SELECT bwkey                         " Valuation Area
             bukrs                         " Company Code
        FROM t001k
        INTO TABLE i_t001k
       WHERE bukrs IN s_bukrs.
      IF sy-subrc EQ 0.
        SELECT bwkey                       " Valuation Area
               werks                       " Plant
          FROM t001w
          INTO TABLE i_t001w
           FOR ALL ENTRIES IN i_t001k
         WHERE bwkey = i_t001k-bwkey
           AND werks IN s_werks.
        IF sy-subrc EQ 0.
          LOOP AT i_output INTO wa_output.
            READ TABLE i_t001w INTO wa_t001w WITH KEY werks = wa_output-werks.
            READ TABLE i_t001k INTO wa_t001k WITH KEY bwkey = wa_t001w-bwkey.
            wa_output-bukrs = wa_t001k-bukrs.
            MODIFY i_output FROM wa_output.
            CLEAR wa_output.
          ENDLOOP.                         " LOOP AT i_output
        ENDIF.                             " IF sy-subrc EQ 0
    regards
    twinkal

  • Column alias to select all fields in only one table in a join

    Hi,
    Please can you tell me if it is possible to use something like "SELECT a*" to select all fields in table a when using a join to join 2 tables e.g a and b? Instead of using "select acomlumn1 acomlumn2 acomlumn3" etc.
    Thanks and Regards.

    HI,
    It is not possible... You have to specify all the fields you want to select with the tilde '~' symbol...
    or,
    The other solution can be to fetch all the fields from the first table and use 'For all entries' of this table to fetch all fields from the other table...
    Edited by: sneha singhania on Jun 23, 2009 3:01 PM

  • Illegal selection by InfoObject from outer join table

    Hi all,
    in any infoset with left-outer-join, when i want to select any field (infoobject) to get exlude conditions i got these errors:
    illegal selection by InfoObject from outer join table.
    error reading the data of infoprovider '*'.
    thanks in advance .
    HS

    Hi Dorota,
    Choudhary S was right.
    İ have notified the SAP about this issue..they wrote me below note :
    As SAP tables have no concept for NULL, we
    have to restrict this condition to not allow excluding condition to be
    used any more. But alternatively, you could use including to replace it.
    Please check my last reply to see the detailed reason for it, and
    this explaination is from our development colleagues.
    For this note 1435772, you could also see why this error message
    arises.
    So, they said it is not possible in case of left outer join after those patches.
    i just used  include to replace that exluding condition.it takes little time but the problem is solving.
    Thanks
    HS

  • Move data from Non Partitioned Table to Partitioned Table

    Hi Friends,
    I am using Oracle 11.2.0.1 DB
    Please let me know how can i copy /move the data from Non -Partitioned Oracle table to the currently created Partiotioned table.
    Regards,
    DB

    839396 wrote:
    Hi All,
    Created Partitioned table but unable to copy the data from Non Partitioned table:
    SQL> select * from sales;
    SNO YEAR NAME
    1 01-JAN-11 jan2011
    1 01-FEB-11 feb2011
    1 01-JAN-12 jan2012
    1 01-FEB-12 feb2012
    1 01-JAN-13 jan2013
    1 01-FEB-13 feb2013into which partition should row immediately above ("01-FEB-13") be deposited?
    [oracle@localhost ~]$ oerr  ora 14400
    14400, 00000, "inserted partition key does not map to any partition"
    // *Cause:  An attempt was made to insert a record into, a Range or Composite
    //          Range object, with a concatenated partition key that is beyond
    //          the concatenated partition bound list of the last partition -OR-
    //          An attempt was made to insert a record into a List object with
    //          a partition key that did not match the literal values specified
    //          for any of the partitions.
    // *Action: Do not insert the key. Or, add a partition capable of accepting
    //          the key, Or add values matching the key to a partition specification>
    6 rows selected.
    >
    SQL>
    SQL> create table sales_part(sno number(3),year date,name varchar2(10))
    2 partition by range(year)
    3 (
    4 partition p11 values less than (TO_DATE('01/JAN/2012','DD/MON/YYYY')),
    5 partition p12 values less than (TO_DATE('01/JAN/2013','DD/MON/YYYY'))
    6 );
    Table created.
    SQL> SELECT table_name,partition_name, num_rows FROM user_tab_partitions;
    TABLE_NAME PARTITION_NAME NUM_ROWS
    SALES_PART P11
    SALES_PART P12
    UNPAR_TABLE UNPAR_TABLE_12 776000
    UNPAR_TABLE UNPAR_TABLE_15 5000
    UNPAR_TABLE UNPAR_TABLE_MX 220000
    SQL>
    SQL> insert into sales_part select * from sales;
    insert into sales_part select * from sales
    ERROR at line 1:
    ORA-14400: inserted partition key does not map to any partition
    Regards,
    DB

  • Extract a value of a fields from an internal table

    hello everyone,
    i need to extract a value of a fields from an internal table, the fields is in a postion "sy-tabix" that i know, so i need to pick this value without using a loop
    thank you.

    Like this?
    DATA: FIELD1 TYPE C,
               FIELD2 TYPE C.
    READ TABLE T_TAB INDEX 3.
    FIELD1 = T_TAB-FIELD1.
    FIELD2 = T_TAB-FIELD2.
    Greetings,
    Blag.

  • Displaying fields from a Z Table on CRM UI

    Hello Experts
    I am trying to display fields from a custom table onto a CRM UI form view.
    1. I created a custom GENIL root object & Search object ie. ZCUSTOMER. & ZCUSTSEARCH
    2. Tested this in the GENIL BROWSER to ensure that I could enter update values to the table and retrieve it via the search object.
    3. Created a custom component ZCUSTOMER
    4. Created a view with this component ZCUSTOMER using the wizard -
         Model Name - CUSTINFO
         BOL Entity - ZCUSTOMER
         No links to the custom controller or higher level objects.(as I do not want to tie this to any standard components)
    Type of view - Form view
    7. Created a Context node for the component controller with the same info as I did for the view.
    8. Performed the binding of the view context node with the component controller context node.
    9. Configured 1 field CUST_NAME to be displayed on the view.
    10. Configured the run time repository to display the view.
    Now the issue is..
    When the view gets displayed, the field is displayed with the error "CUST_NAME not bound"
    What am i missing?
    Thanks
    RLX

    Hi Swati,
    Thanks for the feedback. I re-viewed the WD_CREATE_CONTEXT method of the view controller implementation class and I see the following code in there already-
    method WD_CREATE_CONTEXT.
      create the context
        context = cl_bsp_wd_context=>get_instance(
              iv_controller = me
              iv_type = 'ZL_ZCUSTOMER_BSPWDCOMPONEN_CTXT' ).
        typed_context ?= context.
    endmethod.
    Does that look right or do I need to modify it?
    Thanks once again for the help.
    RLX

Maybe you are looking for

  • Lookup API - SPRAS value returned is not correct

    Hi All We are using the lookup API of XI to make a lookup in the SAP system and return values such as LAND1, and SPRAS. SPRAS has 2 kindoff value, one is the display value which is a 2 character value, and then the actual value which is a single char

  • Same work center  being used  in different routings

    Hi I have requirement  like this: Workcenter  WC1  works in two shifts  Shist A  & B. It is being used in two routings for different products  X & Y. Product X will be prodiced in shift A. Product Y will be produced in Shift B. How to schedule it  fo

  • ST22 Dumps in ECC pushed to Slution Manager

    Hi, We have a ECC6.0 and Solution Manager in our system. I wanted to configure that if a ST22 Dump occurs in ECC 6.0, the ST22 dump should be pused to the Solution Manager and i should be able to view it through the Solution Manager. Please let me kn

  • How do I center the whole slide in navigator view?

    New to iwork 08...how do I center the whole slide in navigator view (large pane)? The top and left edges do not show. Probably a simple answer but cannot find out how. Thanks. JM

  • I want to see the files which i was already selected

    From the files selcetion, i did not see how big the size which i was already selected Is there any place to see it properly?