Change DataSource of fields via code

Hey there,
is it possible to change the properties Name and FormulaName of the FieldObject programmatically (c#)? Both properties are readonly. We need to replace the fieldnames of many reports which contain a big count of fields. We don't want to do it in the designer, because this would be very time expensive.
Is there a possibility to change the DataSource of the FieldObject programmatically? Or is it possible to remove fields and add new fields to the report (programmatically)?
Thank you in advance.
Kind regards from Germany
Markus

Hi Markus,
No and maybe.... You can't change the reference of a specific field at runtime, the Auto-field Mapping function kicks in and it simply deletes the fields it can't find in the data source info.
You can however clone the object, delete it and then make changes to the cloned object and then .Add to put the field back in place...
See this page for starting points using RAS:
NET RAS SDK Samples - Business Intelligence (BusinessObjects) - SCN Wiki
Don

Similar Messages

  • Changing panels XY position via code ?

    Hi
    Here is Some info about my program.
    i have a main panel on which i create about 15 child panels and each child panel has a canvas control on it.
    i created a scrollbar which moves the xy position of each panel.
    i could not use the standard panel scroll bar because it is does not allow the amout child panels that i need that is why im rotating the 15 panels.
    Could someone please explain to me why when i change the childs panels xy position the display updates the panels position so slowly ?
    and how could i speed this up?
    Thanks
    Shako
    Help share your knowlegde

    Hello,
    Could you also post your code, so that we can see closely how you are implementing this? What version of CVI are you using? At what point does the time delay occur and how long is this delay? Note also this Knowledge Base:
    Adding a Scroll Bar to a Canvas Control in LabWindows/CVI
    http://digital.ni.com/public.nsf/allkb/33CBB49128DD6A1586256F7C0082EC96?OpenDocument
    Thanks,
    National Instruments

  • Problem: Not able to change Signature field reason code Dynamically using signatureSetSeedValue

    Problem: Not able to change Signature Settings Dynamically.  
    What I want: Need to change the Signature Field Reason code Dynamically upon selecting Radio Button.
    Here is My Code:  
    var mydoc = xfa.resolveNode("FormData.P3_443.signature[2].ePadSignatureField3");
    mydoc.signatureSetSeedValue(
    reasons: ["Advisor"],
    flags: 8
    Error Message:
    TypeError: mydoc.signatureSetSeedValue is not a function
    9:XFA:FormData[0]:P3_443[0]:signature[2]:ePadSignatureField3[0]:validate'
       Source Code: Acrobat Code for Signature.
       // Obtain the signature field object:
    var f = this.getField("mySigFieldName");
    f.signatureSetSeedValue(
    { reasons: ["This is a reason", "This is a better reason"],
    flags: 8

    Problem: Not able to change Signature Settings Dynamically.  
    What I want: Need to change the Signature Field Reason code Dynamically upon selecting Radio Button.
    Here is My Code:  
    var mydoc = xfa.resolveNode("FormData.P3_443.signature[2].ePadSignatureField3");
    mydoc.signatureSetSeedValue(
    reasons: ["Advisor"],
    flags: 8
    Error Message:
    TypeError: mydoc.signatureSetSeedValue is not a function
    9:XFA:FormData[0]:P3_443[0]:signature[2]:ePadSignatureField3[0]:validate'
       Source Code: Acrobat Code for Signature.
       // Obtain the signature field object:
    var f = this.getField("mySigFieldName");
    f.signatureSetSeedValue(
    { reasons: ["This is a reason", "This is a better reason"],
    flags: 8

  • Change datasource of Crystal Report via code

    Hi all!
    I'm developing partner solution for SAP B1 8.8 in C# and prepared some nice crystal reports. But they are bound to my default database for now. I want to include them to my installation file and change saved datasource location (Server, Company Name, User name, User password) in my installation script as soon as I get this values, entered by user. But I don't know the way how to change datasource in rpt file. I've tried the following:
    using CrystalDecisions.CrystalReports.Engine;
    ReportDocument rDoc = new ReportDocument();
    rDoc.Load(@"C:\Temp\Report2.rpt");
    rDoc.DataSourceConnections[0].SetConnection("Server", "SBOTest", "manager", "manager");
    rDoc.SaveAs(@"C:\Temp\Report3.rpt");
    rDoc.Close();
    but it save no changes to rpt file.
    I think, this thread belongs mostly to Development/SDK thread, because here most of the people make programs and potentially met this problem in the past.

    public void SetCrystalLogin(string sUser, string sPassword, string sServer, string sCompanyDB, CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt)
                CrystalDecisions.Shared.ConnectionInfo oConnectInfo = new CrystalDecisions.Shared.ConnectionInfo();
                oConnectInfo.DatabaseName = sCompanyDB;
                oConnectInfo.ServerName = sServer;
                oConnectInfo.UserID = sUser;
                oConnectInfo.Password = sPassword;
                // Set the logon credentials for all tables
                SetCrystalTablesLogin(oConnectInfo, oRpt.Database.Tables);
                // Check for subreports
                foreach (CrystalDecisions.CrystalReports.Engine.Section oSection in oRpt.ReportDefinition.Sections)
                    foreach (CrystalDecisions.CrystalReports.Engine.ReportObject oRptObj in oSection.ReportObjects)
                        if (oRptObj.Kind == CrystalDecisions.Shared.ReportObjectKind.SubreportObject)
                            // This is a subreport so set the logon credentials for this report's tables
                            CrystalDecisions.CrystalReports.Engine.SubreportObject oSubRptObj = oRptObj as CrystalDecisions.CrystalReports.Engine.SubreportObject;
                            // Open the subreport
                            CrystalDecisions.CrystalReports.Engine.ReportDocument oSubRpt = oSubRptObj.OpenSubreport(oSubRptObj.SubreportName);
                            SetCrystalTablesLogin(oConnectInfo, oSubRpt.Database.Tables);
                oRpt.Refresh();
                oRpt.SetDatabaseLogon(sUser, sPassword, sServer, sCompanyDB, false);
                oRpt.VerifyDatabase();
                oRpt.Refresh();
            private void SetCrystalTablesLogin(CrystalDecisions.Shared.ConnectionInfo oConnectInfo, Tables oTables)
                foreach (CrystalDecisions.CrystalReports.Engine.Table oTable in oTables)
                    CrystalDecisions.Shared.TableLogOnInfo oLogonInfo = oTable.LogOnInfo;
                    oLogonInfo.ConnectionInfo = oConnectInfo;
                    oTable.ApplyLogOnInfo(oLogonInfo);
    Edited by: Konstantin Rakhuba on May 6, 2010 11:44 AM
    Edited by: Konstantin Rakhuba on May 6, 2010 11:45 AM

  • Change field "company code " in  WBS

    Hello ,everyone:
         How can i change the field "company code " in WBS  after   distribution budget .    Although i've reversed  the budget,the field value can't be changed.
    Regards in advance.
    Orange

    Dear
    First u have to remove all budget from WBS then run OPSX for that WBS.
    Now u will able to change Co. Code.
    It has been tested & found ok pls. do it.
    Regards,
    Vishal Kr. Sharma

  • View creation and populating key figure to datasource appended field

    Hi
    the data we want is like in 4 tables
    J_3GVERSI  +  EQUZ + ILOA+ ANLC
    HOW should i create a view on these four tables .
    j_3gversi _ equnr
    equz - equnr, iloan
    iloa- iloan(key), comp code,asset no,asset subno
    anlc- comp code asset no asset sub no
    my two key figure values are in J_3gversi , and 1 more keyfigure i will append it to my datasource on this view and the value for this  will be obtained if i give 5 field values( from ANLC(table), compcode,asset no ,asset subnumbr, fiscal year and depreciatio area in where condition for select statement in cmod .)
    to give these 5 values in the where condition in my cmod code for my datasource I tried to make this view.
    i have linked
    j_3gversi  with equz - using equnr
    equz with iloa- using ILOAN ( since my asset no and asset sub number in this table is linked to equipment number  using ILOAN field)
    ILOA with ANLC- using ( company code, asset number and asset subnumber)
    though the field names are different for my asset number and subnumber in both the tables , they have same data element(component) -
    IS it fine to join two tables with fields having different field names but same component.
    asset number field name is  in ILOA-anlnr and ANLC-anln1 though component type is same - anln1 for both
    similarly asset subnumber has like  ILOA- anlun and ANLC- anln2 with same component type-anln2
    now in cmod for the function module i am writing select statement like this
    code in cmod for transaction data
    when mydatasource
    loop c_t_data into lv_ctdata3
    1.     SELECT SINGLE * FROM anlc WHERE bukrs EQ lv_data3-bukrs AND 
    2.                                     anln1 EQ LV_DATA3-anln1 AND 
    3.                                     anln2 EQ LV_DATA3-anln2 AND 
    4.                                     gjahr EQ Lv_data-gjahr AND 
    5.                                     afabe EQ  '01 ' . 
    6.     IF SY-SUBRC EQ  0 . 
    7.       CALL FUNCTION  'FI_AA_VALUES_CALCULATE' 
    8.         EXPORTING 
    9.           i_anlc = anlc 
    10.         IMPORTING 
    11.           e_anlcv = l_anlcv. 
    12.     ENDIF. 
    lv_data3-nbw =l_anlcv-nbw.
    modify c_t_dat from lv_data3
    end loop
    Edited by: krishnav3.5 on Jul 8, 2011 2:07 PM

    Hi ,
    IS it fine to join two tables with fields having different field names but same component.
    1.Yes we do this many times .We combine fields having different names but functionally they are the key values to match .
    No issue with that untill they are in same format and you want to match data based on those fields .
    HOW should i create a view on these four tables .
    2.For view you can create view on 2-3 tables with matching fields and for complex logic you can populate additional fields via CMOD code .
    Regards,
    Jaya

  • Open a draft report via Code

    How could I open an saved Draft report via API/UI.
    I have draft an report via API/UI and now I would show this report on Desktop/SAP
    I would open it via code
    z.B. application.forms.items("")
    because I get the Docnum of my before safed draft but It wouldn´t shown at the SAP now so I have to open it via code

    Sorry for my first Miss Understandable explanation.
    Ok let me explain the other times.
    I have a parked document, I want this now to open it via code (programming).
    I have this code today:
    programspeach: vb.net
    we assume we have a sales order and press now via code the menu option "Save as a parked document"
    ' to change the sales order in a parked document
    appl.ActivateMenuItem(("5907"))
    ' Information: MY_FormUID = the sales order before
    ' Change DocNum in DocEntry
    oRSTRDocData.DoQuery(("SELECT max(DocEntry) FROM ODRF WHERE DocNum=" & Value))
    appl.Forms.Item(MY_FormUID).Items.Item("txtDraft").Specific.Value = oRSTRDocData.Fields.Item(0).Value
    ' take the DocEntry
    Value = oRSTRDocData.Fields.Item(0).Value
    'open parked Document via DocEntry and let it show
    appl.Forms.Item(MY_FormUID).Items.Item("lnkDraft").Click(SAPbouiCOM.BoCellClickType.ct_Linked)
    ' Close the Sales Order before
    appl.Forms.Item(OLD_FormUID).Close()
    After this there is no Document opened, also not the parked Document
    So yet I have an parked Document but when I open the SBO again there is no Document Opened? When I do this prozedere via SBO there will be at least the parked Document opened.
    What do I wrong?

  • Stored Procedure parameter (@Carrier) used in report and can't be set via code

    I have a report that has regular Crystal parameters that I am setting correctly via code.  However, one report actually uses one of the database parameters from the stored procedure that the report was created from.  It is the only report like this and I'm using the same code in an attempt to set it's value.  Although no error is thown, if I look at the parameter value in the IDE it is set correctly, but the field on the report just shows up blank.  I have changed the way the report is created.  Previously, I used the report.export method to create the actual file via a stored procedure.  Now, I'm running the stored procedure first and creating a datatable.  This allows me to execute the SP only once to see if it has data, because only then do I want to create the actual report.  I'm using the SetDataSource method to pass the datatable into Crystal and then using the report.export method to create the report with data.  Everything seems to work, except this stored procedure parameter (@Carrier) is not actually being populated to display on the report.
    Not sure what to look at.  Any suggestions?
    Thanks.

    crpe32.dll is version 13.0.5.891.  This was developed in VS2012 and VB.NET.  I'm using ADO.Net to connect to a MS SQL Server database.
    MainReport.SetDataSource(DTbl)
    bRC = PopulateAllSubReports(MainReport)
    If Not bRC Then Throw New Exception("Received an error in PopulateAllSubReports.")
    bRC = PopulateCrystalParameters(MainReport, SP)
    If Not bRC Then Throw New Exception("Received an error in PopulateCrystalParameters.")
    'Actually create the output file.
    bRC = ExportData(MainReport)
    Private Function PopulateCrystalParameters(myReportDocument As ReportDocument, SP As ReportStoredProcedureCrystal) As Boolean
         Dim myParameterFieldDefinitions As ParameterFieldDefinitions = Nothing
         Dim myParameterFieldDefinition As ParameterFieldDefinition = Nothing, ParamValue As String = ""
         Dim bRC As Boolean, Param As SqlParameter = Nothing
         Try
         myParameterFieldDefinitions = myReportDocument.DataDefinition.ParameterFields
    '*********************Report Parameters***************************
         For Each myParameterFieldDefinition In myParameterFieldDefinitions
              myParameterFieldDefinition.CurrentValues.Clear()
              Select Case myParameterFieldDefinition.ParameterFieldName.Trim.ToUpper
              Case "@CARRIER"
                   If SP.DBParameters.ContainsKey("@CARRIER") Then
                        Param = SP.DBParameters("@CARRIER")
                        ParamValue = NullS(Param.Value).Trim
                        bRC = SetCurrentValueForParameterField(myParameterFieldDefinition, ParamValue)
                        If Not bRC Then Return False
                   End If                           
              End Select
         Next
         Return True
         Catch ex As Exception
         GmcLog.Error("ReportKey = " & Me.ReportKey.ToString & ", " & ex.Message, ex)
         Return False
         End Try
    End Function
    Private Function SetCurrentValueForParameterField(myParameterFieldDefinition As ParameterFieldDefinition, submittedValue As Object) As Boolean
         Dim currentParameterValues As ParameterValues = Nothing
         Dim myParameterDiscreteValue As ParameterDiscreteValue = Nothing
         Try
         myParameterDiscreteValue = New ParameterDiscreteValue
         myParameterDiscreteValue.Value = NullS(submittedValue).Trim
         currentParameterValues = New ParameterValues
         currentParameterValues.Add(myParameterDiscreteValue)
         myParameterFieldDefinition.ApplyCurrentValues(currentParameterValues)
         Return True
         Catch ex As Exception
         GmcLog.Error("ReportKey = " & Me.ReportKey.ToString & ", " & ex.Message, ex)
         Return False
         Finally
         myParameterDiscreteValue = Nothing
         currentParameterValues = Nothing
         End Try
    End Function
    Private Function SetDBSourceForSubReport(mySubReport As ReportDocument) As Boolean
         Dim myTables As Tables = Nothing, myTable As Table = Nothing, DTbl As DataTable, SP As StoredProcedure = Nothing
         Try
         myTables = mySubReport.Database.Tables
         For Each myTable In myTables
              Dim SPName As String = myTable.Location.Substring(0, myTable.Location.IndexOf(";"c))
              SP = New StoredProcedure(ConnectionString, SPName, CommandType.StoredProcedure)
              DTbl = SP.FillTable
              mySubReport.SetDataSource(DTbl)
              SP = Nothing
         Next
         Return True
         Catch ex As Exception
         GmcLog.Error("ReportKey = " & Me.ReportKey.ToString & ", " & ex.Message, ex)
         Return False
         Finally
         If Not SP Is Nothing Then SP = Nothing
         If Not myTable Is Nothing Then myTable = Nothing
         If Not myTables Is Nothing Then myTables = Nothing
         End Try
    End Function
    Private Function PopulateAllSubReports(myReportDocument As ReportDocument) As Boolean
         Try
         Dim mySections As Sections = myReportDocument.ReportDefinition.Sections
         For Each mySection As Section In mySections
              Dim myReportObjects As ReportObjects = mySection.ReportObjects
              For Each myReportObject As ReportObject In myReportObjects
                   If myReportObject.Kind = ReportObjectKind.SubreportObject Then
                        Dim mySubreportObject As SubreportObject = CType(myReportObject, SubreportObject)
                        Dim subReportDocument As ReportDocument = mySubreportObject.OpenSubreport(mySubreportObject.SubreportName)
                        Dim bRC = SetDBSourceForSubReport(subReportDocument)
                        If Not bRC Then Return False
                   End If
              Next
         Next
         Return True
         Catch ex As Exception
         GmcLog.Error("ReportKey = " & Me.ReportKey.ToString & ", " & ex.Message, ex)
         Return False
         End Try
    End Function

  • Restricting HR Tables fields via auth object?

    Happy Holiday's everyone!
    We have a custom tcode for Pricing Admin report which currenltly only has S_Tcode for an auth obj.  It was combined in a role that we removed the HR authorization from and apparently these were interdependent but undocumented.  Now the pricing transacation no longer functions. 
    Instead of just adding back the missing HR authorizations back into the custom Tcode I'm being asked if  we can restrict PA00002 (the table being called in the program) to first name, last name and personnel number fields.  Is there an authorization object that will let me restrict in this manner or do I need send this back to the developers to write in the code? 
    Or can I restict to these fields via authorization groups (something we are looking into implementing more next year).
    Thanks
    Kris Wise

    That is a bad omen for the next year...
    Try to change the code this year still to deliver only the fields you want from the infotype or go for an "existence check" which no authorization requirements as that is what you seem to be wanting.
    Being custom code, you should post the problematic part to discuss a solution.
    Cheers,
    Julius

  • How can we change the input field on a view stop showing zeros

    Hello,
           To make screen look consistent with other character input field. How can we change the input field on the view stop displaying zeros even though the data type is NUMC and data type should not be change?
    Edited by: sap_learner on Mar 25, 2010 5:44 PM
    Edited by: sap_learner on Mar 25, 2010 5:49 PM
    Edited by: sap_learner on Mar 25, 2010 5:55 PM

    hello Manas Dua,
                           Thanks for your help. I am able to resolve my problem.
    My code will help  the future comers to resolve this kind of issues.
    *The code is applied to method WDDOINIT of the default view.
      DATA lo_nd_terms_input    TYPE REF TO if_wd_context_node.
      DATA lo_nd_terms_input_i TYPE REF TO if_wd_context_node_info.
      DATA lv_zeros             TYPE wdy_attribute_format_prop.
      lv_zeros-null_as_blank = 'X'.
      lo_nd_terms_input = wd_context->get_child_node( name = wd_this->wdctx_input ).
      lo_nd_terms_input_i = lo_nd_terms_input->get_node_info( ).
      lo_nd_terms_input_i->set_attribute_format_props(
        EXPORTING
          name              = `ENTER THE ATTRIBUTE NAME`
          format_properties = lv_zeros     ).
    Edited by: sap_learner on Mar 26, 2010 5:02 PM

  • Performing filter for field Tax Code (MWSKZ) in the Purchase Order

    Hello Experts,
    We have to perform a filter for field Tax Code in the purchase order (ME21N / ME22N / ME23N). We've tried to use SH SH_T007A and SSH_T007A with search help exit (e.g. F4_TAXCODE_USER_EXIT) but it is not working. The ABAP programmer has performed a debug and the standard does not check any line code in this function (the ABAP programmer has set a breakpoint into function F4_TAXCODE_USER_EXIT after assigning it for mentioned search helps)... it sounds like this program / search help is not called by standard program of ME2* transactions...
    I've tried to look for some other object and other function called FI_F4_MWSKZ has been found... I've set a breakpoint there and when I open the search help for field tax code into transaction ME21N it works... but as I could see this function FI_F4_MWSKZ is a standard one which we can not change...
    Have you ever had the same problem?
    We are currently in the SAP 4.6C version. I've found lots of OSS notes but only valid for 6.0.
    Maybe someone can help me on that.
    Best regards,
    Nilmar

    hi,
    goto gs01 transaction,give some name to ur step.
    give the table name and field name.
    then u can create a specific value set for that field.
    save.
    now u can use this set to define conditions for ur fields in obbh transaction.

  • How to change the grayed field font  in apex

    Hi,
    I need to change the grayed field item font ...
    ie i need to make disabled item value to be bright to achieve this what i have to do ...
    Regards,
    pavan

    ok make it html code in Java scrip as bold  and item level read only option with Read Only Element Table Cell(s) Attributes .
    i did your requirement in same my link.
    how it use? follow this thread.
    https://forums.oracle.com/thread/2555786

  • QM03-Custom tab-Change to text field not reflecting-FG - XQQM-screen-0106

    Hi,
    I have a requirement to change the text field on a custom tab of QM03 transaction. Quality notification type is Z1 and the tab is "Checklist". Both are custom defined.
    The existing text field is of 3 lines. The new text message is of 8 lines. When I did the changes on the custom screen 0106 in the function group XQQM, the changes are not reflected on the QM03 transaction's custom tab. Only first 3 lines were reflecting the change and rest of the 5 lines are not appearing on the screen.
    Pointers on this will be definitely helpful.
    Regards,
    Mallika.

    I had a similar problem, but it was with the message line. I found that with Web Forms, I had to issue the Synchronize; a second time, but in Client/Server Forms 6i, the first synchronize worked. Here is the code I used:
    <pre><font face = "Lucida Console, Courier New, Courier, Fixed" size = "1" color = "navy"> SYNCHRONIZE;
    if Get_Application_Property(User_Interface) = 'WEB' then
    synchronize;--first does not work on web
    end if;</font></pre>
    Let us know if this works.

  • Change report for FXTP t-code

    Hi All,
    Could you kindly help me in finding a standard report or any other way to retrive the chagnes made to transaction FTXP in a report format.

    Hi buddy,
    1) transaction SCU3: Check if desired tables are monitored for changes.
    Tax tables: Tax Code And Tax Rate in FTXP transaction
    2) If so, report RSSCD200 enables you to find those changes (field table name)
    Cheers
    -fm

  • How to change datasource name based on the partition in configplan

    Hi
    Can any one please give me some solutions regarding how to change datasource name based on the partition in
    configplan.
    can't we do this in configuration plan?

    If you want to change template based on parameter. you have to use below syntax
    v_layout boolean
    V_LAYOUT:= FND_SUBMIT.add_layout(template_appl_name => 'SQLAP' -- application short name
    ,template_code => 'HUBAPAPN' -- template name
    ,template_language => 'en'
    ,template_territory => '00'
    ,output_format => 'PDF');
    Above can be used in plsql stored procedure before submitting Concurrent Program (Bi Publisher report) or may be you can try to add this code in Oracle reports after report or before report trigger
    Thanks
    Kamalakar

Maybe you are looking for

  • ORA-00932 Error using 11g and the SDO_RELATE function. Works fine in 10g

    Hello, If I run this query in Oracle 11g: SELECT M.FID, MAX(M.VERSION) AS VERSION FROM SW_PB.A_ROADNODEINFORMATION M, SW_PB.ROADNODE N WHERE M.REFERENCETOROADNODE = N.FID AND M.NODEVERSION = N.VERSION AND M.CATALOGUEID <= 477 AND MDSYS.SDO_RELATE( N.

  • Screen Issues

    Anyone in the community know how I can fix a cracked screen of about 1mm in length? (felt the uneven surface and screen displays colour through the crack, what you normally find in a chipped screen) I understand that by using toothpaste it will only

  • Enhancement options in transactions ME51N and ME21N of ECC 6.0

    Hi Experts, We are in version 6.0 of ECC. Is there a way to create a custom button in transactions ME51N and ME21N, without altering standard code? Using BAdIs or user exists? Thanks and regards, José Omar

  • Executing a command using back-quotes appears to hang

    I have posted this to the apache users mailing list due to the evidence to date, but since I also found some reference on the web to some, admitedly old, bugs regarding unclosed input pipes which seems to cause a similar hang I thought I'd also post

  • SpeedGrade CC14  will not open - Mac 10.9.5

    SpeedGrade refuses to luanch on my Mac. Mac Pro, GTX 680, latest Cuda drivers. Tried uninstalling and reinstalling, using the CC cleaner tool to wipe it out before re-install and same result. The splash screen never even comes up. A small dot appears