How to add particluar column dynamically to an internal table

Hi
How can I add particluar column(s) to an internal table dynamically and then display in an alv.
for eg:
There are 5 columns and the 4th column is the <b>period (1 to 12)</b> that has been declared as select-options in the selection screen.
col1 = bukrs
col2 = lifnr
col3 = akont
<b>col4 = period</b>
col5 = waers
so my question is
if period is in the range from 1 to 3 then the internal table should be
bukrs  lifnr  akont   <b>period1   period2  period 3</b>  waers. 
likewise if the period is in the range from 1 to n then internal table should be
Bukrs  lifnr   akont   <b> period1   period2   period3   period4 .....  periodn  </b> waers.
Thanks

Hi,
First create a global field catalog with all 12 periods ie period1, period2, ....period12.
Once you have fieldcatalog with all 12 periods
Then use this code arrive the dynamic field in the fieldcatalog
data : begin of i_period occurs 0.
data : period type i.
data : end of i_period.
data : v_no type i value 1.
do.
  i_period-period = v_no.
  v_no = v_no +1.
  if v_no eq 12.
     exit.
  endif.
enddo.
" Here arrive the periods that are not belong to selection option period
delete i_period where period in s_period.
data : v_fldname like dd03l-fieldname.
loop at i_period.
  concatenate 'PERIOD' i_period-period into v_fldname.
  condense v_fldname no-gaps.
  read table i_fieldcat with key fieldname = v_fldname.
  if sy-subrc eq 0.
     delete i_fieldcat index sy-tabix.
  endif.
endloop.
After this loop your field catalog contains only valid period that equal to selection option period
aRs

