Combining colums in a table
I was wondering if there was a way to combing two columns in data integrator. What I mean is in my database I have a column for 1st name and last name. But when I sent this to xml I have to have the 1st name and last name on the same line (or in the same field on the XML) is there a way I can do this?
Greetings Post Originator,
This post is older than 60 days and there are no entries in the past 30 days. Based on the content discussed, it appears that you question has been answered. This message is being marked as answered and points are being assigned if available where possible.
Thank you for being an active participant in the SAP Forums,
Rob Siegele
Forum Moderator
SAP Americas
Similar Messages
-
How to add a feild as key combination for existing condition table
Hi all,
please any body can inform me about how to add a feild as key combination for existing condition table ex 901 having the key combination of sales organisation and material
for this cond. table,how to add a new feild ex:price list
iam unable to add it in change mode of v/03.(even after removing this 901 table from Acc.seq.)
Edited by: rajendraprasad vasam on Apr 25, 2008 10:08 AMmr.Rajendra
I you have the access key - you can copy the 901 table and create a new table along with your required field. v/03
Or
in the access sequence for the condition type - add 1 more step and add your field.
ie 10 - 901
and in 20 - your required field
regards,
Reshmi
Edited by: reshmi bhaskar on Apr 25, 2008 10:21 AM -
How to create unique combined fields in Qual table
Furhther clarification of my prev question:
Can I make a unique combined field for a Qualified table. If so how?
How the unique field option for combine fields in Main table can be enabled?
This is for MDM5.5 sp4
Thanks in advance for the help
-reoHi,
Please go through this link,
http://wiki.sdn.sap.com/wiki/display/ABAP/CreationofView+Cluster
Hope it helps you,
Regards,
Abhijit G. Borkar -
URGENT:HOW TO COMBINE CLUSTER AND TRANSPARENT TABLE..WITHOUT USING FOR ALL
how can we join bkpf and bseg without using FOR ALL ENTRIES.HOW DO I COMBINE THE 2 TABLES SO THAT I GET BETTER PERFORMANCE.
START-OF-SELECTION.
SELECT bukrs belnr gjahr budat FROM bkpf INTO TABLE i_bkpf
WHERE bukrs = p_bukrs AND "COMPANY CODE
gjahr = p_gjahr AND "FISCAL YEAR
budat IN s_budat. "POSTING DATE IN DOC
IF sy-subrc = 0.
SELECT bukrs belnr gjahr hkont shkzg dmbtr FROM bseg INTO TABLE
i_bseg FOR ALL ENTRIES IN i_bkpf
WHERE bukrs = i_bkpf-bukrs AND "COMPANY CODE
belnr = i_bkpf-belnr AND "A/CING DOC NO
gjahr = i_bkpf-gjahr AND "FISCAL YEAR
hkont = p_hkont. "General Ledger Account"
IF sy-subrc = 0.
SELECT bukrs belnr gjahr hkont shkzg dmbtr FROM bseg INTO TABLE
i_bseg1 FOR ALL ENTRIES IN i_bseg
WHERE bukrs = i_bseg-bukrs AND "COMPANY CODE
belnr = i_bseg-belnr AND "A/CING DOC NO
gjahr = i_bseg-gjahr. "FISCAL YEAR
ENDIF.
ENDIF.
IF NOT i_bseg1[] IS INITIAL.
LOOP AT i_bseg1.
IF i_bseg1-hkont = p_hkont AND i_bseg1-shkzg = 'S'.
v_sumgl = v_sumgl + i_bseg1-dmbtr.
ELSEIF i_bseg1-hkont = p_hkont AND i_bseg1-shkzg = 'H'.
v_sumgl = v_sumgl - i_bseg1-dmbtr.
ELSEIF i_bseg1-hkont NE p_hkont .
IF i_bseg1-shkzg = 'H'.
i_bseg1-dmbtr = - i_bseg1-dmbtr.
ENDIF.
i_alv-hkont = i_bseg1-hkont.
i_alv-dmbtr = i_bseg1-dmbtr.
APPEND i_alv.
v_sumoffset = v_sumoffset + i_bseg1-dmbtr.
ENDIF.
ENDLOOP.
regards
Essam.([email protected])Hi Friend,
I see your code.. there is no other way than using for all entries for your situation.. how ever i saw ur code and a small recommandation in the change of code.
SELECT bukrs belnr gjahr budat FROM bkpf INTO TABLE i_bkpf
WHERE bukrs = p_bukrs AND "COMPANY CODE
gjahr = p_gjahr AND "FISCAL YEAR
budat IN s_budat. "POSTING DATE IN DOC
IF sy-subrc = 0.
if not p_hkont is initial.
SELECT bukrs belnr gjahr hkont shkzg dmbtr FROM bseg INTO TABLE
i_bseg1 FOR ALL ENTRIES IN i_bkpf
WHERE bukrs = i_bseg-bukrs AND "COMPANY CODE
belnr = i_bseg-belnr AND "A/CING DOC NO
gjahr = i_bseg-gjahr. "FISCAL YEAR
ENDIF.
i_bseg[] = i_bseg[]1.
delete i_bseg where hkont ne p_hkont.
else.
Your existing logic...
endif.
In this way you can avoide writing two selects on bseg..
Thanks
Mahesh -
Importing Key Combinations of a Lookup table.
Hi, I have created a lookup table which is equivalent to a check table in R3. For example table named, SPT (Special Procurement Type), Which has a key combination (Composite Keys) in R3 itself and the keys are Plant + Procurement Type and so in MDM Look table both keys are defined as display fields. The problem comes in automating the import. In IM source, both key fields are separate fields, I tried combining the field using Partion, but Automap is not working and so the import automation process. Any thoughts/advices on tackling this issue is appreciated.
Thanks
Job.Hi Job,
IF u combine the fields in partition and then if try to do value mapping automatically,then it is not possible .There u have to map manualy .Automap in value mapping can be done only when values are not combination but single.
Like
Source----
Destination
abc----
<null>
def----
abc
xyz----
def
xyz
But if it is like:
Source----
Destination
abc,12----
<null>
def,23 -
abc,12
def,23
in above case it is a combination so not possible.
I hope u im able to make u understand.
If this has helped u then do Reward points.
Regards,
Neethu Joy
Edited by: Neethu joy on Dec 31, 2007 3:17 PM
Edited by: Neethu joy on Dec 31, 2007 3:19 PM
Edited by: Neethu joy on Dec 31, 2007 3:24 PM -
Interchanging rows and colums of internal table
Hi all,
I have one requirement to interchange the rows and colums of 3X3 internal table.(internal table contains 3 rows and 3 columns ). In the new internal table, I have to display the rows as column values and column values as rows..
It's urgently. Kindly send me the sample code for the same.
Thanks in advance.
Ramesh.Hi ramesh,
it is not possible to create a 'transponed' internal table if the (2) fields in your table arte or different type. Thus each row of the new table would be of different type.
The quick solution for display is
field-symbols:
<any> type any.
do.
loop at itab.
assign component sy-index of structure itab to <any>.
if sy-subrc <> 0.
* not assigned means no more components
exit.
endif.
write <any>.
endloop.
if sy-subrc = 0.
* start a new line for the next field
write /.
else.
* all done
exit.
endif.
enddo.
If you really want to store the values in transposes table, you could do so by storing their references in fields of type REF TO DATA because this is good for any data.
possible usage:
types:
ty_t_reftab type standard table of ref to data with default key,
ty_t_transposed type standard table of ty_t_reftab with default key.
data:
lt_transposed type ty_t_transposed,
lv_ref type ref to data.
field-symbols:
<any> type any,
<transposed> type line of ty_t_transposed
do.
loop at itab.
at first.
append initial line to lt_transposed assigning <transposed>.
endat.
assign component sy-index of structure itab to <any>.
if sy-subrc <> 0.
* not assigned means no more components
exit.
endif.
get refernce of <any> into lv_ref.
append lv_ref to <transposed>.
endloop.
if sy-subrc <> 0.
* all done
exit.
endif.
enddo.
read table
Sorry, don't know what it's good for. If you need the values, access them like
loop at lt_transposed assigning <transposed>.
loop at <transposed> assigning <any>.
write <any>->*. "Hope that works with WRITE
endloop.
endloop.
Regards,
Clemens -
Hi, i am trying to compare colums in the same tables.
The sql that i am using is as below.
select a.parttypeid,a.makerref,a.partname,b.parttypeid,b.makerref,b.partname from sparetype a , sparetype b
where a.parttypeid!=b.parttypeid
and a.makerref=b.makerref
and a.partname = b.partname
and rownum < 100
The problem is query has duplicated results(returns two rows for the same data). How can i emliminate it?
Thanks.You could try:
select a.parttypeid,a.makerref,a.partname,b.parttypeid,b.makerref,b.partname from sparetype a , sparetype b
where a.parttypeid<b.parttypeid
and a.makerref=b.makerref
and a.partname = b.partname
and rownum < 100
Regards,
Margot -
How to combine count() queries to tables in different environments?
Hi all,
I've got two tables that have the same schema, but slightly different data. One is a test db, and the other is a model office db (i.e. neither is a production db).
I run these two queries, individually, from within the test db:
select count(cdeSource), cdeSource
from schema1.SomeTable
group by cdeSource
order by cdeSource
select count(cdeSource), cdeSource
from schema1.SomeTable@TheModelOfficeDB
group by cdeSource
order by cdeSource
The column cdeSource can contain a 1 to 1 relationship with another field in the tables, but it can also contain a 1 to many with the other field.
Right now, I need to export each result into a file and then do a compare between the two to find the differences, between the two tables, out of the big results.
Question: How can I combine those two queires into 1, and show only the differences from the "count(cdeSource)" results column?
Thanks.
Edited by: we5inelgr on Jan 29, 2013 5:29 PMwe5inelgr wrote:
Example snippet of results:
Test environment
Count(cdeSource) | cdeSource
2 | "00.01" <---Same as other environment, would like to exclude
6 | "00.09" <---Same as other environment, would like to exclude
16 | "00.50" <---Different count, for same cdeSource. need to include
2 | "00.95" <---cdeSource only found in Test. need to include
2 | "72.1" <---Different count, for same cdeSource. need to include
Model Office environment
Count(cdeSource) | cdeSource
2 | "00.01"
6 | "00.09"
10 | "00.50"
3 | "72.1"
6 | "98.1" <---cdeSource only found in Model Office. need to include
I tried putting "MINUS" in between both queries, and it gives me an error: ORA-00933: SQL command not properly ended.
I tried wrapping that whole query, within a select * from () but gave me a different error: ORA-00907: missing right parenthesis
Other ideas how to combine the two?
Thanks.if & when you use valid syntax, then no errors get thrown.
We can not tell you what you do wrong, since you don't use COPY & PASTE to show us what exactly you do.
SELECT cdeSource, COUNT(cdeSource) FROM TABLE1
MINUS
SELECT cdeSource, COUNT(cdeSource) FROM TABLE1@remote_db; -
Combining of 2 different tables in to a query/view
Hi
I have 2 tables one is emp for employee details and another for courses for the courses which employee undergone.I want to create a view that contains the employees with each category went to the courses and rest of the employees didnt attended the courses in that group.The view or query should be combination of emp group wise by designation/groups who attended the courses and who didnt attended the courses.just an exmple of tables
Courses
emp emname job course
1 jon clerk msoffice
1 jon clerk office automation
2 rahul officer office automation
2 rahul officer spoken english
3 shyam officer spoken english
4 raj Manager office automation
Emp
empno ename job
1 jon clerk
5 ben clerk
2 rahul officer
3 shyam officer
6 rahim officer
4 raj manager
7 sandya manager
rgds
rateeshHi, Rateesh,
Sorry, I'm not sure I understand the problem. It would really help if you posted the results you want to get from the view.
Do you want to get all the information from the courses table, plus one row (from the emp table) for every employee who is not in the courses table?
The normal way to do that is an Outer Join.
For example, if you want to see all the departments (from the scott.emp table), and all of the employees in each department (from the scott.emp table), and you also want to see departments with no employees, you can say:
SELECT d.deptno
, e.ename
FROM scott.dept d
LEFT OUTER JOIN scott.emp e ON d.deptno = e.deptho;Since your tables are denormaliized (that is, the empname and job are repeated in different tables), you can also do that with a UNION, like you tried. You'll get all of the data from the courses table (for the employees who are in the courses table), and the data from the emp table, but only for the employees who are not in the courses table. You can put a literal NULL in the course column of SELECT clause, since these people will have no course.
Using the scott.dept and emp tables, here's how to simulate an outer join with a UNION.
SELECT deptno
, emp
FROM scott.emp
UNION
SELECT deptno
, NULL AS emp
FROM scott.dept d
WHERE NOT EXISTS ( -- Make sure this department is not in the emp table
SELECT NULL
FROM scott.emp
WHERE deptno = d.deptno
);You should be able to use either of these techiques to get the view you want. Your emp table corresponds to scott's dept table, and your courses table corresponds to scott's emp table. That is, you can have 0 or more courses per emp, in much the same way that scott can have 0 or more emps per dept. -
Combining attributes of multiple tables in one iterator.
One simple question.
How to create an iterator that includes atrributes from more than one associated tables in the application where the EJB 3.0 is the basis.
As far as i undrstand it's more easily to do this through ADF BC, where we can create VO using sql syntax.
Is creating a special class that includes properties associated to correspondent attributes of the related tables and getting a collection of such objects manually using operations under collections of initial EJB entity objects the only way of fixing the underlined problem with EJB 3.0 technology?
Thanks in advance. Alex.Hi,
since data controls in EJB are created from a session facade, you can use the session facade (session bean) like a VO and combine two Entities in a methid in which you return the combination of the two
Frank -
What is the best way of selecting 99 colums from a table with 100 colums?
Hi All,
Suppose in a table T, I have 100 colums .I want to select 99 columns.So what is the best way to do the same?
Anyone Help!
Thanx in advance.
PiyushTry this
SQL> ed
Wrote file afiedt.buf
1 select column_name ||',
2 ' from user_tab_columns
3 where
4 table_name = 'EMP'
5* and column_name not like 'EMPNO'
SQL> /
COLUMN_NAME||','
ENAME,
JOB,
MGR,
HIREDATE,
SAL,
COMM,
DEPTNO,
7 rows selected.
SQL> -
Combination of three internal tables
Hi there,
Is it possible to join three internal tables into one final table?Hi,
No its not possible.
u have to loop . & based on the key u have to make one internal table by combining the data of each line item .
into one workarea.
create a structure which include all the structure of the 3 tables and make a table of it.
read 3 tables and append in the the final table
sort the tables and use binary search to improve the performance.
eg.
type : begin of table4.
include table1. " table structure
include table2.
include table3.
end of table4.
data : table4_tab type table of table4,
wa_tab4 type table4.
sort : table2 by abc,
table3 by xyz.
loop at table1.
read table table2 with key abc = table1-abc
binary search.
if sy-subrc =0.
wa_tab4-table2 = table2.
endif.
read table table3 with key abc = table1-abc
binary search.
if sy-subrc =0.
wa_tab4-table3 = table3.
endif.
wa_tab4-table1 = table1.
append wa_tab4 into table4_tab.
claer wa_tab4.
endloop.
Use this to optimise code & performance
Reagrds
Manoj B Gupta
Message was edited by: Manoj Gupta -
Mapping rows to Colums across two tables
Hi All,
I have a doubt as to how this could be done, could you please help me out with this one
i have data in two tables
Table 1
Prod_number Refer_number
C1 A1
C1 A2
C2 B1
C2 B2
C2 B3
C3 D1
C3 D2
C3 D3
C3 D4
C4 E1
Table 2
Prod_number Document
C1 R1
C1 R2
C1 R3
C1 R4
C2 S1
C3 T1
C3 T2
C4 NONE
The Final output should be like Combine the two tables mapping the rows in Table 2 to columns in the final output based on the Prod_number field
Prod_number Refer_number Document_1 Document_2 Document_3 Document_4
C1 A1 R1 R2 R3 R4
C1 A2 R1 R2 R3 R4
C2 B1 S1 - - -
-C2 B2 S1 - - -
C2 B3 S1 - - -
C3 D1 T1 T2 - -
C3 D2 T1 T2 - -
C3 D3 T1 T2 - -
C3 D4 T1 T2 - -
C4 E1 - - - -
Regards,
MaverickMaverick,
This is a standard pivot. In 11g you can use the PIVOT function. In versions prior to 11g you can use this:
SQL> create table table_1 (prod_number,refer_number)
2 as
3 select 'C1', 'A1' from dual union all
4 select 'C1', 'A2' from dual union all
5 select 'C2', 'B1' from dual union all
6 select 'C2', 'B2' from dual union all
7 select 'C2', 'B3' from dual union all
8 select 'C3', 'D1' from dual union all
9 select 'C3', 'D2' from dual union all
10 select 'C3', 'D3' from dual union all
11 select 'C3', 'D4' from dual union all
12 select 'C4', 'E1' from dual
13 /
Tabel is aangemaakt.
SQL> create table table_2 (prod_number,document)
2 as
3 select 'C1', 'R1' from dual union all
4 select 'C1', 'R2' from dual union all
5 select 'C1', 'R3' from dual union all
6 select 'C1', 'R4' from dual union all
7 select 'C2', 'S1' from dual union all
8 select 'C3', 'T1' from dual union all
9 select 'C3', 'T2' from dual union all
10 select 'C4', 'NONE' from dual
11 /
Tabel is aangemaakt.
SQL> set null "-"
SQL> select t1.prod_number
2 , t1.refer_number
3 , max(decode(t2.rn,1,document)) document_1
4 , max(decode(t2.rn,2,document)) document_2
5 , max(decode(t2.rn,3,document)) document_3
6 , max(decode(t2.rn,4,document)) document_4
7 from table_1 t1
8 , ( select t.*
9 , row_number() over (partition by prod_number order by document) rn
10 from table_2 t
11 where document != 'NONE'
12 ) t2
13 where t1.prod_number = t2.prod_number (+)
14 group by t1.prod_number
15 , t1.refer_number
16 /
PR RE DOCU DOCU DOCU DOCU
C1 A1 R1 R2 R3 R4
C1 A2 R1 R2 R3 R4
C2 B1 S1 - - -
C2 B2 S1 - - -
C2 B3 S1 - - -
C3 D1 T1 T2 - -
C3 D2 T1 T2 - -
C3 D3 T1 T2 - -
C3 D4 T1 T2 - -
C4 E1 - - - -
10 rijen zijn geselecteerd.Regards,
Rob. -
Combine data from a table and insert to another in comma separated format
In my SQL database table i have some data as shown below.
KNO Course Grade Institution
124 BTECH First IIT Calicut
128 BE First KKS Institute
124 CCNA Q NIIT Delhi
124 DDCN Q Appl Calicut
128 DIT A NIIT Delhi
128 VB Q IICM Delhi
i want this courses to be arranged as sample given under to a table named mainpers
KNO Course
124 BTECH[First], CCNA[Q],DDCN[Q]
128 BE[First], DIT[A], VB[Q]
I am a System Administrator at VadodaraYou can do this in SQL.
with cte as (
select distinct KNO
from Table1
select KNO
, Stuff(
(select ',' + Course + '[' + Grade + ']'
from Table1
where Table1.KNO = cte.KNO
for xml path ('')
), 1, 1, '') as Course
from cte
http://davidduffett.net/post/5334646215/get-a-comma-separated-list-of-values-in-sql-with-for
Russel Loski, MCT, MCSE Data Platform/Business Intelligence. Twitter: @sqlmovers; blog: www.sqlmovers.com -
Error in Abap code when combining data from two tables
Hi,
I got error in my code when i try to select data based on two tables
error message Unknown column name "(" field list. field list. field list. field list.
select ( WLK1~ARTNR )
into ZOXE1D0041-ZZPROMO
from WLK1 INNER JOIN T001W
ON WLK1FILIA = T001WKUNNR.
where WLK1-PFLKN NE 'P' AND
WLK1-QUELL NE '2'.
Table 1 WLK1
ARTNR FILIA PFLKN QUELL
001 C001 P 2
002 C001 A 1
Table 2 T001W
KUNNR WERKS
C001 P001
My requirement is to extract from article number from table WLK1 where the customer number (FILIA) matches with Customer number from (T001W) and plant (WERKS).
In conclusion I like to have this only this row
ARTNR FILIA PFLKN QUELL
002 C001 A 1Hi
You need to append every article number after each select is performed
is this an intermal table ZOXE1D0041 with header line ? if yes
then do this way
select WLK1~ARTNR
into ZZARTICLE
from WLK1 INNER JOIN T001W
ON WLK1FILIA = T001WKUNNR
where WLK1~PFLKN NE 'P' AND
WLK1~PFLKN NE 'S' AND
WLK1~QUELL NE '2'.
ZOXE1D0041-ZZLISTARTICLE = ZZARTICLE.
Append ZOXE1D0041. " <edited>
endselect.
then ZOXE1D0041 will have all article numbers.
Edited by: Sonal Patel on Sep 5, 2009 10:27 AM
Maybe you are looking for
-
EJB 3.0 Session bean local interface NullPointerException
I am trying a very simple test of a Stateless EJB 3.0 bean called from a servlet. The bean has a local interface, annotated with @Local. The bean implements that interface and is annotated with @Stateless. I have a servlet with a variable of the loca
-
Cannot get accurate eyedropper sample from imported graphic
I am working in illustrator CS5 set to CMYK which my imported photoshop layered file is also. When I sample a color from the imported psd file, it will not accurately pick it up. I have to write down the numbers in photoshop and hand apply them in il
-
Checking .svc Service for web Part Deployment
I am trying to deploy a web part on my company's SharePoint Server. I altered the web.config file, added the .dll's to GAC, and compied the .svc's neccessary to the Web Server Extensions/.../PSI folder. When I surf to a URL to check the web service,
-
Aperture has stopped showing some, but not all, keywords on photos
I imported some new photos today and noticed that Aperture seems to have stopped displaying some, but not all, of my keywords. I'm noticing this on a large number of my existing photos. For example, I've selected a photo and the Keywords tab of the M
-
I have the 7666 xpower. I planned on Installing it on one of the Sata 3 ports, but will choose another is I can get better performance. I also planned on putting the chipset drivers on the drive before the OS install, but I may remember reading that