Transpose
Dear members,
I need some help in writing a SQL query.
I have a table which has data as follows:
FROM_UOM_CODE FROM_UNIT_OF_MEASURE TO_UOM_CODE TO_UNIT_OF_MEASURE CONVERSION_RATE
LB Weight PG Proof Gallon 3.53507
LB Weight WG Volume 6.76965498I need to write a query in such way that i get data as follows:
FROM_UOM_CODE FROM_UNIT_OF_MEASURE TO_UOM_CODE TO_UNIT_OF_MEASURE CONVERSION_RATE FROM_UOM_CODE FROM_UNIT_OF_MEASURE TO_UOM_CODE TO_UNIT_OF_MEASURE CONVERSION_RATE
LB Weight PG Proof Gallon 3.53507 LB Weight WG Volume 6.76965498I saw few articles on how to convert rows into columns but could not achieve the desired result.
Thanks
Sandeep
Hi, Sandeep,
795291 wrote:
... I saw few articles on how to convert rows into columns but could not achieve the desired result.Did you see these?
SQL and PL/SQL FAQ
Post your best attempt, a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.
Explain, using specific examples, how you get those results from that data. (What does each row of output represent? It would probably help if you posted an example that resulted in 2 or more rows of output. How did you decide that the row with to_uom_code='PG' became the first 5 columns, and 'WG' the last 5? Would it matter if the output was the other way around?)
Always say which version of Oracle you're using. Starting in Oracle 11, the SELECT ... PIVOT feature can make this easier.
Similar Messages
-
Questions on Track Transpose and Score Layout
Hi all -
I'm posting these questions for my 14-yr old son who is the Logic Express user, so apologies as I might be asking the questions the wrong way. :-)
My son is writing an arrangement of the song Friday (Rebecca Black) :-) for his Middle School Marching Band. It sounds pretty cool so far, btw, and I have to admit the song is quite catchy. Haha.
Question 1: Is there a way to transpose a track independently of other tracks? As you know, some marching band instruments (flute, clarinet, etc) play natively in a different key, and he wants the appropriate key to show in the printed score. When he sets the key for a given track, every other track is changed as well, which won't work.
Question 2: When printing the score, is there a way to remove the bass clef? For some instruments (trumpet, for example) there are no notes in the bass clef and it's a waste to print the bass clef at all. He just wants the score to be more compact (and use less paper).
I hope I did his questions justice. :-) Any feedback would be very helpful! Thanks!So I asked my son if I asked his questions correctly, and I guess I didn't. :-/ So, thanks, anyway, for reading. I'll be posting a different question shortly.
Mods: Please delete if needed. Thanks! -
Real instruments being transposed
Every time I play a real instrument through my US-122 into garageband, my instruments are transposed down a whole tone. So when I play a B, I hear an A in my headphones.
I checked the monitor-out on the US-122, and it's fine. The problem is therefore somewhere in GarageBand. How can I turn this off? Does anyone know?
Help!make sure your interface is set to a sample rate of 44.1K
-
Transposing Blue Adio Loops in the Inspector only gives + or - 12, 24, 36
How do I take a C and move it to F and G to have some fun with some loops that I want to work with? I can open the inspector I see the transpose section for the track but it only presents me with 12,24,36 how do I do something so simple?
Hi,
simply doubleclick onto the number to get access to the field where you can enter the transpose value directly in as small a number as you want.
Fox -
How do I make a transpose/octave button for just one instrument in a split?
I work in mainstage 2.2.2 with patches that are using splits, and I want to make an octave button for just one instruments in a patch. Suggestions? (If I press the octave button in my keyboard, the whole split point moves, no good...)
BennyAn octave button for just one instrument will work for some instruments. EVB3, ESX24, ESM and a few others can be assigned. However I was unable to make it work with EVP88 and ES2. Try this example: in layout mode set up a button(or buttons) on your controller keyboard for changing octaves. In edit mode add a channel strip and select an ESX24 instrument. Select the screen control button you want to assign in the workspace. In the screen control inspector, select the mappings tab. The list below will say unmapped. Double-click on it. Select the instrument in the list. Another list to the right will appear. Select ESX24 (Sampler). In the column to the right, select the pitch folder, then select transpose. To the right, you'll see saved value, button on and button off values. This should get you started. Some of the instruments have different menus, so they'll be a little different. Have fun with it.
-
How do I transpose and group a table in a ViewObject?
Hi,
I want to transpose and group a table within a view object and don't know how to do it.
Please let me explain what I want to do:
One table, e.g. Employees, has one row per employee. Each employee has a departmenent and a room assigned:
Employee
Department
Room
John
Finance
101
Susie
Prod
102
Hank
Finance
103
Now I want to show one row per departmenent and a marked checkbox for each room that has an employee from this department in it:
Department
Room 101
Room 102
Room 103
Finance
X
X
Prod
X
What I already did is, I added a transient attribute of type boolean for each room to the ViewObject for employees. I was able to set the booleans within the method ViewObject::createRowFromResultSet. But I still need to do a grouping by department.
What I don't understand is: is it possible to 1. selecting data, 2. grouping the result and 3. setting booleans for the rooms, anything in the same view object? Or do I need to have two ViewObjects, one that holds the data and another one that prepares and to displays the data?
Btw. the users will change the checkboxes and the changes must be written back to the database (makes no sense for this example, I know...).
Could anything be done in the same ViewObject? If so, which methods do I have to overwrite to do the grouping?
Could someone please give me a hint or let me know where I can find an example of a similar scenario?
Thanks in advance!Sort the playlist into the desired order, e.g. click the heading for the track no. or album columns, the right-click on the playlist name and click Copy to Play Order. The playlist should now burn in the correct order.
tt2 -
Hi,
i have got two tables called salary and salconfig,salary table is refering to salconfig table.
I want a result of transpose values,i.e query should display in the following format.
Empid Basic HRA DA TA
298 4500 1500 800 950
300 2300 450 800 560
my tables r
Salary
ID EMPID SALID VALUE
1 298 2 1500
2 298 1 4500
3 298 3 800
4 298 4 950
5 300 1 2300
6 300 2 450
7 300 3 800
8 300 4 560
Salconfig
ID ITEMS
1 Basic
2 HRA
3 Da
4 ta
If anybody got a query for this plz replay.Query should be a generalized one,because data in salconfig table will change dynamicaly.
Regds
Rupesh
DBA,iNetFrameRight, so this is the key you want to run (this version allows for employees who don't qualify for everything):
SQL> SELECT s1.emp_id
2 , s1.val AS basic
3 , nvl(s2.val, 0) AS hra
4 , nvl(s3.val, 0) AS da
5 , nvl(s4.val, 0) AS ta
6 FROM ( SELECT x1.emp_id, x1.val FROM salary x1
7 WHERE 1 = x1.sal_id ) s1
8 , ( SELECT x2.emp_id, x2.val FROM salary x2
9 WHERE 2 = x2.sal_id ) s2
10 , ( SELECT x3.emp_id, x3.val FROM salary x3
11 WHERE 3 = x3.sal_id ) s3
12 , ( SELECT x4.emp_id, x4.val FROM salary x4
13 WHERE 4 = x4.sal_id ) s4
14 WHERE s1.emp_id = s2.emp_id(+)
15 AND s1.emp_id = s3.emp_id(+)
16 AND s1.emp_id = s4.emp_id(+)
17 /
EMP_ID BASIC HRA DA TA
298 4500 1500 800 950
300 2300 450 800 560
301 2100 0 800 0
SQL> Now what you want is to generate this query dynamically. I'm going to use a ref cursor. There are other approaches.
CREATE OR REPLACE FUNCTION get_remuneration RETURN sys_refcursor
AS
sel_stmt VARCHAR2(32767);
from_stmt VARCHAR2(32767);
where_stmt VARCHAR2(32767);
return_value sys_refcursor;
BEGIN
FOR i IN ( SELECT id, items FROM salconfig ORDER BY id ASC )
LOOP
-- assume every employee gets BASIC salary and it's always gonna be 1
IF i.items = 'Basic'
THEN
sel_stmt := 'SELECT s1.emp_id'||chr(10)||' , s1.val AS basic';
from_stmt := 'FROM ( SELECT x1.emp_id, x1.val FROM salary x1'||chr(10)||' WHERE 1 = x1.sal_id ) s1';
where_stmt := null;
ELSE
sel_stmt := sel_stmt||chr(10)||' , nvl(s'||trim(i.id)||'.val, 0) AS "'||i.items||'"';
from_stmt := from_stmt||chr(10)||', ( SELECT x'||trim(i.id)||'.emp_id, x'||trim(i.id)||'.val FROM salary x'||trim(i.id)||chr(10)||' WHERE '||trim(i.id)||' = x'||trim(i.id)||'.sal_id ) s'||trim(i.id);
IF where_stmt IS null
THEN
where_stmt := 'WHERE ';
ELSE
where_stmt := where_stmt||chr(10)||'AND ';
END IF;
where_stmt := where_stmt||'s1.emp_id = s'||trim(i.id)||'.emp_id(+)';
END IF;
END LOOP;
OPEN return_value FOR sel_stmt||chr(10)||from_stmt||chr(10)||where_stmt;
RETURN return_value;
END;
/Smoke me a kipper, I'll be back before breakfast.
Cheers, APC -
Using Adobe Acrobat Pro XI and Excel 14.3.8 on a mac.
Saved PDF as "optimized PDF" then "save as other" > spreadsheet > Microsoft Excel Workbook.
Problem: numbers in some random dates are transposed so that month and day are reversed. No particular pattern to these errors. Only fix we've found is to go through and manually check and correct the date errors - there are hundreds of these errors in the document so this is not a good solution.
(Note: Excel columns with dates are specified as "date" fields. All dates are formatted as m/d/yy)
Any ideas what's causing this problem problem and how to fix it?
Thanks in advance![discussion moved to Creating, Editing & Exporting PDFs forum]
-
ALV-O/P TRANSPOSED PROBLEM WITH EDIT
Hi All,
In my alv report I have transposed the o/p,i.e rows are transposed.aftre transposing edit functionality is not working.Can any one tell me how should I make the field editable aftre tarnsposing.
here is the code..
TYPE-POOLS slis.
*DATA:DATE1(10).
*TYPES:BEGIN OF B1_TY,
USER LIKE SYST-UNAME,
DATE(10),
val like ekko-waers,
VAR1(200),
VAR2(300),
END OF B1_TY.
*DATA:B1_ITAB TYPE STANDARD TABLE OF B1_TY.
*DATA:B1_WA LIKE LINE OF B1_ITAB.
*DATA: l_col1 TYPE sy-tabix,
l_structure1 TYPE REF TO data,
l_dyntable1 TYPE REF TO data,
wa_lvc_cat1 TYPE lvc_s_fcat,
lt_lvc_cat1 TYPE lvc_t_fcat,
lt_fieldcatalogue1 TYPE slis_t_fieldcat_alv,
wa_fieldcatalogue1 TYPE slis_fieldcat_alv,
wa_fieldcat1 TYPE slis_fieldcat_alv,
lt_fieldcat1 TYPE slis_t_fieldcat_alv,
lt_layout1 TYPE slis_layout_alv.
*FIELD-SYMBOLS :
<header1> TYPE ANY,
<dynheader1> TYPE ANY,
<dyndata1> TYPE ANY,
<ls_table1> TYPE ANY,
<dynamictable1> TYPE STANDARD TABLE,
<it_table1> TYPE STANDARD TABLE.
*DATA fcat TYPE SLIS_T_FIELDCAT_ALV with header line.
*DATA layout TYPE slis_layout_alv.
*CONCATENATE SY-DATUM+6(2) '.'
SY-DATUM+4(2) '.'
SY-DATUM(4) into DATE1.
*B1_WA-USER = SYST-UNAME.
*B1_WA-DATE = DATE1.
*B1_WA-VAR1 = 'VENDOR SELCTION HAS BEEN MADE ON LOWEST PRICE UNLESS OTHER WISE NOTED'.
*B1_WA-VAR2 = 'HELLO'.
*APPEND B1_WA TO B1_ITAB.
*CLEAR B1_WA.
*CREATE DATA l_dyntable1 TYPE STANDARD TABLE OF B1_TY
WITH NON-UNIQUE DEFAULT KEY.
ASSIGN l_dyntable1-> TO <it_table1>.
*<it_table1> = B1_ITAB[].
*wa_lvc_cat1-fieldname = 'COLUMNTEXT'.
*wa_lvc_cat1-ref_table = 'LVC_S_DETA'.
*APPEND wa_lvc_cat1 TO lt_lvc_cat1.
*wa_fieldcat1-fieldname = 'COLUMNTEXT'.
*wa_fieldcat1-ref_tabname = 'LVC_S_DETA'.
*wa_fieldcat1-key = 'X'..
*APPEND wa_fieldcat1 TO lt_fieldcat1.
*DESCRIBE TABLE <it_table1>.
*DO sy-tfill TIMES.
WRITE sy-index TO wa_lvc_cat1-fieldname LEFT-JUSTIFIED.
CONCATENATE 'VALUE' wa_lvc_cat1-fieldname
INTO wa_lvc_cat1-fieldname.
wa_lvc_cat1-ref_field = 'VALUE'.
wa_lvc_cat1-ref_table = 'LVC_S_DETA'.
APPEND wa_lvc_cat1 TO lt_lvc_cat1.
CLEAR wa_fieldcat1.
wa_fieldcat1-fieldname = wa_lvc_cat1-fieldname.
wa_fieldcat1-ref_fieldname = 'VALUE'.
wa_fieldcat1-ref_tabname = 'LVC_S_DETA'.
APPEND wa_fieldcat1 TO lt_fieldcat1.
*ENDDO.
*CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_lvc_cat1
IMPORTING
ep_table = l_dyntable1.
ASSIGN l_dyntable1-> TO <dynamictable1>.
*CREATE DATA l_structure1 LIKE LINE OF <dynamictable1>.
ASSIGN l_structure1-> TO <header1>.
*CREATE DATA l_structure1 LIKE LINE OF <it_table1>.
ASSIGN l_structure1-> TO <ls_table1>.
*wa_fieldcatalogue1-FIELDNAME = 'PREPARED BY:'.
*wa_fieldcatalogue1-ROW_POS = '1'.
*wa_fieldcatalogue1-TABNAME = 'ls_table'.
*wa_fieldcatalogue1-OUTPUTLEN = '15'.
*APPEND wa_fieldcatalogue1 TO lt_fieldcatalogue1.
*CLEAR wa_fieldcatalogue1.
*wa_fieldcatalogue1-FIELDNAME = 'DATE:'.
*wa_fieldcatalogue1-ROW_POS = '2'.
*wa_fieldcatalogue1-TABNAME = 'ls_table'.
*wa_fieldcatalogue1-OUTPUTLEN = '10'.
*APPEND wa_fieldcatalogue1 TO lt_fieldcatalogue1.
*CLEAR wa_fieldcatalogue1.
*wa_fieldcatalogue1-FIELDNAME = 'JUSTIFICATION'.
*wa_fieldcatalogue1-ROW_POS = '3'.
*wa_fieldcatalogue1-TABNAME = 'ls_table'.
*wa_fieldcatalogue1-OUTPUTLEN = '15'.
*APPEND wa_fieldcatalogue1 TO lt_fieldcatalogue1.
*CLEAR wa_fieldcatalogue1.
*wa_fieldcatalogue1-FIELDNAME = 'COMMENTS'.
*wa_fieldcatalogue1-ROW_POS = '4'.
*wa_fieldcatalogue1-TABNAME = 'ls_table'.
*wa_fieldcatalogue1-edit = 'X'.
*wa_fieldcatalogue1-input = 'X'.
*wa_fieldcatalogue1-OUTPUTLEN = '100'.
*APPEND wa_fieldcatalogue1 TO lt_fieldcatalogue1.
*CLEAR wa_fieldcatalogue1.
*lt_layout1-colwidth_optimize = 'X'.
*lt_layout1-no_colhead = 'x'.
*DESCRIBE TABLE lt_fieldcatalogue1.
*DO sy-tfill TIMES.
IF sy-index = 1.
READ TABLE lt_fieldcatalogue1 INTO wa_fieldcat1 INDEX 1.
ENDIF.
ASSIGN COMPONENT 1 OF STRUCTURE <header1> TO <dynheader1>.
IF sy-subrc NE 0.
EXIT .
ENDIF.
READ TABLE lt_fieldcatalogue1 INTO wa_fieldcat1 INDEX sy-index.
<dynheader1> = wa_fieldcat1-seltext_m.
IF <dynheader1> IS INITIAL.
<dynheader1> = wa_fieldcat1-fieldname.
ENDIF.
LOOP AT <it_table1> INTO <ls_table1>.
l_col1 = sy-tabix + 1.
ASSIGN COMPONENT sy-index OF STRUCTURE <ls_table1> TO <dyndata1>.
IF sy-subrc NE 0. EXIT .ENDIF.
ASSIGN COMPONENT l_col1 OF STRUCTURE <header1> TO
<dynheader1>.
IF sy-subrc NE 0. EXIT .ENDIF.
WRITE <dyndata1> TO <dynheader1> LEFT-JUSTIFIED.
ENDLOOP.
APPEND <header1> TO <dynamictable1>.
*ENDDO.
*CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
*EXPORTING
IS_LAYOUT = LT_LAYOUT1
IT_FIELDCAT = LT_FIELDCAT1[]
TABLES
T_OUTTAB = <DYNAMICTABLE1>
*IF SY-SUBRC <> 0.
*ENDIF.
Regards.Hi,
Instead of sy-repid, try passing the program name directly.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = 'ZCREDIT_LETTER'
i_background_id = 'ALV_BACKGROUND'
it_fieldcat = fcat
is_layout = xs_layout
i_save = 'A'
i_callback_top_of_page = 'TOP_OF_PAGE'
I_CALLBACK_USER_COMMAND = w_callback_ucomm
tables
t_outtab = FINAL
exceptions
program_error = 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.
endform. "DISPLAY_ALV_LAYOUT -
How does Numbers Transpose command (similar to Excel's TRANSPOSE command) work?
The Excel transpose can be used to convert a row of cell into a column of cells. Or vise versa. In excel there is the critical difference where you identify an Array by tpying Control+U then Command+Return. This provides the stepping through the cells when you copy the formular down (for column) or across (for row).
I can't figure how to do it without this (very opaque) Array facility which Excel has. Openning my Excel demo file results in an error and I get pasted values from last calculation, so Numbers obviously doesn't have feature compatibility with Excel here.
I actually just want the pasted values, so even a menu command that cuts a row of cells and pastes those cells into a column (or vise versa) would be fine, don't need a permanent formula to do it.
Bananas
Oranges
Mangoes
Apples
Pears
Peaches
Nectarines
Silver beet
Dates
Bananas
Bananas
Oranges
Oranges
Mangoes
Mangoes
Apples
Apples
Pears
Pears
Peaches
Peaches
Nectarines
Nectarines
Silver beet
Silver beet
Dates
DatesI'd use OFFSET for this purpose. Works in either direction.
Original is a data table (all values entered directly)
Transposed contains a single Formula, entered in A1, then filled down* to row 4, and filled right to column D.
Transposed::A1: =OFFSET(Original :: $A$1,COLUMN()-1,ROW()-1)
*Because Row 1 is a Header row, it's not possible to Fill down into the 'regular' rows below. You can do the Fill down and Fill right on a Plain table (no header rows or columns), then convert the top row and left columns to Header versions, or you can click on A1 to select it, Copy, then click on A2 and Paste. Fill down the rest of column A, then select the full column and fill right to column C.
Here'a a second example, used to convert a column oriented data entry table to table with data oriented in the one row = one record convention.
Same basic formula here. The IF(ISBLANK part is added to avoid zeros in cells corresponding to empty cells in the entry column.
=IF(ISBLANK(OFFSET(Aux::$A$1,COLUMN()-1,0)),"",OFFSET(Aux::$A$1,COLUMN()-1,0))
Regards,
Barry -
Transpose ALV output format in Vertical
Hi ,
I want to transpose the ALV output. For this i have coded like below, but there is no output displaying.Please check the below code & advise me where to write our own fielcatalog & how to write the fieldcatogue.
TABLES:EKKO,EKPO.
TYPE-POOLS: SLIS.
TYPES:BEGIN OF PH_TY,
PH_EBELN LIKE EKKO-EBELN,
PH_AEDAT LIKE EKKO-AEDAT,
PH_LIFNR LIKE EKKO-LIFNR,
PH_SUBMI LIKE EKKO-SUBMI,
PH_EKORG LIKE EKKO-EKORG,
END OF PH_TY.
DATA: PH_ITAB TYPE STANDARD TABLE OF PH_TY.
DATA: L_COL TYPE SY-TABIX,
L_STRUCTURE TYPE REF TO DATA,
L_DYNTABLE TYPE REF TO DATA,
WA_LVC_CAT TYPE LVC_S_FCAT,
LT_LVC_CAT TYPE LVC_T_FCAT,
LT_FIELDCATALOGUE TYPE SLIS_T_FIELDCAT_ALV,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
LT_LAYOUT TYPE SLIS_LAYOUT_ALV.
FIELD-SYMBOLS : <HEADER> TYPE ANY,
<DYNHEADER> TYPE ANY,
<DYNDATA> TYPE ANY,
<LS_TABLE> TYPE ANY,
<DYNAMICTABLE> TYPE STANDARD TABLE,
<IT_TABLE> TYPE STANDARD TABLE.
SELECTION-SCREEN:BEGIN OF BLOCK B1.
SELECT-OPTIONS:P_EBELN FOR EKKO-EBELN,
P_LIFNR FOR EKKO-LIFNR,
P_MATNR FOR EKPO-MATNR.
SELECTION-SCREEN END OF BLOCK B1.
INITIALIZATION.
START-OF-SELECTION.
CREATE DATA L_DYNTABLE TYPE STANDARD TABLE OF PH_TY WITH NON-UNIQUE DEFAULT KEY.
ASSIGN L_DYNTABLE->* TO <IT_TABLE>.
SELECT EBELN AEDAT LIFNR SUBMI EKORG FROM EKKO
INTO TABLE <IT_TABLE> WHERE EBELN IN P_EBELN
AND LIFNR IN P_LIFNR.
WA_LVC_CAT-FIELDNAME = 'COLUMNTEXT'.
WA_LVC_CAT-REF_TABLE = 'LVC_S_DETA'.
APPEND WA_LVC_CAT TO LT_LVC_CAT.
WA_FIELDCAT-FIELDNAME = 'COLUMNTEXT'.
WA_FIELDCAT-REF_TABNAME = 'LVC_S_DETA'.
WA_FIELDCAT-KEY = 'X'.
APPEND WA_FIELDCAT TO LT_FIELDCAT.
* WA_FIELDCAT-TABNAME = 'IT_TABLE'.
* WA_FIELDCAT-FIELDNAME = 'PH_EBELN'.
* WA_FIELDCAT-SELTEXT_M = 'PO'.
* APPEND WA_FIELDCAT TO LT_FIELDCAT.
* CLEAR WA_FIELDCAT.
DESCRIBE TABLE <IT_TABLE>.
DO
SY-TFILL TIMES.
WRITE SY-INDEX TO WA_LVC_CAT-FIELDNAME LEFT-JUSTIFIED.
CONCATENATE 'VALUE' WA_LVC_CAT-FIELDNAME INTO WA_LVC_CAT-FIELDNAME.
WA_LVC_CAT-REF_FIELD = 'VALUE'.
WA_LVC_CAT-REF_TABLE = 'LVC_S_DETA'.
APPEND WA_LVC_CAT TO LT_LVC_CAT.
CLEAR WA_FIELDCAT.
WA_FIELDCAT-FIELDNAME = WA_LVC_CAT-FIELDNAME.
WA_FIELDCAT-REF_FIELDNAME = 'VALUE'.
WA_FIELDCAT-REF_TABNAME = 'LVC_S_DETA'.
APPEND WA_FIELDCAT TO LT_FIELDCAT.
ENDDO.
CALL METHOD CL_ALV_TABLE_CREATE=>CREATE_DYNAMIC_TABLE
EXPORTING
IT_FIELDCATALOG = LT_LVC_CAT
IMPORTING
EP_TABLE = L_DYNTABLE.
ASSIGN L_DYNTABLE->* TO <DYNAMICTABLE>.
CREATE DATA L_STRUCTURE LIKE LINE OF <DYNAMICTABLE>.
ASSIGN L_STRUCTURE->* TO <HEADER>.
CREATE DATA L_STRUCTURE LIKE LINE OF <IT_TABLE>.
ASSIGN L_STRUCTURE->* TO <LS_TABLE>.
DESCRIBE TABLE LT_FIELDCATALOGUE.
DO SY-TFILL TIMES.
IF SY-INDEX = 1.
READ TABLE LT_FIELDCATALOGUE INTO WA_FIELDCAT INDEX 1.
ENDIF.
ASSIGN COMPONENT 1 OF STRUCTURE <HEADER> TO <DYNHEADER>.
IF SY-SUBRC NE 0. EXIT .ENDIF.
READ TABLE LT_FIELDCATALOGUE INTO WA_FIELDCAT INDEX SY-INDEX.
<DYNHEADER> = WA_FIELDCAT-SELTEXT_M.
IF <DYNHEADER> IS INITIAL.
<DYNHEADER> = WA_FIELDCAT-FIELDNAME.
ENDIF.
LOOP AT <IT_TABLE> INTO <LS_TABLE>.
L_COL = SY-TABIX + 1.
ASSIGN COMPONENT SY-INDEX OF STRUCTURE <LS_TABLE> TO <DYNDATA>.
IF SY-SUBRC NE 0. EXIT .
ENDIF.
ASSIGN COMPONENT L_COL OF STRUCTURE <HEADER> TO <DYNHEADER>.
IF SY-SUBRC NE 0.
EXIT .
ENDIF.
WRITE <DYNDATA> TO <DYNHEADER> LEFT-JUSTIFIED.
ENDLOOP.
APPEND <HEADER> TO <DYNAMICTABLE>.
ENDDO.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
IS_LAYOUT = LT_LAYOUT
IT_FIELDCAT = LT_FIELDCAT
TABLES
T_OUTTAB = <DYNAMICTABLE>.Hi,
Please go thorugh the below sample code , Commenting is done for your easy understanding.
TYPE-POOLS: slis."*Declarations for ALV, dynamic table and col no for transpose
DATA: l_col TYPE sy-tabix,
l_structure TYPE REF TO data,
l_dyntable TYPE REF TO data,
wa_lvc_cat TYPE lvc_s_fcat,
lt_lvc_cat TYPE lvc_t_fcat,
lt_fieldcatalogue TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
lt_fieldcat TYPE slis_t_fieldcat_alv,
lt_layout TYPE slis_layout_alv."*Field symbols declarations
FIELD-SYMBOLS :
<header> TYPE ANY,
<dynheader> TYPE ANY,
<dyndata> TYPE ANY,
<ls_table> TYPE ANY,
<dynamictable> TYPE STANDARD TABLE,
<it_table> TYPE STANDARD TABLE."*Input the name of the table
PARAMETERS p_table TYPE dd02l-tabname OBLIGATORY."*Initialization event
INITIALIZATION."*Start of selection event
START-OF-SELECTION."* Create internal table of dynamic type
CREATE DATA l_dyntable TYPE STANDARD TABLE OF (p_table)
WITH NON-UNIQUE DEFAULT KEY.
ASSIGN l_dyntable->* TO <it_table>."*select statement to select data from the table as input into
*our dynamic internal table.
*Here i have restricted only till 5 rows.
*You can set a variable and give no of rows to be fetched
*The variable can be set in your select statement SELECT * INTO CORRESPONDING FIELDS OF TABLE <it_table>
FROM (p_table) up to 5 rows."*Fieldcatalogue definitions
wa_lvc_cat-fieldname = 'COLUMNTEXT'.
wa_lvc_cat-ref_table = 'LVC_S_DETA'.
APPEND wa_lvc_cat TO lt_lvc_cat. wa_fieldcat-fieldname = 'COLUMNTEXT'.
wa_fieldcat-ref_tabname = 'LVC_S_DETA'.
wa_fieldcat-key = 'X'..
APPEND wa_fieldcat TO lt_fieldcat. DESCRIBE TABLE <it_table>. DO sy-tfill TIMES.
For each line, a column 'VALUEx' is created in the fieldcatalog
Build Fieldcatalog
WRITE sy-index TO wa_lvc_cat-fieldname LEFT-JUSTIFIED.
CONCATENATE 'VALUE' wa_lvc_cat-fieldname
INTO wa_lvc_cat-fieldname.
wa_lvc_cat-ref_field = 'VALUE'.
wa_lvc_cat-ref_table = 'LVC_S_DETA'.
APPEND wa_lvc_cat TO lt_lvc_cat.
Build Fieldcatalog
CLEAR wa_fieldcat.
wa_fieldcat-fieldname = wa_lvc_cat-fieldname.
wa_fieldcat-ref_fieldname = 'VALUE'.
wa_fieldcat-ref_tabname = 'LVC_S_DETA'.
APPEND wa_fieldcat TO lt_fieldcat.
ENDDO."* Create dynamic internal table
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt_lvc_cat
IMPORTING
ep_table = l_dyntable. ASSIGN l_dyntable->* TO <dynamictable>."* Create structure as structure of the internal table
CREATE DATA l_structure LIKE LINE OF <dynamictable>.
ASSIGN l_structure->* TO <header>."* Create structure = structure of the internal table
CREATE DATA l_structure LIKE LINE OF <it_table>.
ASSIGN l_structure->* TO <ls_table>."* Create field catalog from our table structure
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = p_table
CHANGING
ct_fieldcat = lt_fieldcatalogue
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF. DESCRIBE TABLE lt_fieldcatalogue."* Fill the internal to display <dynamictable>
DO sy-tfill TIMES.
IF sy-index = 1.
READ TABLE lt_fieldcatalogue INTO wa_fieldcat INDEX 1.
ENDIF.
For each field of it_table
ASSIGN COMPONENT 1 OF STRUCTURE <header> TO <dynheader>.
IF sy-subrc NE 0. EXIT .ENDIF.
READ TABLE lt_fieldcatalogue INTO wa_fieldcat INDEX sy-index.
Fill 1st column
<dynheader> = wa_fieldcat-seltext_m.
IF <dynheader> IS INITIAL.
<dynheader> = wa_fieldcat-fieldname.
ENDIF."*Filling the other columns
LOOP AT <it_table> INTO <ls_table>.
l_col = sy-tabix + 1.
ASSIGN COMPONENT sy-index OF STRUCTURE <ls_table> TO <dyndata>.
IF sy-subrc NE 0. EXIT .ENDIF.
ASSIGN COMPONENT l_col OF STRUCTURE <header> TO
<dynheader>.
IF sy-subrc NE 0. EXIT .ENDIF.
WRITE <dyndata> TO <dynheader> LEFT-JUSTIFIED.
ENDLOOP.
APPEND <header> TO <dynamictable>.
ENDDO."*Layout for ALV output
lt_layout-zebra = 'X'.
lt_layout-no_colhead = 'X'..
lt_layout-colwidth_optimize ='X'.
lt_layout-window_titlebar = 'ALV GRID TRANSPOSED'."*ALV Grid output for display
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
is_layout = lt_layout
it_fieldcat = lt_fieldcat
TABLES
t_outtab = <dynamictable>.
Regards,
Arun -
New Blog Post - Transposed Report Example
Hello,
For anyone that's interested, I just published a blog entry on creating "Transposed Reports".
http://www.danielmcghan.us/2009/11/transposed-report-example.html
Regards,
Dan
http://danielmcghan.us
http://www.skillbuilders.comWhile putting CSS into the body tag seems to work without issue I would prefer to put it into the head in its proper place.
I am using this Javascript to do that:
var ele = document.createElement("style");
ele.type = "text/css";
ele.innerHTML = "CSS CODE"; // Replace with CSS code.
document.head.appendChild(ele);
It works in all but IE8 and below (go figure). For IE8 I just left it in the body using IE conditional comments.
Now if only we could come up with a bit of sorcery for the meta tags!
kenneth_rapp said:
But every single bit of html and css and javascript rendered by our sites ought to be available to edit as we see fit, including what gets put out by the modules.
I could not agree more. While I can see restricting this to some level there is much more I wish we could have access to and edit.
Thanks for the Wizardly advice. => -
How do you set up Logic Pro 9 for transposing instruments?
Is it possible to set up Logic to recognise transposing instruments? In other words, if I'm playing a Bb trumpet part in C, the score would display the part transposed one tone higher & display the correct key signature, but it would still sound in C. The orchestral template does this for you, but I prefer to work from scratch.
Calicoprinter.Hi
You can do this on a region by region basis by selecting the appropriate Staff Style in the Score Inspector.
If you want to apply a particular Staff Style to a particular track automatically as you record, you can adjust the Style parameter at the bottom of the Track Parameter Box.
CCT -
Error during running a transpose package
Hi Experts,
We are facing an error while trying to run a transpose package. The package does not show the lines for selection of source and destination path and it gives an error when we try to click on the advance tab to see the parameters being passed in the package.
Also the package is running correctly in one server but not the another one though both the servers have exactly the same environment.
Please help us with your valuable advice.
Thanks,
Regards,
Kamya NagpalTry posting on the OA Framework forum.
-
I am trying to type a password into a Pages document. It types in OK, but when I press return or close the document some of the letters in the password get transposed. What happens and how can I fix this? Thanks.
Are you just typing ordinary text into a word processing document or are you trying to set a password on the document itself?
If it is the first perhaps Pages is trying to spell check the password. You can tell it to ignore that "word", or turn spellchecking off.
Peter -
In need of a macro to transpose data from horizontal to vertical
I need help creating a macro that would transpose some data from horizontal to vertical.
You just want to transpose some data from horizontal to vertical?
If so ,you can use array formula TRANSPOSE.
Also here is a sample Macro:
Sub Macro1()
' Macro1 Macro
Range("A1:B3").Select
Application.CutCopyMode = False
Selection.Copy
Range("H1").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=True
End Sub
It would be better if you can let us know your current data and what you are trying to achieve.
Wind Zhang
TechNet Community Support
Maybe you are looking for
-
Not able to add driver update during Solaris 10 installation on IBM x3550
I am facing a problem with installation of Solaris 10 on IBM x3550. My question is not specific to IBM server. I am trying to add SAS driver during Solaris 10 installation. I selected option "Apply device driver update" (option # 4). It is asking to
-
How to send the output of a script to a txt or rpt file using T-sql?
Hi! I have some code which we use to record info about a database when we decommission it. I normally click Query > Results to File and then run it to produce a file. I need to do this via t-sql so I can automate it. Any idea what code I need to mak
-
Using CS4-- I am new to Flash (2 weeks in). I have a swf in a tooltip (that appears w/cursor over the reel image). When I preview the page, the skin and the clip are both visible and work correctly. However, when I load the page and try to view it
-
Error when instantiating a Com( EXCEL.APPLICATION) object in WINDOWS XP
Hi, I am using coldfusion MX7 and OS is WindowXP. I am using COM object with Excel.Application for my program. but it is giving the below error. But same program is working in Window Profesional. ERROR IS: An exception occurred when instantiating a C
-
I attempted to update from iOS 6 to iOS 7 had no problems downloading the update until it froze on the screen with only an apple and the loading bar. To remedy this I factory restored my iPhone 5 and downloaded iOS 7 from iTunes. Now I can make it