Similar Messages

  • How to add a column at the end of table in already designed document..?

    Hi,
    I am writing a javascript for adding a column at the end of table in Indesign document. using our plug-in we have created the Indesign document.
    Each table i want to add one extra column at the end. Is it possible..? please help me if anyone has idea regarding this.
    Thanks,
    Vimala L

    Hi Vimala,
    Please try the below JS code, This code will add the new column in every table last column after.
    var myTable = app.activeDocument.stories.everyItem().tables.everyItem().getElements();
    for(i=0; i<myTable.length; i++){
       myTable[i].columns.add(LocationOptions.after, myTable[i].columns[-1]);
    thx,
    csm_phil

  • How to add a group of rows in internal table

    Hi champs,
       I have some requirement.
    I have one internal table which contain 4 columns .out of which 3 has some numeric value and first has some letters e.g A ,B,C etc.
    Now suppose i have 20 rows in itab in which 10 are A 5 are B and 5 are C .Now as column 3 has numeric values i need to get the total of column 3 for all A ,B and C .
    How to solve this problem.Please guid me.
    thanks in advance
    Jhon

    Hi,
    Check the following code:
    DATA: BEGIN OF LINE,
    COL1 TYPE C,
    COL2 TYPE I,
    COL3 TYPE I,
    END OF LINE.
    DATA ITAB LIKE HASHED TABLE OF LINE
    WITH UNIQUE KEY COL1 COL2.
    LINE-COL1 = 'A'.
    DO 3 TIMES.
    LINE-COL2 = SY-INDEX.
    LINE-COL3 = SY-INDEX ** 2.
    INSERT LINE INTO TABLE ITAB.
    ENDDO.
    LINE-COL1 = 'B'.
    DO 3 TIMES.
    LINE-COL2 = 2 * SY-INDEX.
    LINE-COL3 = ( 2 * SY-INDEX ) ** 2.
    INSERT LINE INTO TABLE ITAB.
    ENDDO.
    SORT ITAB.
    LOOP AT ITAB INTO LINE.
    WRITE: / LINE-COL1, LINE-COL2, LINE-COL3.
    AT END OF COL1.
    SUM.
    ULINE.
    WRITE: / LINE-COL1, LINE-COL2, LINE-COL3.
    SKIP.
    ENDAT.
    AT LAST.
    SUM.
    ULINE.
    WRITE: / LINE-COL1, LINE-COL2, LINE-COL3.
    ENDAT.
    ENDLOOP.
    Regards,
    Bhaskar

  • How To Know The Column Name Of The Internal Table

    HI ,
            i have an internal table .
    f1          f2           f 3         f4            f5  
    matnr   mbrsh    mtart     meins       minbe
    i want to know the column name which depending on the value i.e . if it is matnr then f1 , if mbrsh it is f2 ..so on
    Thanks.

    Hi ,
          thanks for your replies . i am elaborating my query .
            I have an internal table with 80 fields i.e.f1,f2,f3......f80 . In the first index i will be having the fieldnames
    i.e.matnr , mbrsh , meins , mtart ..... . From second index onwards i will be having the corresponding data  for the field name.  i need to display a particular field in a table control . Here i will be knowing the fieldname. If i can get to know the column name i.e whether f1 or f2 or ... .i Can populate the data into the table control.
    Wht i have done is taken a field symbol  and used the following code.
    read table i_upload index 1  assigning <lv_upload>.
    here i will get the initial first record i.e
    F1                                             MATNR
    F2                                             MBRSH
    F3                                             MTART
    F4                                             WERKS
    F5                                             LGORT
    F6                                             VKORG
    F7                                             VTWEG
    F8                                             MAKTX
    F9                                             MEINS
    F10                                             MATKL
    F11                                             BISMT
    F12                                             BRGEW
    F13                                             GEWEI
    F14                                             NTGEW
    F15                                             GROES
    F16                                             KLART
    F17                                             CLASS
    F18                                             SPART
    F19                                             VRKME
    F20                                             UMREN
    now i want to the field name .
    Hope it is clear this time .
    Thanks.

  • How to add a column of checkboxes in a table?

    Hello, can anyone help me with this?
    I'm using myfaces , and I want to add a selectManyCheckBox inside a table, in order to select multi-row of the
    table.
    My code didn't work. It seems that I can only use static values for the 'itemValue' attribute of <f:selectItem> tag.
    May someone give me some suggestion?
    Here is my page:
    <f:view>
    <x:saveState value="#{fishSalesBean}"></x:saveState>
    <h:form>
    <h:panelGrid columns="1" columnClasses="first, first, first, first">
    <x:dataTable id="dataTable" value="#{fishSalesBean.fishes}" var="fish"
    width="800" columnClasses="first, first, first, first" binding="#{fishSalesBean.dataTable}">
    <h:column>
    <f:facet name="header">
    <h:outputText value="Select"/>
    </f:facet>
    <x:selectManyCheckbox id="checkboxes" layout="pageDirection" value="#{fishSalesBean.selected}">
    <f:selectItem itemValue="#{fishSalesBean.dataTable.rowIndex}" itemLabel=" a"/>
    </x:selectManyCheckbox>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="FishName"/>
    </f:facet>
    <h:outputText value="#{fish.name}"></h:outputText>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="picture"/>
    </f:facet>
    <h:graphicImage value="#{fish.picUrl }" />
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="price"/>
    </f:facet>
    <h:outputText value="#{fish.price}"></h:outputText>
    </h:column>
    <h:column>
    <f:facet name="header">
    <h:outputText value="isSold"/>
    </f:facet>
    <h:outputText value="#{fish.sold}"></h:outputText>
    </h:column>
    </x:dataTable>
    <h:commandButton value="Show Selected" action="#{fishSalesBean.showSelected}"></h:commandButton>
    </h:panelGrid>
    </h:form>
    </f:view>

    Check the "Select multiple rows" chapter of this article for 2 ways of selecting multiple rows in a table using checkboxes: http://balusc.blogspot.com/2006/06/using-datatables.html

  • FBL5N : how to add a column of the Account's name?

    Hi,
    the list displayed by Tcode : FBL5N contain only the number of account, please how to add a column of Account's name ?
    Please advise
    Regards.

    When you are in the FBL5N display results screen, use the menu option Settings --> Special Fields. 
    There are also the following notes which would explain you how to add special or new fields to the line items :
    - 310886     Line items: Dynamic selections ignored
    - 215798     FBL*N: Special fields are not displayed
    - 373268     Line item: new display field
    The special field has to exist in table T021S.

  • How to create  some columns dynamically in the report designer depending upon the input selection

    Post Author: ekta
    CA Forum: Crystal Reports
    how  to create  some columns dynamically in the report designer depending upon the input selection 
    how  export  this dynamic  report in (pdf , xls,doc and rtf format)
    report format is as below:
    Element Codes
    1
    16
    14
    11
    19
    10
    2
    3
    Employee nos.
    Employee Name
    Normal
    RDO
    WC
    Breveavement
    LWOP
    Sick
    Carers leave
    AL
    O/T 1.5
    O/T 2.0
    Total Hours
    000004
    PHAN , Hanh Huynh
    68.40
    7.60
    76.00
    000010
    I , Jungue
    68.40
    7.60
    2.00
    5.00
    76.00
    000022
    GARFINKEL , Hersch
    66.30
    7.60
    2.10
    76.00
    In the above report first column and the last columns are fixed and the other columns are dynamic depending upon the input selection:
    if input selection is Normal and RDO then only 2 columns w'd be created and the other 2 fixed columns.
    Can anybody help me how do I design such report....
    Thanks

    Hi Developer life,
    According to your description that you want to dynamically increase and decrease the numbers of the columns in the table, right?
    As Jason A Long mentioned that we can use the matrix to do this and put the year field in the column group, amount fields(Numric  values) in the details,  add  an filter to filter the data base on this column group, but if
    the data in the DB not suitable to add to the matrix directly, you can use the unpivot function to turn the column name of year to a single row and then you can add it in the column group.
    If there are too many columns in the column group, it will fit the page size automatically and display the extra columns in the next page.
    Similar threads with details steps for your reference:
    https://social.technet.microsoft.com/Forums/en-US/339965a1-8cca-41d8-83ef-c2548050799a/ssrs-dataset-column-metadata-dynamic-update?forum=sqlreportings 
    If your still have any problem, please try to provide us more details information, such as the data structure in the DB and the table structure you are currently designing.
    Any question, please feel free to let me know.
    Best Regards
    Vicky Liu

  • How to add a column in table control

    Hi ,
       Can any one tell me how to add a column in table control? My requirement is to add two columns ( custom fields ) into table control ( It is a standard program). I have added the column in the table and also in the table control. But when I am running the standard program, The newly added column is not there. But I have added in the perticular screen. Change is not reflected.
       Can anyone help me on this please.
    Thanks in advance.
    Regards,
    Lakshmi.

    Hi,
    Ensure the following :
    1. After adjusting the database, you`ll have to use the database utility and activate the table.
    2. If you have changed the standard screen, in tcode se80 -- right click on the program and click activate all. This activates all objects related to that program.
    Now execute the program.
    Reward if helpful.
    Regards

  • How to add different columns in a single dashboard prompt?

    Hi
    I am new to this forum. I got a new requirement, my client is asking me to show multiple columns with multiple tables in a single dashboard prompt
    for Ex: Column name Table name
    1. Customer 1. Customer Details
    2. Market 2. Region
    3. Order 3. Order Status
    4. Product 4. Product Type
    He wants to show all these column names in a single prompt when user click on the particular column name it should appear on report. Is it Possible? if possible tell me how?

    See this thread...
    Re: How to add new columns by using Multiselect

  • How to add two columns in OBIEE report?

    Hi to All,
    Can anyone tell me how to add two columns in OBIEE report and get that result in a new column?
    Thanks in Advance,
    Thenmozhi

    Assume you already have two columns SalesAmt1 and SalesAmt2, and you want to derive 3rd column say SalesAmt3 which would be the sum of SalesAmt1 and SalesAmt2.
    For this, as I mentioned above pull SalesAmt1 and SalesAmt2 columns in Report. Now pull another column (say SalesAmt1) and open the fx. Clear the contents of fx. Now locate the columns button in the bottom of the fx. From Here, first select SalesAmt1 and + sign and the select SalesAmt2.
    Now in this new column, the fx should look like SalesAmt1 + SalesAmt2.
    Let me know if you are looking for something else.
    Thanks

  • HOW TO: Add /manipulate columns for a GridControl

    HOW TO: Add /manipulate columns for a GridControl when the columns (attributes) are from different entity objects.
    This HOWTO describes the basic steps of using attributes from different entity objects for a GridControl.
    One way you can create a GridControl which contain attributes from different entity objects is to create a view object and base it on the entity objects which contain
    the desired attributes.
    Here are the basic steps:
    1.Create a new view object (or use an existing view object) by selecting File>New from the menu, clicking the Business Components tab and double-clicking
    on the View Object icon.
    2.In the View Object wizard change the name to something meaningful.
    3.Select the entity objects you will base your view object on.
    4.Nivigate to the attribute screen and select the attributes you would like to include in your view object from each entity object. At this point you can also create
    a new attribute by clicking the "New" button. The new attribute can be a concatenation of other attributes, derived from a calculation etc.
    5.In the query panel of the View Object wizard, click "Expert mode" and enter a query statement. You write complex queries such as decoding a set of attribute
    values.
    6.Add your newly to your newly created view object to the application module by double-clicking on the application module in the navigation pane and selecting
    your view object from the list.
    7.Create a new row set.
    8.Bind row set to a query by editing their queryinfo property and selecting your view object and its attributes from the queryInfo pane.
    9.Create a GridControl and bind it to the row set by editing the dataItemName property of the GridControl. Since the GridControl is bound at the row set level
    all of the related attributes are automatically added.
    null

    Michael,
    Are you intending this as a commercial solution or a work around?
    To take an existing equivalent, one would build a view in the database tailored for each grid in an Oracle Forms application. Or a separate query layered over tables for each form/grid in a Delphi or Access application? Even if it is ninety nine percent the same over half a dozen forms/grids?
    And now you've added a whole slew of "slightly different" rowSetInfos to maintain.
    So if you wanted to add a column that needs to appear everywhere... you've just increased the workload multi-fold?
    That would be a management nightmare, wouldn't it? Not to mention yet more performance cost and a slower system?
    Hmmmm..... I'm not sure I like where this is headed... someone needs to do some convincing...
    null

  • How to add a frame dynamically in a jsp page.

    Hai all,
    In my application, in a particular jsp page i had the 3 links namely add.edit and delete. When click on add button, it is pointing to another jsp page where i can enter user details. But what i want now is when i click add button, the form in which we fill the user details should be added to the current page itself dynamically i.e., it should not go to another page when i click add button and that form should be displayed in the current page in a new frame dynamically.
    The same should happen when i click n edit or delete options. everything should be diaplayed in the same page in different frames.
    Can anyone suggest me about how to add a frame dynamically.

    You create a frameset with two frames. One frame you give 100% of the rows and run the JSP in this frame. The other frame you give 0% of the row so that it is hidden. In the JSP you use a JavaScript funtion to submit the form. This function will call the parent frameset to reset the row values to 50%/50% which will make the bottom frame visible and then submit the form request with the bottom frame as teh target.
    It is not so much as creating frames as using JavaScript to hide and display frames.

  • Office 365 - sharepoint: In Advanced search Page, How to add custom column under property restrictions

     In Advanced search Page, How to add custom column under property restrictions?

    Hi,
    The Navigation control can be added into your HTML page in the Snippet Gallery:
    The two links below about how to create HTML master page and adding snippets needed into it for your reference:
    http://borderingdotnet.blogspot.jp/2012/12/how-to-create-html-masterpage-for.html
    http://msdn.microsoft.com/en-us/library/office/jj822370(v=office.15).aspx
    Feel free to reply if there still any question.
    Best regards,
    Patrick
    Patrick Liang
    TechNet Community Support

  • How to add multiple columns?

    Using designer API, how to add multiple columns to the repository tables? I want to add number of columns at a time instead of adding column by column.
    Thanks in advance.

    Can you use sqlplus?
    ALTER TABLE table_name ADD (column_name data_type), (Column_name datatype),...
    Check the SQL Reference 11-9.
    Hope this helps.
    Bill Swanson

  • How to add one column in existing search help.

    Hi Folks,
    My quesion is
    How to add one column in existing search help and also Now search help on that field is not an explicit search help. It should be implement using check table.
    Shivam

    Hi,
    If you want to add a field in Elementary search help, get the search help name for the and go to change mode and add the field in it.
    If you want to add a field in collective search help, go to included search helps tab and a new search help name and add the fields to it.
    I think this should help you to certain extent.
    Regards,
    Kranthi
    Edited by: Kranthi on Jan 14, 2010 11:15 AM

Maybe you are looking for

  • How do I create Folders in Mail?

    I recently migrated from Eudora to Mail. In the process I brought some Folders in which I filed mailboxes, in some cases there were folders in folders. All are there well and clear. How do I create a Folder into whch I can put more sub folders or mai

  • Setting to break up the html code into small piecces?

    i was told that there is a dreamweaver setting or command where you can make your html generate break up the code into smaller pieces but i dont know how that can happen. anyone to help me? i appreciate it

  • Uninstall PSE 10 (to install 12)

    I had PSE 10 and Premier 9 installed in Win.7^64. Bought PSE 12 and Premier 12.   PSE 10 is not listed in Control Panel for uninstalling.  (Noticing after its long use only when  I wanted to UN-install).  PSE 12 won't install unless PSE 10 is gone. 

  • Why can't I use my mute, volume, up or down buttons on my MacBook air?

    when  I try to use these buttons on the keyboard it flips to another page. I went into sound to see if I could fix this problem but nothing happens? Thanks for any advice.

  • How To Save Corrected Images

    After correcting an image in LR, is "Export"ing the new image Adobe's way of saying "Save" or is there a "Save" or "Save As" command that i just can't find? (P.S. not talking about metadata)