How to Output data in vertically from a horizontal format.

Hello
I have some difficulties how to display my data in my output table. I am greatful for
every tips provided. The data in my it_tab is in a horizontal format but I want to
display this data vertically in my output_tab.
My it_tab looks like this:
table: it_tab
id   date   amnt
011  2007   1200
011  2008   1400
011  2009   6700
011  2010   3500
012  2007   ---
013  2007   3000
013  2008   1300
014  2007   1200
014  2008   ---
014  2009   9000
015  2007   2500
I would like my output_tab should look like this:
table: t_output
id  name  date amnt  date1  amnt1 date2  amnt2 date3  amnt3
011 jx    2007 1200  2008   1400  2009   6700  2010   3500
012 tx    --
014 gx    2007 3000  2008   --    2009   9000   --    ---
015 hx    2007 2500
t_output already has some data init like id and name.
This is what I have done but I don't output all the data as I want.
clear w_output.
loop at t_output into w_output.
clear w_itab.
loop at it_tab into w_itab where id = w_output-id.
case sy-tabix.
WHEN '1'.
w_output-date = w_itab-date.
w_output-amnt = w_itab-amnt.
WHEN '2'.
w_output-date1 = w_itab-date.
w_output-amnt1 = w_itab-amnt.
WHEN '3'.
w_output-date2 = w_itab-date.
w_output-amnt2 = w_itab-amnt.
WHEN '4'.
w_output-date3 = w_itab-date.
w_output-amnt3 = w_itab-amnt.
endcase.
endloop.
modify t_output from w_output.
endloop.
Could some body please tell me how to do this? I think many people in here have come
across this type of problem before.
Thank you all for helping out.
Nadin

Hi, Nadin!
I suggest you to create a dynamic internal table with variable number of columns. You can do as follows:
1. Create basic fieldcatalog for ALV list (or object) output
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
          EXPORTING i_structure_name       = 'ZYOUR_BASIC_STRUC'         
          CHANGING  ct_fieldcat = lt_fcat.
2. Determine max number of columns (that is, max number of dates for each ID)
SORT it_tab BY id.
LOOP AT it_tab INTO is_tab.
  AT NEW id.
    ADD 1 TO l_count.
  ENDAT.
  AT END OF id.
    IF l_count > l_max_count.
      l_max_count = l_count.
    ENDIF.
    CLEAR l_count.
  ENDAT.
ENDLOOP.
3. Add one entry to fieldcat for each column
DO l_max_count TIMES.
  l_index_char = sy-index.
  CONCATENATE 'DATE' l_index_char INTO ls_fcat-fieldname.
*... other fieldcat fields, like texts etc.
  APPEND ls_fcat TO lt_fcat.
  CONCATENATE 'AMNT' l_index_char INTO ls_fcat-fieldname.
*... other fieldcat fields, like texts etc.
  APPEND ls_fcat TO lt_fcat.
ENDDO.
4. Create dynamic table from fieldcat using:
DATA: dt_outtab TYPE REF TO data. "IMPORTANT: make this declaration global, otherwise error
FIELD-SYMBOLS: <table> TYPE STANDARD TABLE.
CALL METHOD cl_alv_table_create=>create_dynamic_table
       EXPORTING it_fieldcatalog = lt_fcat
       IMPORTING ep_table        = dt_outtab.
ASSIGN dt_outtab->* TO <table>.
5. Fill this table. To do this you need special techniques since you have a generic table with no static structure. For example:
FIELD-SYMBOLS: <line>  TYPE ANY,
               <field> TYPE ANY.
DATA: l_field_inex TYPE i.
LOOP AT it_tab INTO is_tab.
  AT NEW id.
    APPEND INITIAL LINE TO <table>.
    READ TABLE <table> INDEX sy-tfill ASSIGNING <line>.
    l_field_index = 3. "you start from 3rd field - #1 is ID, #2 is NAME
  ENDAT.
  ASSIGN COMPONENT l_field_index OF STRUCUTRE <line> TO <field>.
  <field> = is_tab-date.
  ADD 1 TO l_field_index.
  ASSIGN COMPONENT l_field_index OF STRUCUTRE <line> TO <field>.
  <field> = is_tab-amnt.
  ADD 1 TO l_field_index.
ENDLOOP.
6. Display your report in alv. You have valid fieldcat and output table which is created dynamically.
CALL METHOD o_alv->set_table_for_first_display
          CHANGING  it_outtab       = <table>
                    it_fieldcatalog = lt_fcat.
