Dynamic column fields of ResultSet

Hi guys,
I am working on a web-based system where user also specifies the column fields of ResultSet he/she wants to see. SQL query will display all the results for those selected column fields only.
Suppose user selected Last Name and First Name.Then my ResultSet will display reports with Last Name and First Name column headings and first name and last name values only of the ResultSet.
If the user specifies ID number, Address,City, State, Zip then ResultSet will display reports with these column headings and values only.
I am using Oracle 8i to pull the values.Anyone got any idea how to implement it?
Any help or suggestion would be highly appreciated.
Thanks

Ok Guys, I am attaching a small part of my code on the page below. This is the working code that I have written till now.
NOw problems with this:
(1) I can easily substitute "*" in SQl query with the column field variables. But first of all I need the columns to appear in order of priority. Like as I said earlier if last name, first name selected it should appear first then the address and so on.
(2) The Column names that I have hardcoded, how to do away with that while still having column names on top like "First Name" and "Last Name"
<jsp:useBean id="DataBean" scope="request" class="office.DataBean" />
<jsp:useBean id="FormBean" scope="request" class="office.FormBean" />
<%
String result = "";
DataBean.connect();
FormBean.setRequest(request);
String classify[] = request.getParameterValues("classify");
int size2 = classify.length;
String beta = "";
String beta1 = "";
if ((size2 == 1) && (classify[0].equals("all")))
beta = "all";
else if ((size2 == 1) && (classify[0] != "all"))
beta = "wk_char30_4 = '" + classify[0]+ "'";
else if ((classify[0].equals("all")) && (size2 != 1))
beta = "all";
else
for(int p = 0; p < size2-1; p++)
beta1 = beta1 + "'" + classify[p] + "'" + ",";
beta1= beta1 + "'" + classify[size2-1] + "'";
beta = " wk_char30_4 IN (" + beta1 + ")";
%>
<h3 align = center>Selected Employee Records between <%=begin%> to <%=end%> </h3>
<%
boolean filterbyclassify = beta.equalsIgnoreCase("all");
String sql = "SELECT * FROM f_personnel, f_repair_center where" +
(filterbyactive?" wk_active IN ('YES','NO') ":" wk_active = '" + active + "'") +
(filterbysupervisor?"":" and wk_is_supervisor = '" + supervisor + "'") +
(filterbyclassify?"":" and " + beta )+
" ORDER BY wk_last_name, wk_first_name";
DataBean.setSql(sql);
int counter = 0;
int temp = 0;
%>
<html>
<title>
Employee System
</title>
<body>
<script type="text/javascript">
function set(n,length)
var thisBox;
for (i=0; i < length; i++)
thisBox = 'document.myForm.req' + i;
eval(thisBox).checked = n;
</script>
<table border=2 cellpadding=4 align=center bordercolor=black>
<tr align=center>
<td ><h4>Select</h4></td>
<td ><h4>Last Name</h4></td>
<td ><h4>First Name</h4></td>
<td ><h4>ID Code</h4></td>
</tr>
<% String lname="",fname="",code="";%>
<form name="myForm" action= "test2.jsp" method = "post">
<% while (DataBean.getNextRow())
lname=DataBean.getString("wk_last_name") ;
fname=DataBean.getString("wk_first_name") ;
code=DataBean.getString("wk_id_code");
%>
<tr align=left bgcolor= <% counter++; if (counter % 2 ==1) out.print("#CC9999"); else out.print("#D3D3D3");%>>
<td ><input type="checkbox" name="req<%=temp%>" value="<%=lname%>,<%=fname%>,<%=code%>"></td>
<td ><font size="-1"><%=lname%></font></td>
<td ><font size="-1"><%=fname%></font></td>
<td ><font size="-1"><%=code%></font></td>
<%temp++ ;%>
</tr>
<%
}%>
<input type = hidden name=temp value=<%=temp%>>
<input type = hidden name=begin value=<%=begin%>>
<input type = hidden name=end value=<%=end%>>
<p>
<input name=button onclick=set(1,<%=temp%>) type=button value="Select All">
<input name=button onclick=set(0,<%=temp%>) type=button value=" Reset ">
<input type =submit name="Save Selection" value = "Save Selection">
</p>
</form>
</table>
<% DataBean.disconnect(); %>
</body>
</html>

