Run time column names as parameters

Hi SDN,
I am trying to use a FORM/ENDFORM which can work for many internal tables in my project except that a couple of field (table columns) names differ. In other words, just for two assignment statements I may have to repeat rest of the code, unless there is a way to 'reference' these fields.
Is there a way to pass the field names as a parameter to the FORM? Can someone give me an example if that is possible. I looked at the FIELD SYMBOL but don't know how to use it in a FORM.
Thanks for the help.
Saf.

FM DDIF_NAMETAB_GET retruns a table of field names.
Sample code follows (hope it helps!)
call function 'DDIF_NAMETAB_GET'
  exporting
    tabname           = 'Z213'
  tables
    dfies_tab         = lta_dfies
  exceptions
    not_found         = 1
    others            = 2.
if  sy-subrc         <> 0.
                        message e007 with 'syserr bld bkpf fields.'.
endif."subrc
loop at lta_dfies assigning <i>.
        append <i>-fieldname to lta_bkpf_fl.
endloop."dfies
select (lta_bkpf_fl)
from   bkpf
into   table lth_vbkpf
where
       bukrs  = p_bukrs
  and  bstat  = space               " normal documant
  and  blart  = 'WE'
  and  gjahr  = p_gjahr
  and  monat in so_monat
  and  budat in so_budat
  and  waers in so_waers
order  by       belnr.
if     sy-subrc <> 0.
                   message i008 with 'No BKPF data found for selection'.
                   stop.
endif."subrc.
Best,
Jim