If you don't use ALV object but rather ALV list, it's similar. Just use corresponding functions for ALV creation and list display.
Note that this is not a tested code. Just an idea to help you procede.
<b><REMOVED BY MODERATOR></b>
HTH.
Regards,
Igor
Message was edited by:
        Alvaro Tejada Galindo

Similar Messages

  • How to view data in Xcelsius from an external Excel file

    Hi Everyone,
    i wonder if you know How to view data in Xcelsius from external Excel file and not depend only on the emebded excel sheet.

    Hi,
    As per my understanding, excel has to be imported in Xcelsius to draw up the dashboard. Your aggregated data sits in the xlf file. Using an external excel file will not be possible (I guess).
    One of the ways to connect to an external excel, is the use XML Maps but then your data has to be in the form of XML which will be pulled into excel first and then needs to be brought in Xcelsius using Data Manager.
    You can explore XML Maps in xcelsius in SDN.
    Regards
    Nikhil

  • How to output data to a file in SCC-SG04?

    I am using SCC-2345 with SCC-SG04 connected to NI-6221 in Windows 2000 in VC6.
    How to output data to a file like data1.dat in VC6 or in Labwindows/CVI?

    Hello mwibm,
    If you just want to do file input/output in LabWindows/CVI, I would take a look at the Formatting and I/O CVI library or the ANSI File I/O functions. For example, if you just want to write an array of data to a file, I would look at the ArrayToFile function or the fwrite/fputs/fprintf ANSI C functions included in stdio.h. The ANSI C functions will also work in Visual Studio. More information on the LabWindows/CVI File I/O functions can be found in CVI help, and more information on ANSI C functions can be found in CVI Help and online at various websites.
    Maybe you could further clarify what problems you are having and what kind of data you want to write to a file.
    Thanks.
    Wendy L
    LabWindows/CVI Developer Newsletter - ni.com/cvinews

  • How to download data in excel from web report in sap ?

    how to download data in excel from web report made  in sap abap?
    through tcode smw0.

    for exemple using
    MS_EXCEL_OLE_STANDARD_DAT

  • How-to extract data in chunks from one R3 to another R3 system

    Does anybody know how to extract data in chunks from one system to another? Imagine you would like to extract 1M records in chunks of 10K records, how would you do it between 2 different R3 systems? A cursor (even with hold) doesn't work
    Any suggestion appreciated
    Thanks
    Ioan

    Hi Ioan,
    I'd do it with fm : TABLE_ENTRIES_GET_VIA_RFC (with where clause-tab)
    or fm GET_TABLE_RFC (get all items)
    regards Andreas

  • How to Extract data and reports from the SAP BW warehouse

    Hi to All Guru's
    I am new to SAP BW. Can any one help me to know, How to Extract data and reports from SAP BW. Do we use any tools.  After Extracting the data from SAP BW how can we move all the data to Cognos.  It would be kind enough to provide me with any documentation or links.  Step by step procedure would be very much helpfull to me.
    Thanks
    Venu

    Hi Voodi
    Thanks for the quick response. I think Open hub is to extract the data from SAP BW, but what about sending this data into Cognos.  Can you please let me know in detail regarding answer. If possible send me any documentation or links regarding this.  Thanks for your concern.
    Venu

  • How do I save a PDF as an excel file when the PDF is horizontal. Adobe tries to rotate the page, but the data is entered in an  horizontal format.

    How do I save a PDF as an excel file when the PDF is horizontal. Adobe tries to rotate the page, but the data is entered in an  horizontal format.

    Thanks for the quick reply.  I figured out how to get the desired results by using tagging.  For anyone who may reference this post in the future, I went to "Customize" in the top right corner of Adobe, then selected "Create new tool set...", looked under "accessiblity and found the "tag" option.  Hit ok, tag is added to the toolbar.  Then I highlighted the dataset in the PDF that was relevant to the output format, then clicked "tag", saved as spreadsheet.  Sorry I can't provide more details on how tagging works or if there's a more elegant solution available, but I'm sure one's out there.

  • How can I convert output data (string?) from GPIB-read to an 1D array?

    Hello all,
    I am reading a displayed waveform from my Tektronix Oscilloscope (TDS3032) via the GPIB Read VI. The format of the waveform data is: positive integer data-point representation with the most significant byte transferred first (2 bytes per data point).
    The output data of GPIB-Read looks like a string(?) where the integer numbers and a sign like the euro-currency sign are seperated by spaces e.g. #5200004C3 4 4 4 4 3C3C3........ (C represents the euro-currency sign).
    How can I convert this waveform data into a 1D/2D array of real double floatingpoint numbers (DBL) so I can handle the waveform data for data-analysis?
    It would be very nice if someone know the solution for this.
    t
    hanks

    Hi,
    First of all, I'm assuming you are using LabVIEW.
    The first you need to do is parse the string returned by the instrument. In this case you need to search for the known symbols in the string (like the euro sign) and chop the string to get the numeric strings. Here are some examples on parsing from www.ni.com:
    Keyword Search: parsing
    Once you parse the numeric strings you can use the "String/number conversion VIs" in the String pallette.
    Hope this helps.
    DiegoF.Message Edited by Molly K on 02-18-2005 11:01 PM

  • How to output data when converting labview vi into matlab mex functions

    Hi,
    I am a fairly new user to labview and am currently working on labview
    7.1. I have created a labview vi which can extract data from ni daq
    6070e in real time. The problem is that this code has to be converted
    so that it can be used with matlab.in order to do that i am using math
    interactive tool kit which converts the labview code into mex files
    which can then be used in matlab. Unfortunately i have not been able to
    figure out how to output this data so that it can be processed in
    matlab easily. i cannot afford any loss of information and all the
    output must happen in real time. the o/p must take place after the fft
    has been done. i am attaching the vi for convenience.There are 10
    broken wires ,and this is the place where i want the o/p to be
    generated.
    Also do let me know if this vi can be further improved.
    Regards
    Attachments:
    RT_loop2ver4_working.zip ‏642 KB

    Manuj,
    You seem to have misunderstood the way in which LabVIEW processes data.  The code that you have produced will run in exactly the same way without the need for the case structure.
    The code does not actually run the data from the previous case. It is merely processing data from the previous loop iteration, regardless of the case. If you were to remove the case structure, leaving only one copy of the code intact, and remove the toggle switch you have produced, or used the shift register which, I assure you would have worked, then you will have exactly the same functionality.
    I have attached an example that uses the shift register to toggle cases, but also iterates that the case structure is not needed by using the same feedback node (and code) without a toggle switch or case structure.
    Hope this helps you optimize your code
    Regards
    AdamB
    Applications Engineer
    National Instruments UK
    Applications Engineering Team Leader | National Instruments | UK & Ireland
    Attachments:
    CASE_NO-CASE_Example.vi ‏24 KB

  • How to populate data in TargetCube from SourceCube for a particular product/currency dimension selected in form1.

    Hi,
    Need help regarding Business rule scenario "How to populate data in "Target Form (plantype2)" from "Source Form(plantype1)" for a particular product/currency dimension combination selected in form1"
    Scenario 1) :  I have data for Product(Computer)/Currency(USD) dimension combination in Source Form
                        When i open Target Form and then select a Product(Computer)/Currency(USD) combination and then right click on form to invoke a Business rule to get data for this same                     product/currency combination from Source Form.
    Scenario 2) : If there isnt any data in Source Form for product(Computer)/Currency(USD) combination, then the data for product(computer)/Currency(Default Currency) to be populated into Target                     Form.
    The members in Currency Dimension (Shared Dimension) are USD & Default Currency.
    Can anyone please help.
    Thanks,
    Rajkumar

    Adding to what Celvin Kattookaran has said
    You can either write a Business Rule / Calculation script with @XREF function and also you can check condition if there is data in USD then populate USD else "Default currency"
    If you want that data in source to be available in target, then you can use @XWRITE in a rule from source cube to push the data to Target.
    Amarnath
    ORACLE | Essbase

  • How to merge data in BW from R3 and a legacy source

    Hi
    I would like to combine data from R3 and from a legacy system in BW as follows: I have two similar info objects:
    One info object contains the stuff from R3 (which contains some history but basically the data is just really well maintained starting from Jan 1st 2008.
    The other info object contains data from a legacy HR data warehouse which contains data back to 2001 and up to Dec 31st 2007.
    I would like to combine in BW the two info objects in a multiprovider such that if I make a query before Jan 2008 then the data is taken from the 'legacy' infoobject and when I run a query as of Jan 2008 or later then the data should be taken from the 'R3' info object. (Note that if I specify a range e.g. Dec 2007 - Jan 2008 then data from both info objects are to be taken).
    A problem I see is that the DATEFROM of rows in the time dependent tables of the 'R3' info object is not as of Jan 1st 2008 but can be any date before. Thus I wonder how an overlap between the 2 sources can be avoided.
    Is there a way to acomplish this?
    Regards and thanks for your help, Felix

    The how to at following url shows how to store, retrieve and display characters of different languages from Oracle database onto a JSP page.
    http://otn.oracle.com/sample_code/tech/java/codesnippet/jdbc/nls/Globalization.html
    HTH
    Chandar

  • How to see data in BAM from sensor on BPEL activity?

    Hello, I 'am working with BPEL on Jdeveloper (last version).
    I have putted sensors on some activity of my process. On an other machine I have putted the BAM server (last version) which is ON and I have the BAM connection on Jdevlepper. Now I try to see data on BAM from sensor but I can't.
    Can someone explain me how to do?
    (I just can build some data just like in a data base with BAM architect but I can't read and put to graphics the ones from the sensors)
    Thank's much
    JAck

    Hello,
    To answer your question, I have install BAM on the same machine where BPEL server is running.
    Now I steel can't get sensor's data from BPEL:
    With BAM architect I can build data, with BAM studio I can use that data to design graphics but when I try to feed data from BPEL it doesn't work because I just can't press the OK button!!
    In BPEL : When I try to Create BAM sensor action (from structure panel), I can't generate the xsl map file no action is done when pressing OK, create mapping or edit mapping button!

  • How to output data outtside a for loop every 10 iterations​?

    Hi friends,
    does any body help me to sort out this problem?
    please check the attchement for my vi.
    all i want is output data from inside for loop to outside for loop every 10 iterations. please do not use local variable.
    Many thanks
    dan
    Attachments:
    output.vi ‏16 KB

    Hi Dan,
    I am not sure what you want to do every 10 iterations with the value outside, but If you want to update your graph every 10 iterations use the following way:
    If you want to handle the specific value every x iterations outside the loop you could either use queues or notifieres.
    BR,
    ThSa
    Message Edited by ThSa on 08-23-2006 09:05 PM
    http://www.newgistics.com
    Attachments:
    1.png ‏6 KB

  • How to store data in ipad from computer

    please explain me how to store data (music video & pictures) in  ipad from any personal computer...kindly explain me in simple steps...

    The iPad can only sync with one computer.  To do this you need to have iTunes installed on the computer and have it associated with your Apple ID.  you can then use iTunes to transfer music, movies and pictures from that computer, and that computer only.
    iOS: Syncing your data with iTunes
    http://support.apple.com/kb/ht1386
    If you need to get files from other computers, you would need a 3rd party App that can handle the formats you wish to transfer, and possibly transfer them either through iTunes file sharing or Wifi transfer depending on what the App supports.
    iOS: About File Sharing
    http://support.apple.com/kb/ht4094

  • How to handle data that got from SAP by Webservice?

    Hi, Gurus.
    I am working on IFbA with ABAP and Adobe LiveCycle Designer.
    I've developed a function module in R/3 system and created webservice, connected the WSDL address to the form. The problem is how can i handle data that got from SAP by Webservice?
    It's Ok if i bind the dataconnection node to the form element, but how can i handle data without binding to the form element? I mean that how can i use the data retrieved from Webserivce in the Javascript, please give me some sample code or script method.
    Thanks.

    Hi Yang,
    If you are using Web Service, then the binding will be done automatically.
    It can't grow automatically, what else should i do to achieve this?
    1.Select the table(make sure you are not selecting subform) in Hierarchy view
    2. Under table select the Row which is having the required fileds for data
    3. In the Binding of that row, check the checkbox "Repeat Row for each item data" and under that check the Min Count which will set the default row **** to 1
    Regards,
    Sachin

Maybe you are looking for

  • Plant to Company Code

    Hi Gurus, I am new to SAP MM. I was asked to re-assign a plant to another company code. I know how to assign(OX18).But do i have to delete the previous one and assign it to the new one. Eg: Plant 25 is assigned to CC 34,now they wanted me to assign i

  • Tying a Master Page to a Paragraph Style

    As a relative newbie to InDesign (and indeed book layout) I'm really chuffed that my first attempt looks pretty good now I have the first proof in my hands. Have had a few small tweaks to sort out and one thing that I have found cumbersome is that I

  • My menu bar is screwed up

    I just updated to Mavericks and as you'll see, the menu bar is messed up. I've reset PRAM, rebooted the computer a few times and it still looks like this. I notice that when it's plugged into a second display, the menu looks like this and the second

  • Sometimes Business Rules disappear

    Hi. I have a probleme in Planning. I open web browser, connect to application and see my Business Rules, after 10-30 minutes (work with form etc.) they disappear. I log off, then connect to Planning and I see Business Rules again. What is it? Mike.

  • TOC in Captivate 4

    I have a project created in Captivate 4 via importing a power point. When I add the table of contents, the power point slides start to overlay each other when playing the project. There is also some Action Script for some questions we wanted to do a