Similar Messages

  • How to use dynamic column fields in formulas

    Hi,
    we changed from CR 8.5 to CR XI R2.
    Many of our reports use dynamic queries with different count of columns.
    These reports are designed for the maximum count of columns.
    This works fine with CR 8.5 but with CR XI R2 it seems to be that if one of these columns is missing i get an error in all formulas using this missing columns.
    How can i use or check this columns in formulas?
    regards
    Michael

    Could it be because of null values?  Try File -> Report Options and then check the box next to convert null values to default values and see it that helps or you can go into the formulae and choose Default Values for Nulls.  Either of these options should plug a zero if the values happen to be nulls.

  • "Dynamic column" in the workplace

    Hi experts.
    Do somebody know the possible uses of the "Dynamic column" field in the task registers of the Workflow inbox? You can add some dynamic columns via the "select layout" menu of the workplace but they seem to be empty.
    I'm wondering if I can put some custom dynamic information on them via workflow definition (information such like users names or maybe some filter criteria) in order to help the user to show and order the active tasks easily.
    Any help on this topic will be interesting for me.
    Thank you all!!
    Ismael

    Hi Ismael,
    Dynamic columns are specific to each task, you can define them using tx SWL1.
    Once defined, the dynamic column fields should now be available. However they do take a performance hit and obviously the fields are not applicable to all tasks. For this reason it is not a good idea to have a dynamic column as a default layout, but to use them in the in the task-based inbox views:
    In the workplace view Inbox -> Workflow -> Grouped by task -> the task you just defined (you must have a workitem of that task already in your inbox). Define a layout and save it as a default, teach your users to navigate to a task if they want to use the columns.
    Of course some users can still create their own workflow inbox view with dynamic columns if e.g. the majority of their work is a particular task.
    Cheers,
    Mike

  • Dynamic column Headers without field symbols

    Hi All,
    how to create a dynamic column header(Not a Dynamic Column with Hard Coded One) with Internal Tables
    (Not with Field Symbols as i can find some programs with field symbols  during search) .
    Please Provide an example wih some piece of sample code .
    Any Help would be appreciated.
    Thanks & regards,
    Ravi S.

    You will have to use dynamic programming techniques for the same, there is no other way around I can think of.
    You will find Rich's Blog quite helpful,
    [Dynamic Internal Table|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=%28J2EE3417800%29ID1759109750DB10206591421434314571End?blog=/pub/wlg/2071]
    If you haven't used field symbols before, just do it this time, they are very helpful for dynamic programming.
    Thanks,
    Aabhas

  • How can we get Dynamic columns and data with RTF Templates in BI Publisher

    How can we get Dynamic columns and data with RTf Templates.
    My requirement is :
    create table xxinv_item_pei_taginfo(item_id number,
    Organization_id number,
    item varchar2(4000),
    record_type varchar2(4000),
    record_value CLOB,
    State varchar2(4000));
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'USES','fever','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'HOW TO USE','one tablet daily','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'SIDE EFFECTS','XYZ','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'DRUG INTERACTION','ABC','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'OVERDOSE','Go and see doctor','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'NOTES','Take after meal','TX');
    select * from xxinv_item_pei_taginfo;
    Item id Org Id Item Record_type Record_value State
    493991     224     1265-D30     USES     fever     TX
    493991     224     1265-D30     HOW TO USE     one tablet daily     TX
    493991     224     1265-D30     SIDE EFFECTS     XYZ     TX
    493991     224     1265-D30     DRUG INTERACTION     ABC     TX
    493991     224     1265-D30     OVERDOSE      Go and see doctor     TX
    493991     224     1265-D30     NOTES     Take after meal     TX
    Above is my data
    I have to fetch the record_type from a lookup where I can have any of the record type, sometime USES, HOW TO USE, SIDE EFFECTS and sometimes some other set of record types
    In my report I have to get these record typpes as field name dynamically whichever is available in that lookup and record values against them.
    its a BI Publisher report.
    please suggest

    if you have data in db then you can create xml with needed structure
    and so you can create bip report
    do you have errors or .... ?

  • Is it possible to display only dynamically selected fields in the out put?

    Is it possible to display only dynamically selected fields in the out put? i need to display set of columns in the selection criteria, but in the output i have display only input given fields. because i need to convert it into .csv file. So i have to display selected fields from internal table. In oracle they are using"execute immediate". is there any equivalent in SAP?
    thanks in advance.

    Hi Remya,
    Are you talking about dynamic programming in ABAP ?
    If yes, there are concepts like RTTS which facilitates it.
    Yes, the select query also supports dynamic selection of fields. ( Please care about ( ) in dynamic sql ).
    Do more research on Field Symbols and statements like ASSIGN COMPONENT OF.
    Regards,
    Philip.

  • How to change recordset bahaviour to accept dynamic column names in the where clause

    Hi
    im using php-mysql and i make a recordset and i want to make the column names in the where clause to be dynamic like
    "select id,name from mytable where $tablename-$myvar";
    but when i do this my i break the recordset and it disappear
    and when i use variables from advanced recordset it only dynamic for the value of the column not for the column name
    and when i write the column name to dynamic as above by hand it truns a red exclamation mark on the server behaviour panel
    so i think the only way is to change the recordset behaviour is it? if so How to make it accept dynamic column names?
    thanks in advance.

    As bregent has already explained to you, customizing the recordset code will result in Dreamweaver no longer recognizing the server behavior. This isn't a problem, but it does mean that you need to lay out your dynamic text with the Bindings panel before making any changes. Once you have changed the recordset code, the Bindings panel will no longer recognize the recordset fields.
    Using a variable to choose a column name is quite simple, but you need to take some security measures to ensure that the value passed through the query string isn't attempting SQL injection. An effective way of doing this is to create an array of acceptable column names, and check that the value matches.
    // create array of acceptable values
    $valid = array('column_name1', 'column_name2', 'column_name3');
    // if the query string contains an acceptable column name, use it
    if (isset($_GET['colname']) && in_array($_GET['colname'], $valid)) {
      $col = $GET['colname'];
    } else {
      // set a default value if the submitted one was invalid
      $col = 'column_name1'
    You can then use $col directly in the SQL query.

  • Deleting an extra column in the resultset of genericsearch page

    Hello E-Commerce Experts,
    we have a requirement where we need to delete a column in the resultset of the quicksearch trasactions in the genericsearch page.
    In order to hide this column we placed a condition in the action class from where we are getting the contents in the column.
    Now, we are unable to see the contents in the column but we are getting an empty column.
    As the genericsearch page gets genereted dynamically,we are unable to place any condition on that extra column.
    Can anyone suggest how to prevent this column from appearing on the screen. Do we need to set any parameters or anything.
    Thanks and regards,
    venkatesh Saini.

    Hi Venkatesh,
    You do not need to modify Action class for just hiding Trash column.
    Put below lines of code as I have suggested in *genericsearch.jsp* file you will able to hide *Trash* column without modifying Action class.
    You need to do 2 things to achieve your goal.
    First remove Header cell for Trash column and then remove trash icon cell from each row.
    First Search *<%-- // +++++++++++++++ RESULT LIST START +++++++++++++ --%>* comment.
    1) First Hide cell from Header Row.
    <% if ( ! "hidden".equals(listheader.getType())) { %>
         <% if ( listheader.getWriteUnderProperty() == null  ||  listheader.getWriteUnderProperty().length() <= 0  || baseui.isAccessible) { %>
              <% if ( ! firstPty) { %>
                 </th>
              <% }
                  firstPty = false;
              %>
         <%  //Custom Line
              if (!(ui.writeResultListHeader(listheader) == "" || ui.writeResultListHeader(listheader) == null)){  //Custom line
         %>  //custom Line
          <th scope="col" <%=ui.getTabIndex(true)%>>
                   <%=ui.writeResultListHeader(listheader)%>
         <% }%>     //Custom Line
    <% } else { %>
         <br /><%=ui.writeResultListHeader(listheader)%>
    <% } %>
    <% } %>
    2) Now Remove Trash cell from row. Below code with close <TD> tag properly
    <% if ( (! isWriteUnderProperty)) { %>
       <% if((iconPath == null) || (iconPath == "")){%> // Custom line
         <td <%=ui.writeResultTitlePerTD(rowfields)%> <%=ui.getTabIndex(true)%> <%=(iconPath !=null && iconPath.length() > 0 ? "style=\"text-align: center\"": "")%>>
      <% } else {%> // Custom Line
          </td>
      <%}%> //Custom Line
    <% } else { %>
          <br />
    <% } %>
    3) Now hide Cell with Trash icon.
    <% if (iconPath != null && iconPath.length() > 0) { %>
      <% if((iconPath == null) || (iconPath == "")){%> //Custom Line 
    < imge src="<%=iconPath%>"  alt="<%=outField.getString("ICONTITLE")%>"  border="<%=outField.getString("ICONBORDER")%>" width="<%=outField.getString("ICONWIDTH")%>" height="<%=outField.getString("ICONHIGHT")%>" />
      <% } %> //Custom Line
    <% } else { %>
         <%=ui.writeResultlistValue(rowfields , fieldValue)%>
    <% } %>
    I have written //Custom Line where I have added it in standard code.
    I have tested on my local and working fine.
    Let me know if you face any problem.
    eCommerce Developer

  • DataGrid with dynamic columns & renderers

    I'm developing using Flash Builder 4 & Flex SDK 4.1.
    I need to manage very dynamic DataGrid components and keep their definitions, which are all part of a complex item renderer of an Offers list.
    The objects structure is simplified as follows -
    Data: Model --> Offers ArrayCollection --> Offer VO --> DataGrid data ArrayCollection & DataGrid columns Array
    View: List --> Offer Item Renderer --> DataGrid
    1. Since the DataGrid's columns property accepts only an Array (not ArrayCollection), it seems like Data Binding for defining the columns is very problematic.
    I tried to bind it to the source property of an ArrayCollection that would keep my columns definitions, but it didn't really work (mainly header display bugs).
    What is the recommended way to keep the dynamic columns definition of a DataGrid?
    2. Each column can have a set of dynamic properties, so I created a "mutant" - Column VO that extends DataGridColumn and got a dynamic properties ArrayCollection on it.
    The columns got a custom header renderer that includes an icon when there are properties.
    The header renderers got 4 main states (NotSelectedWithProperties, SelectedWithProperties, NotSelectedWithoutProperties & SelectedWithoutProperties).
    However, the header renderer area seems a bit buggy when maintaning dynamic columns.
    Any thoughts on the subject?
    3. Anyway, I ended up recreating the DataGrid's columns Array very often (copying the columns definition on the offer's item renderer's dataChange event handler).
    Note that the dynamic properties can be edited when the column is selected and I copy their values from the view back to the model when entering the state NotSelectedWithProperties.
    This feels way too complicated and I really try to keep it simple, inspite of the required complexity.
    Does anyone have better ideas?
    4. In some cases the column's item renderer should also be modified into another DataGrid (grid-in-grid).
    I used the MXDataGridItemRenderer with a DataGrid and included an ArrayCollection for the "newValue" returned by the editor.
    (I use RendererIsEditor=true and on updateComplete populate that variable with the DataGrid's dataProvider contents)
    When needed, I loop though the data objects of the parent DataGrid and populate the related field with an ArrayCollection of key-value objects that are displayed on the internal DataGrid.
    After adding this feature I encounter very strange bugs -
    a. After editing the grid-in-grid values and changing the column's state (selecting & deselecting), I get the following exception:
    ArgumentError. Error #2025: The supplied DisplayObject must be a child of the caller.
    at flash.display::DisplayObjectContainer/setChildIndex()
    at mx.core::UIComponent/setChildIndex().......6993....
    All I could find about this is that it might be related to some context error or something, but I'm really stuck on this one.
    b. Sometimes another column might copy value from one row to another, running over the previous value.
    I'm not sure exactly what sequence of actions causes this behavior, but it's related to that itemRenderer for sure.
    c. Switching places with a column that uses the grid item renderer (headerShift) causes a stak overflow of StyleManager that tried to get style from the DataGridItemRenderer. This one I just found out, but couldn't reproduce a second time... strange!
    I'm pretty sure this caused another problem that I don't remember at the moment.
    The bottom line is that there got to be a better way to implement this feature within this already-complicated environment.
    Maybe I'm doing something very wrong here...
    Please advice and thanks for reading all this.

    Update on item 4a -
    This was a major issue (the main reason for opening this thread really) and I managed to resolve it!
    As part of my application, I override the default DataGrid behavior for column selection (headerRelease event).
    Instead of sorting, I change the column's header looks and define it as Selected (for showing its dynamic properties and enable its deletion).
    At first I did this by setting styles, but the look didn't refresh unless I created a new instance of the header renderer.
    Later I changed thi behavior to work with states, but I left the new header renderer instance creation commands and those lines created all the mess!
    Conclusion -
    If you define a custom header renderer for your datagrid column and then a custom item renderer, don't create a new instance of your header renderer!
    It would still be nice to get some response for the other issues I raised.
    Thanks and have a nice week.

  • Special characters in SBWP dynamic columns are not showing for some users

    Hi experts,
    We have set up a dynamic columns for business workplace. One of the field displays the comments entered by the user. Some users are able to see the values entered perfectly. But for some users, if we enter special characters like @gopal, it is not displaying the value in dynamic column.
    Are there any workflow/user settings need to be changed.
    Thanks
    Gopal

    I had the same issue, you should check the link between AD and CRM, so you could make a new user in AD and connect your CRM account with it, then you should return the old AD account back. It worked for me, try it :)

  • ALV with multiple header & dynamic columns

    Hello All,
    I have a requirement where in I need to print multiple header in alv.
    For eg.
    User Name : <Name_1>
    Channel     : <Channel_1>
    Sale Org    : <Sales Org_1>
    Col1 Col2 Col3 Col4 Col5 Col6 Col7 Col8
    User Name : <Name_2>
    Channel     : <Channel_2>
    Sale Org    : <Sales Org_2>
    Col1 Col2 Col3 Col4 Col5 Col6 Col7 Col8
    no of columns (Col1 , col2 )  are dynamic  . Which would be the best alv type do I need do use?  Is it possible using simple alv grid display. How to handle dynamic column.
    Thnx.

    it is not possible with normal grid or list.
    I guess it is possible by using ALV Block list
    Modified below program to get mutiple header
    REPORT z_alv_block_list.
    Type-pools
    TYPE-POOLS: slis.
    Data declarations.
    DATA: BEGIN OF t_vbak OCCURS 0,
            vbeln TYPE vbeln,
            bstnk TYPE vbak-bstnk,
            erdat TYPE vbak-erdat,
            kunnr TYPE vbak-kunnr,
          END OF t_vbak.
    DATA: BEGIN OF t_vbap OCCURS 0,
            vbeln  TYPE vbeln,
            matnr  TYPE vbap-matnr,
            netpr  TYPE vbap-netpr,
            waerk  TYPE vbap-waerk,
            kwmeng TYPE vbap-kwmeng,
            meins  TYPE vbap-meins,
          END OF t_vbap.
    DATA: t_fieldcatalog1 TYPE slis_t_fieldcat_alv.
    DATA: t_fieldcatalog2 TYPE slis_t_fieldcat_alv.
    DATA: v_repid         TYPE syrepid.
    DATA: s_layout        TYPE slis_layout_alv.
    DATA: v_tabname       TYPE slis_tabname.
    DATA: t_events        TYPE slis_t_event.
    start-of-selection event.
    START-OF-SELECTION.
      v_repid = sy-repid.
    Get the fieldcatalog for the first block
      PERFORM get_fieldcat1 CHANGING t_fieldcatalog1.
    Get the fieldcatalog for the second block
      PERFORM get_fieldcat2 CHANGING t_fieldcatalog2.
    Get the data for the first block
      SELECT vbeln bstnk erdat kunnr UP TO 10 ROWS
             INTO TABLE t_vbak
             FROM vbak WHERE vbeln > '0060000100'.
    Get the data for the second block
      SELECT vbeln matnr netpr waerk kwmeng meins UP TO 10
    ROWS
             INTO TABLE t_vbap
             FROM vbap WHERE vbeln > '0060000100'.
    init
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
           EXPORTING
                i_callback_program = v_repid.
    First block
      v_tabname = 'ITAB1'.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
           EXPORTING
                is_layout   = s_layout
                it_fieldcat = t_fieldcatalog1
                i_tabname   = v_tabname
                it_events   = t_events
           TABLES
                t_outtab    = t_vbak.
    Second block
      v_tabname = 'ITAB2'.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
           EXPORTING
                is_layout   = s_layout
                it_fieldcat = t_fieldcatalog2
                i_tabname   = v_tabname
                it_events   = t_events
           TABLES
                t_outtab    = t_vbap.
    *Display
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
          FORM GET_FIELDCAT1                           
          Get the field catalog for the first block    
    FORM get_fieldcat1 CHANGING lt_fieldcatalog TYPE
    slis_t_fieldcat_alv.
      DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
    Order number
      s_fieldcatalog-col_pos       = '1'.
      s_fieldcatalog-fieldname     = 'VBELN'.
      s_fieldcatalog-tabname       = 'T_VBAK'.
      s_fieldcatalog-ref_tabname   = 'VBAK'.
      s_fieldcatalog-ref_fieldname = 'VBELN'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Customer purchase order.
      s_fieldcatalog-col_pos       = '2'.
      s_fieldcatalog-fieldname     = 'BSTNK'.
      s_fieldcatalog-tabname       = 'T_VBAK'.
      s_fieldcatalog-ref_tabname   = 'VBAK'.
      s_fieldcatalog-ref_fieldname = 'BSTNK'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Creation date.
      s_fieldcatalog-col_pos       = '3'.
      s_fieldcatalog-fieldname     = 'ERDAT'.
      s_fieldcatalog-tabname       = 'T_VBAK'.
      s_fieldcatalog-ref_tabname   = 'VBAK'.
      s_fieldcatalog-ref_fieldname = 'ERDAT'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Customer
      s_fieldcatalog-col_pos       = '4'.
      s_fieldcatalog-fieldname     = 'KUNNR'.
      s_fieldcatalog-tabname       = 'T_VBAK'.
      s_fieldcatalog-ref_tabname   = 'VBAK'.
      s_fieldcatalog-ref_fieldname = 'KUNNR'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    ENDFORM.
          FORM GET_FIELDCAT2                           
          Get the field catalog for the second block   
    FORM get_fieldcat2 CHANGING lt_fieldcatalog TYPE
    slis_t_fieldcat_alv.
      DATA: s_fieldcatalog TYPE slis_fieldcat_alv.
    Order number
      s_fieldcatalog-col_pos       = '1'.
      s_fieldcatalog-fieldname     = 'VBELN'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'VBELN'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Material number
      s_fieldcatalog-col_pos       = '2'.
      s_fieldcatalog-fieldname     = 'MATNR'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'MATNR'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Net price
      s_fieldcatalog-col_pos       = '3'.
      s_fieldcatalog-fieldname     = 'NETPR'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'NETPR'.
      s_fieldcatalog-cfieldname    = 'WAERK'.
      s_fieldcatalog-ctabname      = 'T_VBAP'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Currency.
      s_fieldcatalog-col_pos       = '4'.
      s_fieldcatalog-fieldname     = 'WAERK'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'WAERK'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    Quantity
      s_fieldcatalog-col_pos       = '5'.
      s_fieldcatalog-fieldname     = 'KWMENG'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'KWMENG'.
      s_fieldcatalog-qfieldname    = 'MEINS'.
      s_fieldcatalog-qtabname      = 'T_VBAP'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    UOM
      s_fieldcatalog-col_pos       = '6'.
      s_fieldcatalog-fieldname     = 'MEINS'.
      s_fieldcatalog-tabname       = 'T_VBAP'.
      s_fieldcatalog-ref_tabname   = 'VBAP'.
      s_fieldcatalog-ref_fieldname = 'MEINS'.
      APPEND s_fieldcatalog TO lt_fieldcatalog.
      CLEAR s_fieldcatalog.
    ENDFORM.

  • Cannot use alias for dynamic column name in SELECT statement

    Hi,
    I want to retrieve values from several tables by using dynamic column & table name as below:
    DATA: tbl_name(30) TYPE c VALUE '/bic/tbi_srcsys',  " staticly initialized for this example
               col_name(30) TYPE c VALUE '/bic/bi_srcsys'.  " staticly initialized for this example
    SELECT (col_name) INTO CORRESPONDING FIELDS OF TABLE it_values FROM (tbl_name).
    The internal table "it_values" does not contain a field named "/bic/bi_srcsys", instead it has another generic field "value" so that the above code can be applied to other tables. I tried to use alias (AS) as below:
    SELECT (col_name) AS value INTO CORRESPONDING FIELDS OF TABLE it_values FROM (tbl_name).
    But this cannot work. I know that there are other ways to solve this problem, such as by using a single field in SELECT .. ENDSELECT and subsequently appending it to the work area and internal table as below:
    SELECT (col_name)  INTO (lv_value) FROM (tbl_name).
      wa_value-value = lv_value.
      APPEND wa_value TO it_values.
    ENDSELECT.
    Just wonder if there is any other more elegant workaround, because I might have several other fields instead of only one?
    Thanks.
    Regards,
    Joon Meng

    Hi Suhas,
    thanks for the quick reply.
    Sorry that I have not well described the structure of the internal table "it_values". This internal table contains several other fields (key, type, value, etc.).
    I guess that the following code
    SELECT (col_name) INTO TABLE it_values FROM (tbl_name).
    works if the internal table only has one field (value) or the field "value" is in the first position, right?
    In this case, I need to fill the "value" field of internal table it_values (ignore the other fields like type, key) with values retrieved from (col_name) of the DDIC table.
    Looking forward to your reply.
    BR,
    Joon Meng

  • Dynamic column change in Alv

    Hello friends,
                       Can any1 pls tell me if there is a function module available which can be used for dynamic column change in ALV.
                      Pls also elaborate how to use it.....

    While filling the field catalog you can specify witht IFcondition.
    Just see a example below...
    FORM field_fill USING pt_fieldcat TYPE slis_t_fieldcat_alv.
      DATA : ls_fieldcat TYPE slis_fieldcat_alv,
             pos TYPE i VALUE 1.
      ls_fieldcat-col_pos       = pos.
      ls_fieldcat-fieldname     = 'C_ICON'.
      ls_fieldcat-seltext_m     = 'Change Status'.
      ls_fieldcat-tabname       = 'IT_OUTPUT'.
      APPEND ls_fieldcat TO pt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       = pos.
      ls_fieldcat-fieldname     = 'BUKRS'.
      ls_fieldcat-ref_fieldname = 'BUKRS'.
      ls_fieldcat-ref_tabname   = 'ANLA'.
      APPEND ls_fieldcat TO pt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       = pos.
      ls_fieldcat-fieldname     = 'ANLN1'.
      ls_fieldcat-ref_fieldname = 'ANLN1'.
      ls_fieldcat-ref_tabname   = 'ANLA'.
      APPEND ls_fieldcat TO pt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      ls_fieldcat-col_pos       = pos.
      ls_fieldcat-fieldname     = 'ANLN2'.
      ls_fieldcat-ref_fieldname = 'ANLN2'.
      ls_fieldcat-ref_tabname   = 'ANLA'.
      APPEND ls_fieldcat TO pt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
      IF p_farea = 'X'. " Conditional Based OUTPUT
        ls_fieldcat-col_pos       = pos.
        ls_fieldcat-fieldname     = 'GRUFL'.
        ls_fieldcat-ref_fieldname = 'GRUFL'.
        ls_fieldcat-ref_tabname   = 'ANLA'.
        APPEND ls_fieldcat TO pt_fieldcat.
        CLEAR ls_fieldcat.
        pos = pos + 1.
        ls_fieldcat-col_pos       = pos.
        ls_fieldcat-fieldname     = 'GRUFL_N'.
        ls_fieldcat-seltext_l     = 'New Floor Area'.
        ls_fieldcat-tabname       = 'IT_OUTPUT'.
        APPEND ls_fieldcat TO pt_fieldcat.
        CLEAR ls_fieldcat.
        pos = pos + 1.
      ENDIF.
      IF p_ldate = 'X'. " Conditional Based OUTPUT
        ls_fieldcat-col_pos       = pos.
        ls_fieldcat-fieldname     = 'LEABG'.
        ls_fieldcat-ref_fieldname = 'LEABG'.
        ls_fieldcat-ref_tabname   = 'ANLA'.
        APPEND ls_fieldcat TO pt_fieldcat.
        CLEAR ls_fieldcat.
        pos = pos + 1.
        ls_fieldcat-col_pos       = pos.
        ls_fieldcat-fieldname     = 'LEABG_N'.
        ls_fieldcat-seltext_l     = 'New Lease St.Date'.
        ls_fieldcat-tabname       = 'IT_OUTPUT'.
        APPEND ls_fieldcat TO pt_fieldcat.
        CLEAR ls_fieldcat.
        pos = pos + 1.
      ENDIF.
      ls_fieldcat-col_pos       = pos.
      ls_fieldcat-fieldname     = 'MESSAGE'.
      ls_fieldcat-seltext_l     = 'Status Message'.
      ls_fieldcat-tabname       = 'IT_OUTPUT'.
      APPEND ls_fieldcat TO pt_fieldcat.
      CLEAR ls_fieldcat.
      pos = pos + 1.
    ENDFORM.                    " field_fill
    Regards
    Gopi

  • Hide Dynamic columns and remove space

    I have an application that allows users to generate a Crystal report containing selected columns.  A user is able to check which columns should appear on the report from a web page.  I'm able to display and suppress the dynamic columns but the space for the dynamic columns that are not selected remains.  How can I remove the space and have the columns move to the left?  
    I'm using VS 2003 and Crystal 10.

    As Ludek mentioned you would need to use the RAS .NET SDK to completely remove the column from the report. What you could do is start with a blank report, only have your database info added, then build UP your report rather than remove items. The ReportObjectController has a method called AddByName() that will insert a field into your report. It will add the field from left to right with a small buffer space.
    In order to use the RAS .NET SDK with Visual Studio .NET you'll need to upgrade to Crystal Reports 2008 or Crystal Reports for Visual Studio 2010 (good free price here).
    [RAS .NET Developer Guide|http://help.sap.com/businessobject/product_guides/boexir31/en/rassdk_net_dg_12_en.chm]
    [RAS .NET API Ref|http://help.sap.com/businessobject/product_guides/boexir31/en/rassdk_net_apiRef_12_en.chm]

  • How to hide dynamic selection fields in variants

    hi,
    When a selection variant is saved, we have the option to 'hide' a selection field. That field may contain a value, but it is not shown on the selection screen. There is, however, a button that will display these hidden field when required.
    Is it possible to do this also with dynamic selection fields ?
    The column 'Hide field' is shown in the variant atttributes screen, but it is not active.
    Please suggest
    MS

    Explore SHD0 T code

Maybe you are looking for