Similar Messages

  • Run time Column Name in the Select Statement

    Hi there,
    I face problem while writing sql statment for report in the Oracle reports.
    The prom is I want to bound the where clause column name with the value stored in a variable e.g.
    Select * from emp
    where Column_Name = 'XYZ' ;
    where the variable Column_Name have different values at different times, e.g.
    At a time the value of Column_Name is Dept then
    Select * from emp
    where Dept = 'XYZ' ;
    At other time value of Column_Name is City then
    Select * from emp
    where City = 'XYZ' ;
    Waiting for the response .
    Regards,
    Hafeez

    Hi,
    U can use lexical parameters for the solutions.U must be aware of it, but still i describe how to work it out.
    1)In your datamodel in object navigator create a parameter under User parameter node.Name the parameter, for eg. p_clause.
    set data type of parameter to character.
    2)write a select query eg.
    select * from emp &p_clause; --(THIS IS THE PARAMETER WE CREATED ABOVE)
    3)Now run your report
    Now in your parameter form pass the value for p_clause parameter.
    eg: where name='JACK';
    or
    where city='NEWYORK';
    or where deptno=10;
    But do it in steps as above mentioned.
    Do tell me if it works or not via mail on [email protected]
    Enjoy.......
    navneet jain
    [email protected]

  • Passing table name and columns name as parameters to procedure

    i need a procedure that take table name and column names as parameters .
    it should display all values in those columns
    like
    if i execute procedure p ( t1,c1,c2)
    it should display c1,c2 values in t1 table
    if i execute procedure p ( t1, c1,c2,c3)
    it should display c1,c2,c3 values in t1 tables
    no of column parameters changes

    See if this helps...
    First, read the manual on collections.
    Second, define your expected results. You want to output the results to the screen? You cannot perform a 'select' in PL/SQL. You will have to select your output into another collection, then loop through that.
    Finally, I am curious why this is necessary versus performing a regular query.
    Take a look at this incomplete code.
    create or replace
    package dave_pac
    IS
    TYPE col_name_list IS VARRAY(20) OF VARCHAR2(30);
    PROCEDURE SFA_TAB_COL1
    (p_tname  IN    VARCHAR2
    ,p_cnames IN    col_name_list);
    END;
    create or replace
    package  body dave_pac
    IS
    PROCEDURE SFA_TAB_COL1
    (P_tname  IN varchar2
    ,p_cnames in col_name_list)
    IS
    l_stmt long;
    l_rc number;
    begin
    l_stmt :='select '||p_cnames(1);
    for i in 2..p_cnames.count
    loop
    l_stmt :=l_stmt||' , '||p_cnames(i);
    end loop;
    l_stmt:= l_stmt||' from '|| p_tname ;
    execute immediate l_stmt;
    end ;
    END dave_pac;

  • Run time column attach to apex report

    Hello everyone,
    can it be possible to make a function in a apex which will return a column value in report, like wise we use in report builder. I know we can do this directly in report query... however i want to make a some process may be, through which i can get a column value.
    My requirement is.... i am having a PO report where columns are Header_id, Segment1, Vendor_id, Vendor_site n Amount.
    I can have every column data from PO_header_all except amount for which i need to use.. PO_lines_all whose would be depend on header_id.
    Now.. i can do this directly in query.. but here i don't want to.. use a po_lines_all in report query. I want to call the Amount column attach at run time to report.
    Pls tell me how can i do this??
    I don't know whether it is possible or not... if it is then how can i do this.
    Regards,
    UKJ

    Hi,
    Do you mean something like:
    SELECT H.HEADER_ID, H.SEGMENT1, H.VENDOR_ID, H.VENDOR_SITE, SUM(A.AMOUNT) TOTAL_AMOUNT
    FROM PO_HEADER_ALL H
    LEFT OUTER JOIN PO_LINES_ALL A ON H.HEADER_ID = A.HEADER_ID
    GROUP BY H.HEADER_ID, H.SEGMENT1, H.VENDOR_ID, H.VENDOR_SITEThis will return the header_id, segment1, vendor_id and vendor_site values from po_header_all and a total of amount from po_lines_all
    Andy

  • Portlet Title to be set at run time.

    Hi,
    I have a portal page that contains some portlet reports. I am displaying portlet title and default Customize link on thie report. My requirement is to set this Title at run time based on the parameters provided by user in Customize form for this report. If any one have some idea how to achieve this functionality or some workaround for this, please help me to obercome the problem. Lots of thanks in advance.
    Regards
    Arun Uniyal
    [email protected]

    Arun,
    all parameter values that the user can modify in the Customization form are stored in the Portal preference store. You can access them using the Portal PLSQL public APIs available in the PDK. Portal Reports allow you to add PL/SQL code when the reports is being displayed. Hence, you can read the parameter values and set the title to your liking.
    For example, the following PL/SQL code reads the department_id custom parameter value and sets the portlet title to the current date plus the department ID.
    declare
    l_preference_path varchar2(300);
    l_dept_id number;
    begin
    l_preference_path := 'oracle.webview.parameters.'||lower(p_reference_path);
    l_dept_id :=
    wwpre_api_value.get_value_as_varchar2
    (p_path => 'oracle.webview.parameters.'||lower(p_reference_path),
    p_name => 'employees.department_id'
    wwpre_api_value.set_value_as_varchar2(
    p_path => l_preference_path,
    p_name => '_title',
    p_level_type => wwpre_api_value.USER_LEVEL_TYPE,
    p_level_name => wwctx_api.get_user,
    p_value => to_char(sysdate, 'mm/dd/yy hh24:mi:ss')||' dept_id='||l_dept_id
    exception
    when wwpre_api_name.path_not_found_exception then
    null;
    end;
    I added this code to the "... before displaying the page." field for the Reports column on the Additional PL/SQL tab of the reports definition. The report was based on the employees table that had the department_id column.
    Hope this helps.

  • Using a parameter value as a column name

    Hi,
       I have created an command like this:
    update table1 set [Param.1] = '[Param.2]' where id = [Param.3]
    where:
    Param.1 = COL1
    Param.2 = Hello
    Param.3 = 1 (the primary key I want to change).
    When I run this SQL Action I get the following error message:
    java.sql.SQLException: ORA-01747: invalid user.table.column, table.column, or column specification
       I have double checked the values of my parameters and they are all correct. There is a column named COL1, and its type is varchar2, and there is PK = 1.
       So, my question is: Is it a limitation of xMII (we can not take column names from parameters) or there is a mistake here?
    Thank you in advance,
    Nuno Cunha

    Hi Nuno,
    I see you are trying to perform Dynamic SQL execution in Oracle.
    In order to execute a Dynamic SQL you need to use the following syntax
    EXECUTE IMMEDIATE 'Sql Statement with any runtime params like cloumns, even table names too';
    And I guess you can use an Dynamic Sql only within a PL/SQL block.
    Please refer to the below link for more details
    [Dynamic SQL|http://download.oracle.com/docs/cd/B10500_01/appdev.920/a96590/adg09dyn.htm]
    Hope this helps!!
    Regards,
    Adarsh

  • Actual Column Name for Index when Function is used?

    Hi,
    We have some indeces where the column in oracle is actually a function in the form UPPER('column-name'). When I query user_ind_columns I get something like SYS_NC0012$ for the column name. Where would I be able to actually query the actual column it's using in the index? So that I can query the exact column name if need be. Don't ask why cause this is a developer asking me this and they are doing some sort of a comparison between indexes between two application.
    Here is the SQL for the Index and the Table associated with it
    create table BATCH_HEADER2
    PAYMENT_TYPE VARCHAR2(17),
    BATCH_TYPE VARCHAR2(40) not null,
    BATCHNUM NUMBER not null,
    BRANCH VARCHAR2(16),
    BATCH_TIME NUMBER,
    USER_LOB VARCHAR2(16),
    PAYEE_TYPE VARCHAR2(40),
    PROGRESS_RECID NUMBER,
    CHEQUE_TYPE VARCHAR2(60),
    SCANNERBATCHNO NUMBER,
    RECEIPTCOUNT NUMBER
    alter table BATCH_HEADER2
    add constraint PK_BATCH_HEADER2 primary key (BATCH_TYPE, BATCHNUM)
    using index
    tablespace FT1_DATA;
    --Inxes
    create unique index FT1DSTINT.BATCH_HEADER2##BYNUM on FT1DSTINT.BATCH_HEADER2 (UPPER(BATCH_TYPE), BATCHNUM)
    tablespace FT1_DATA
    pctfree 10
    initrans 2
    maxtrans 255
    storage (initial 64K
    minextents 1
    maxextents unlimited);

    From Oracle's standpoint, though, it isn't indexing BATCH_TYPE. It's indexing an arbitrary function that happens to take BATCH_TYPE as an input. As far as Oracle is concerned, you might just as easily be indexing an expression that took a dozen column names as parameters, so it doesn't really make sense for Oracle to try to break down anything beyond the function.
    Of course, you could always parse the expression and extract the column name, but I would be dubious that's the right answer... If a developer is comparing indexes between columns, there is a heck of a lot of difference between an index on BATCH_TYPE, and index on UPPER(BATCH_TYPE) and an index on SOME_OTHER_FUNCTION( BATCH_TYPE ).
    Justin

  • Upload photo at run time

    I want to give facility to client to upload photo of patients and upload scanned photo of reports.
    I want to copy that photo to my folder at run time with name what I wanna give for uniqueness.
    Please reply.
    Thanks in advance.

    All of this could be performed by the functions of the Webutil library, but it is available only since the 9i version.
    There is the fileupload Java utility, wich is part of the Forms demo that you can download from the Forms/Sample code page of the OTN Forms site.
    This code allows to upload files on the server side.
    If you run the C/S version, I do not know any suggestion, or maybe use a FTP system.
    Francois

  • How to pass column name at run time in function.

    how to pass column name at run time in function as parameter.
    thank in advance
    pramod patel

    Hello,
    Using dynamic sql you can pass column name to function. well I am not getting what you really want to do ? Please write in more detail. By the way I am providing one example here. see it uses dynamic sql.
    Create or replace function fun_updtest (p_columnname_varchar2 in varchar2,
    p_value_number in number)
    return number is
    v_stmt varchar2(500);
    begin
    v_stmt := 'update emp
    set '||p_columnname_varchar2||' = '||to_char(p_value_number)||'
              where empno = 7369';
    execute immediate v_stmt;
    return 0;
    commit;
    end;
    call to this function can be like this..
    declare
    v_number               number;
    begin
    v_number := fun_updtest('SAL',5000);
    end;
    Adinath Kamode

  • Datatypes and names of columns of recordgroup during run-time

    Hi everyone,
    Can you please tell me that Is it possible to get the datatype and name of columns of a recordgroup during run-time or not. So that I don't waste my time in searching for this solution. If you are not getting my question then please let me know but I need this help very badly.
    Thanks
    Subodh

    After  the call of the methods GET_COLUMN_WIDTH or  GET_ROW_HEIGHT
    You need to add this command :
                            CALL METHOD cl_gui_cfw=>flush.
    This will send back from the SAPGUI  to your ABAP program the new values.
    Found in this Thread  : Method GET_ROW_HEIGHT
    Eric

  • Adding complex computed column at run-time fails in PB 12.6

    I support a large 'vintage' application that was originally written in the late 90's, and has been migrated from version to version over the years.  Currently I'm working to get it working in PB 12.6 Classic, build 3506, migrating it from PB 11.5
    The first issue I've come across is that PFC treeviews are not working properly.  After some debugging, I determined that the cause of the failure is the PFC code's creation of 'key' column in the datawindows being used to populate each level.
    In the pfc_u_tv.of_createkey function, it looks at the linkages between the levels of a treeviews data, and then crafts an expression, and then uses that to create a computed column, which is subsequently used to uniquely identify the data.
    The expression is a series of string concatenations, such as this:
    expression='String(ctg_cd) + "#$%" + String(app_cd) + "#$%" + String(app_cd) + "#$%" + String(win_id) + "#$%" + String(ctg_cd) + "#$%"'
    This expression is then used in a modify statement to create the new compute key column:
    ls_rc = ads_obj.Modify("create compute(band=detail x='0' y='0' " + &
      "height='0' width='0' name=pfc_tvi_key " + ls_Exp + ")")
    In earlier versions, this works, and when you do a getitemstring afterward you get a long concatenated value that PFC uses to uniquely identify treeview items.
    Such as 'a/r#$%plcy#$%plcy#$%w_m_plcy_fncl_tran#$%a/r#$%'
    However, in PB 12.6, only the first portion of the expression is processed.  There is no error returned from the Modify function, and the column is created, but the expression is only evaluating one part of the expression.  In this partiular case, it results in
    'plcy'
    I just noticed that this isn't the *first* item in the set of concatenated columns and string literals, which is interesting.  In any case, when the computed key values are not correct, the whole method PFC is using to populate and run the treeview falls apart, and you get all children under each parent, and selections on the treeview object do not work properly because the key column values are not unique.
    I can copy the expression value from a debugging session, and use that to create a computed column at design time, pasting the expression in, and naming it the same as the created column (pfv_tvi_key), and this then allows the treeview to work properly.  However, this is a very cumbersome and problematic workaround.  The application has a lot of treeviews, with a very large number of datawindows operating as all the different types of items on different levels of different trees.  I don't think it's a practical workaround, and future maintenance would be very difficult.
    bu the workaround still demonstrates it is not an issue with the syntax of the compute expression, just an issue with the way it is handled by PowerBuilder when a column is created at run time,vs. at design time.
    Has anyone else encountered this issue?  I would think there are a fair number of older apps still around that are using PFC treeviews.
    My next step will be to install PB 12.6 build 4011 and cross my fingers.  Other than that, perhaps try 12.5?

    Updating the PFC layers has started to lead down a rabbit hole of hundreds and hundreds of errors.
    Granted, many of these are probably rooted in a few ancestor issues.
    But I'm not sure this will lead to a solution.
    The problem lies in using a modify statement to create a computed column at run time containing an expression with multiple concatenated values.
    If I look at the pfc_u_tv.of_createkey function from the newer PFC version, I see the same code there:
    ls_rc = ads_obj.Modify("create compute(band=detail x='0' y='0' " + &
      "height='0' width='0' name=pfc_tvi_key " + ls_Exp + ")")
    And the same code above it which creates the expression used in the modify.
    So after doing all the patching for the new PFC version, I somehow suspect I'll still be facing the same datastore.modify problem.
    Not to say that isn't a good thing to do, just not sure it addresses the root of the problem.

  • Setting FLVPlayback parameters at run time

    Hello,
    Is there a way to change the parameters on the FLVPlayback at
    run time? For example, I create a swf file to play the video
    "my_video", and I set the parameter "autoPlay" to false. I then
    embed the following code into a web page:
    <object
    classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="
    http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
    width="326" height="266" id="my_video" align="middle">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="movie" value="my_video.swf" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#666666" />
    <embed src="my_video.swf" quality="high" bgcolor="#666666"
    width="326" height="266" name="my_video" align="middle"
    allowScriptAccess="sameDomain" type="application/x-shockwave-flash"
    pluginspage="
    http://www.macromedia.com/go/getflashplayer">
    </embed>
    </object>
    The video is embedded in the page, and the user can click the
    controls to play the video.
    What I'm wondering is ... can I change the parameters at run
    time by using the above code somehow? For example, can I change the
    autoStart parameter to true, so now the video would start
    automatically when the page is loaded. Or, could I change the
    contentPath parameter so the code would now play a different flv
    file?
    Thanks for any help.
    Bob

    Hi,
    Thanks for the quick response. Your suggestion works almost
    perfectly. I can now change the flv to any flv I want, and it plays
    the video I want. However, even though I am specifying
    autoPlay=false, it still plays automatically when the page loads.
    Here is my actionscript:
    flvPlayback.playPauseButton = myplayPause;
    flvPlayback.seekBar = mySeek;
    flvPlayback.muteButton = myMute;
    flvPlayback.contentPath = newPath;
    flvPlayback.autoPlay = autoStart;
    and here is my html:
    <object
    classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="
    http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
    width="326" height="266" id="xxx" align="middle">
    <param name="allowScriptAccess" value="sameDomain" />
    <param name="movie" value="pokflvplayer.swf">
    <param name="FlashVars"
    value="autoStart=false&newPath=holiday_message_2007.flv" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#666666" />
    <embed src="pokflvplayer.swf"
    FlashVars="newPath=holiday_message_2007.flv&autoStart=false"
    quality="high" bgcolor="#666666" width="326" height="266"
    name="medical_imaging" align="middle"
    allowScriptAccess="sameDomain" type="application/x-shockwave-flash"
    pluginspage="
    http://www.macromedia.com/go/getflashplayer">
    </embed>
    </object>
    Any idea why it will not recognize the autoStart paramenter?
    By the way, I had to change your myFLV.autoStart - autoS to
    flvPlayback.autoPlay=autoStart. The actual name of the parmameter
    is autoPlay, not autoStart. My guess is that was just a typo on
    your part. Thanks again for your help.
    Bob

  • Change the Value of column of the internal table at run time

    Hello Experts,
    With the below code i am able to determine the value hold
    by internal table at run time for a sepcific column but i am not getting the way
    of how to update the internal if one of the value is changed,
      lr_desc_table ?= cl_abap_typedescr=>describe_by_data( itab  ).
      lr_desc_struc ?= lr_desc_table->get_table_line_type( ).
    loop at itab assigning <fs_data>.
        loop at lr_desc_struc->components ASSIGNING <fs_comp_wa>.
          assign component  <fs_comp_wa>-name of structure <fs_data> to <fs_field>.
          lv_excel_row = <fs_field>.
         CALL FUNCTION 'SCP_REPLACE_STRANGE_CHARS'
            EXPORTING
              INTEXT  = lv_excel_row
            IMPORTING
              OUTTEXT = lv_excel_row.
          assign lv_excel_row to <fs_field>. "this is not changing the value actually hold in internal table
        endloop.
      endloop.

    Hi,
    Resolved this issue with the code mentioned below.
    Code:
    loop at lt_export_items assigning <fs_data>.
      ls_data = <fs_data>.
        loop at lr_desc_struc->components ASSIGNING <fs_comp_wa>.
          assign component  <fs_comp_wa>-name of structure <fs_data> to <fs_field>.
          lv_excel_row = <fs_field>.
          CALL FUNCTION 'SCP_REPLACE_STRANGE_CHARS'
            EXPORTING
              INTEXT  = lv_excel_row
            IMPORTING
              OUTTEXT = lv_excel_row.
              concatenate 'ls_data-' <fs_comp_wa>-name into  lv_var.
              assign (lv_var) to <fs_var>.
              <fs_var> = lv_excel_row.
        endloop.
        modify lt_export_items from ls_data .
        clear:ls_data.
      endloop.
    Take care,
    Sanju

  • How to set App Module Config parameters at run time?

    Hi,
    I am using jdev 11.1.1.3 and developed a Fusion Web Application application.
    Before moving the code to production I want to have a stress testing where I should be able to set the application module configuration parameters at run time.
    So I would like to know what are the options are there to achieve this instead of setting the same in design time.
    Any help would be appreciated.
    ~Abhijit

    AT SELECTION-SCREEN OUTPUT.
      PERFORM radio_hide_options.
    FORM radio_hide_options .
    IF rad =  ' '.
        LOOP AT SCREEN.
          CASE screen-name.
            WHEN 'RT1'.
              screen-input = '0'.
              MODIFY SCREEN.
            WHEN 'RT2'.
              screen-input = '0'.
              MODIFY SCREEN.
          ENDCASE.
        ENDLOOP.
      ELSEIF rad = 'X'.
        LOOP AT SCREEN.
          CASE screen-name.
            WHEN 'RT1'.
              screen-input = '1'.
              MODIFY SCREEN.
            WHEN 'RT2'.
              screen-input = '1'.
              MODIFY SCREEN.
          ENDCASE.
        ENDLOOP.
      ENDIF.
    endform.

  • How to start Flash Media Encoder 3.2 from Flex application with run time parameters?

    Hello ,
    I'm developing the application to stream High Quality video.While streming by default camera/microphone settings the qulaity of streaming is not upto my expected level.I want to stream through Flash Media Encoder.My aim is the user login to the application.Video/audio qulaity details are retrived from shared object stored in the client machine.The login user name only gathered at run time & it will be the streaming profile name to Encoder.Once the the Encoder started the outgoing video will be come into screen to client.Please guide me How to start Flash Media Encoder 3.2 from Flex application with run time parameters(User name as  streaming name) without manually start the FME?
    Thanks in advance.
    Regards
    Sasharyuva

    Hi MarcSaphiron,
    Could you please send the samples?It will be much helpful to complete my
    job within the deadline.
    Thanks in advance.
    Regards,
    Sasharyuva

Maybe you are looking for

  • BAPI_SALESORDER_CHANGE. Error V1 045 -- Indicate number of document.

    Hi Experts. When a pre-order (ZAG) it's confirmed in SAP, we make an oficial order (TA), then, when save the oficial order I need delete the field LCNUM in pre-order. I'm using this BAPI, in a USER EXIT inside program SAPVM45A, when the number of doc

  • TS1424 I Tunes error

    how do i fix error 3212? i have internet access thru Explorer 8 and have reinstalled it and also reinstalled I tunes but still have the same problem

  • Photosmart D5160 printing over network

    I have a Photosmart D5160 connected to a Dell desktop PC running Windows 8.1 64bit, and 2 laptops, a Toshiba running Windows 7 Ultimate 32 bit and a newer Sony running Windows 7 Pro 64bit.   From the Toshiba I can connect to the printer over my wifi

  • In Safari is there a Keyboard shortcut for Merge All Windows?

    Majority of sites sill open new pages in new windows, not new tabs. So, I keep using the Merge All Windows feature all the time. Please, provide a keyboard shortcut for this!

  • One Billing Document with Delivery- and Order-Related billing items

    We wish to include both delivery-related and order-related billing items in a single billing document. Is that possible using configuraiton? We have seen some forums indicate it is not possible without ABAP. Thanks SAP gurus!