Select tables filed name by using global variables
Hi
I try to redesign a BODI jobs for monthly statistics. At the moment, I have a job for every month because in the source system (MS Axapta) the source table have the following design:
YEAR JAN FEB MARCH ...
2010 100 231 233
So, if I load the data for the January, I will load only this filed from the table:
select YEAR, JAN from STATISTICS
For the February, I will load only this filed:
select YEAR, FEB from STATISTICS
otherwise, I have a lot of dublicated BODI Jobs and a lot of work for maintenance.
In this case, I try to use a variable in the mapping field in a Query transform, but doesn't working. Also in the SQL transform, but I was not able to do that.
I know, that I can solve that with a Pivot-Transform, but I have to load some millions of data and I have no time to wait until the Pivot is finish.
Do anybody have a other idee to solve my problem?
Many thanks
Christoph
Thanks for your answer.
How can I do that in the SQL Transform?
If I try the with the following SQL Code, I become a ORA-00911 Error Message:
SELECT Year, $Periode from STATISTIK
Any idea
Thanks
Christoph
Similar Messages
-
Using Global variable in Record Group
Hi,
I have a requirement where in I need to pull a column name from a table and then use that value in the select statement of a record group. I have tried using global variables but it is not working. Here is the record group I would like to use.
RG_DOMAIN is based on LOV_DOMAIN
SELECT :GLOBAL.DOMAIN_COLUMN_NAME, DESCRIPTION FROM
DM_T_DOMAIN_VALUES
WHERE DOMAIN_NAME := BLOCK.ATTRIBUTE;
In the Key-Listval I have a select statement in which does this :
SELECT DOMAIN_COLUMN
INTO :GLOBAL.DOMAIN_COLUMN_NAME
FROM DM_T_DOMAIN_RULES WHERE DOMAIN_NAME = :BLOCK.ATTRIBUTE;
SHOW_LOV('LOV_DOMAIN');
The problem is I am not getting the value I am just getting the Domain_column name. For example for Domain_name 'CALC_TYP' the Domain_column is COLUMN_10 and I just see COLUMN_10 my LOV when I want to see the value of COLUMN_10 from the DM_T_DOMAIN_VALUES table.
I tried using Name_in and Copy but not working. Can anyone suggest a solution?
ThanksFrancois ,
I tried this but I am getting error saying record group does not exist. Can you tell me what should I go in Populate_group... and show_lov..maybe I am doing something wrong?
Declare
LC$Req Varchar2(512) ;
Begin
LC$Req := 'SELECT ' || :GLOBAL.DOMAIN_COLUMN_NAME || ' FROM ....' ;
Create_Group_From_Query( rg_group, LC$Req ) ;
Populate_group(RG_DOMAIN); ?? --- is this correct?
Show_Lov(LOV_DOMAIN) ; -- and is this correct?
End; -
Using Global Variables in Data Quality Address Cleanse Transforms
I am currently developing in Data Services 12.2.
I am trying to dynamically populate the List Owner information in the option tabs of the USA Regulatory Address Cleanse by using global variables. It populates the 3553 with the variable name instead of the value assigned.
According to the Technical Manual, it is possible to use global variables in Data Quality Address Cleanse transforms:
However, you can use substitution parameters in all places where global variables are supported, for example:
Query transform WHERE clauses
Mappings
SQL transform SQL statement identifiers
Flat-file options
User-defined transforms
Address cleanse transform options
Matching thresholds
Does anyone know if it is possible to use global variables in the option tab of the Address Cleanse; if so, can you describe how it is done?
Thanks in advance,
RickHi,
U can refer to the following links in help.sap.com
GlobalContainer Object
http://help.sap.com/saphelp_nw04/helpdata/en/75/8e0f8f3b0c2e4ea5f8d8f9faa9461a/content.htm
Container Object
http://help.sap.com/saphelp_nw04/helpdata/en/78/b4ea10263c404599ec6edabf59aa6c/content.htm
Also some of the RUN TIME CONSTANTS are available in your BPM. So if you are trying to retrieve those variables in your Mapping(that is used in BPM), also read the following thread.
Re: Message id in BPM
Cheers,
Siva Maranani. -
Can i use global variable in web forms
guys can any one tell me if i can use global variables when i am
deplying the forms on the web,.....
thank you
vas
nullGlobal variables work in their perfection even when you deploy
your forms on the WEB.
null -
Hello
I made a Global Variable XX_DATE in Transaction Form Personalization with a value =:TACC_ACC_ASSGN.GL_POSTED_DATE.
I'm planning to get the value from XX_DATE to one of the fields in Receipts thru Receipt Personalization.
But a got the following error when I validate the value in Actions
FRM-40815: Variable GLOBAL.XX_DATE does not exist.
The String =:GLOBAL.XX_DATE could not be evaluated because of an errorAny help on this please?
I just wanted to transfer data (GL_POSTED_DATE) from Transactions to Receipts using Global Variable.
Any other ideas?
Thanks a lot
emgeeeIn WHEN_NEW_FORM_INSTANCE set the property INITIAL_VALUE for the global variable.
-
Using global variable in package
Hi. I have created a function (Retrieve_SerialNo) which returns a variable, which I use throughout my package. I would like to assign this variable as a global variable to be used by all functions and procedures in the package. Can someone help me in the declaration of this variable as a global variable? Also, is it necessary for me to initialize this variable whenever the package executes. If yes, how would I do this?
CREATE OR REPLACE PACKAGE BODY Supply_Item_Interface AS
FUNCTION Retrieve_SerialNo RETURN VARCHAR2 IS
v_serial_no VARCHAR2(20);
CURSOR Serial_Code IS
SELECT S.Serial_Code
FROM Spare_Parts s, Orders r
WHERE s.serial_code = r.serial_code;
BEGIN
OPEN Serial_Code;
LOOP
FETCH Serial_Code
INTO v_serial_no;
EXIT WHEN Serial_Code%NOTFOUND;
v_serial_no := v_serial_no;
END LOOP;
CLOSE Serial_Code;
RETURN v_serial_no;
EXCEPTION
WHEN OTHERS THEN
RETURN NULL;
END;user13415143 wrote:
Hi. I have created a function (Retrieve_SerialNo) which returns a variable, which I use throughout my package. I would like to assign this variable as a global variable to be used by all functions and procedures in the package.All variables have scope or "visibility". A variable defined in a procedure is only visible within that procedure.
A variable defines in a package body. is visible within that package body (i.e. procedures and functions in that package body can "see" that variable.
A variable defined in the package definition? Well, who can see the definitions of procedures and function in a a package header/definition? Everyone else basically (other PL/SQL packages and procedures and functions). So this is also true for variables defined in the package interface. These are global variables that not only can be used by the code in that package's body, but also can be used by other packages and PL/SQL code.
So when you create a global variable you need to decide on its scope:
- define it in package header for global usage in all PL/SQL code
- define it in package body for global usage within that package only
CREATE OR REPLACE PACKAGE BODY Supply_Item_Interface AS
..snipped..Ugly code as there is no need to use an explicit cursor if returning a value from a single row. Also buggy code. If there are multiple rows returned by the cursor, the function returns the serial of the last random row. How does this make sense?
This is what I would expect to see from a function like this. You pass it a unique identifier and it returns the applicable attribute (column) value for it.
E.g.
create or replace function GetSerialNo( orderNo number ) return number is
serialNo number;
begin
select
s.serial_code into serialNo
from spare_parts s,
orders o
where s.serial_code = o.serial_code
and o.order_no = orderNo;
return( serialNo );
exception when NO_DATA_FOUND then
return( null )
end;Also note that there is no need to write ugly uppercase code. This is not a proper coding standard. Programming standards for all languages (ranging from C# to Java to Delphi to Visual Basic to C/C++) specify that camelcase should be used for variables and pascalcase for procedures/functions/methods. Uppercase is very seldom used and then only for constant names and compiler options/flags for example.
Coding reserved words in uppercase? That is just plain silly - and not found in today's programming languages. Do yourself a favour and forget the idiotic standards used by some for PL/SQL and look at the standards for Java and .Net/C# - as the latter are the de facto standards for programming (and have been for the last 2 decades and more). -
What are the best practices to use GLOBAL Variables
Hi,
Please guide how Global Variables can be declared and how they can be initialized.
Further please guide what are the impacts of Global Variables(if any) on the memory of CLIENT or SERVER, if they are not initialized or freed up after usage.
Thanks.
Regards.spilgrim wrote:
My preference is not to use them and to use parameters or package variables. There is not real control on globals so you can end up with an applicatios that has lots of them that are only used once but persist for the user session.I second that. I don't know how often I searched for bugs caused by typos in the names of global variables. Plus the fact that they are only of datatype VARCHAR2. If you are using share_library_data you could also use Package globals in a forms library to share data between called and calling forms. Or you could use a database package...
cheers -
Is there a way to use Global variable in HANA
Hi Developers,
Is there anything like a Global variable in SAP HANA which can be used to pass data from one procedure to another (Visible to all the procedures in a session)?
Thanks
S.SrivatsanHi Sundar,
In best of my understanding, there is no context variable or global variable available under SQL SCRIPT scope . You may need to maintain the variable as a parameter in the procedure interface and pass it to the procedures where ever you need it to be available . Or,(DB table is in memory, so its just memory unit) you can create a DB table to store the variable(s) and access it anywhere .
Sreehari -
Using global variable read status
Hi Experts,
I need to change the Note based o the Service Ticket status. I declared global variable as a string in ZL_ICCMP_BT_BTSHEADER_IMPL (Component: ICCMP_BTSHEAD; View: BTSHeader)
And I am passing the Status to this global variable using the GET and SET methods of the STRUCT.ACT_STATUS attribute in BTSTATUSH node in same component and view.
I referred this global variable in DO_PREPARE_OUTPUT of the component ICCMP_BTTEXT/TextView to set the Note as shown below.
if ZL_ICCMP_BT_BTSHEADER_IMPL=>GC_STATUS = 'E0001'.
I would like to know whether this approach is the best way to read status or any other optimistic approach is there to follow for my this scenario. Please advise me.
Thanks
ChandHi Basha,
If you are using static variables, i wouldn't recommend using this approach.. there are better approach to get/set values in web client session which avoids setting/clearing static variables etc..
you can follow below approach..
1. To Get/set the variable in ic session to avoid the static variable.. for eg global cuco is available which you can use for this purpose.
lr_bdc type ref to if_crm_ui_data_context.
lr_bdc = cl_crm_ui_data_context_srv=>get_instance( me ).
check lr_bdc is bound.
Using SET_DATA_ATTRIBUTE set the attribute value and using GET_DATA_ATTRIBUTE get the attribute valueu2026get_attribute, set_attribute
read current BuAg if exist
lr_buag ?= lr_bdc->GET_DATA_ATTRIBUTE( 'CURRENTBUAG' ).
Here "CURRENTBUAG" is the attribute name, you can give any attribute name while setting and get the same attribute value via get_data_attribute.
Cheers,
Sumit Mittal -
Can not use Global Variable in Event Structure
I am using LabVIEW 2009.
In my LabView project I have a Boolean Global variable called EStop. I can read and write the Global variable. If I double click on the Global variable, it takes me to EStop.vi which includes a Text Button. EStop.vi is part of my Project.
In one of my VIs, I have an Event Structure. If I go to one of the Event Handlers in that Event Structure and right click and then select Add Event Case, I get a list of possible events. But that list does not include EStop or an EStop events.
I want to Add an Event Case for EStop: Value Changed.
Why can't I Add events to an Event Case that include events on Global Variables like value changed?
How do I add EStop: value changed event to my Event Structure.
Solved!
Go to Solution.dbaechtel wrote:
I have many events throughout the system that might need to cause the system to do an Emergency Stop action. So I want ro use a Global variable that is accessible from anywhere in the system. Any action or condition that occurs anywhere in the system can activate the emergency Stop condition by setting the boolean EStop Global variable to True. When the Global bolean variable goes true(value changed), I want to detect that event in an Event Structure and do the actions necessary to accomplish a system Emergency Stop.
Sorry, I am not familiar with your terminologies. What is your definition of a "system".
One big VI with many parallel loops?
Several VIs running in parallel?
LabVIEW Champion . Do more with less code and in less time . -
XI 3.0: Using global variables in mapping
Hi everybody
Since it seems that during mapping you have only access to messages fields, does anybody has got idea or a workaround to use global/external variables or constants during mapping??
Example: i would like to store the mail address where i send my error mails outside each mapping program (something like using a properties file or something like that).
Any idea???Hi,
U can refer to the following links in help.sap.com
GlobalContainer Object
http://help.sap.com/saphelp_nw04/helpdata/en/75/8e0f8f3b0c2e4ea5f8d8f9faa9461a/content.htm
Container Object
http://help.sap.com/saphelp_nw04/helpdata/en/78/b4ea10263c404599ec6edabf59aa6c/content.htm
Also some of the RUN TIME CONSTANTS are available in your BPM. So if you are trying to retrieve those variables in your Mapping(that is used in BPM), also read the following thread.
Re: Message id in BPM
Cheers,
Siva Maranani. -
Use global variable in reports which is declared in forms
Hi All,
I have declared and used a global variable in Forms and after that I'm running a report and I want to use the same variable in reports.
How can I use that.
Regards
Praveen Kr. AroraHi Rizwan,
Thanks for prompt reply.
Can you explain in more detail with example.
Though I'm calling report from menu item and I have created report file with three parameters.
In menu item I have created a parameter list with same three parameters but whenever I tried to run then it gives Invalid ID error for all three parameters.
Regards
Praveen Kr. Arora -
Dymanin File Name Creating Using ODI variable
Hi All,
I am trying to create a flat file dynamically using ODI variables. I am following a document in metalink (Using A Dynamically Specified File Name Or Directory Name With ODI [ID 423635.1]). However, I am getting the following error, whenever I try to execute the interface:
java.lang.NullPointerException
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.execCollOrders(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTaskTrt(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSqlI.treatTaskTrt(SnpSessTaskSqlI.java)
at com.sunopsis.dwg.dbobj.SnpSessTaskSql.treatTask(SnpSessTaskSql.java)
at com.sunopsis.dwg.dbobj.SnpSessStep.treatSessStep(SnpSessStep.java)
at com.sunopsis.dwg.dbobj.SnpSession.treatSession(SnpSession.java)
at com.sunopsis.dwg.cmd.DwgCommandSession.treatCommand(DwgCommandSession.java)
at com.sunopsis.dwg.cmd.DwgCommandBase.execute(DwgCommandBase.java)
at com.sunopsis.dwg.cmd.e.i(e.java)
at com.sunopsis.dwg.cmd.h.y(h.java)
at com.sunopsis.dwg.cmd.e.run(e.java)
at java.lang.Thread.run(Unknown Source)
IKM: IKM SQL to File append
I am sure that it is unable to locate the file. May be the variable value is not passed, not sure. But, if I mention a name like abc.txt, it works. It creates a new file with abc.txt. However, when I try to use a variable, it throws null pointer exception.
Thank you
KKHi Nitesh,
I am really not sure what exactly you mean by declare a variable in a script. I create a new variable and used it as a name for the flat flie model. I defined a SQL that contactenates sysdate with a string. Thank you for your help!
Regards,
KK -
Using Global variables in business rules
In EAS after expanding the Business Rules section there is a Global Variables section. I have created some global variables in this section and I am trying to use them in the Rule editor and not having much luck. Are they retrieved differently to local variables...Currently this is how I am calling them within a FIX....
FIX([Global_Varaiable])
calculation;
EndFix
Please correct me if I am wrong, also can any one provide some good documentation and some gd links for writing business rules. I'm just starting out to create some business rule which runs on save on some input forms I am creating and finding it rather difficult.... :-(..
Many Thanks
StephenHi,
Global variables will work in the same way as local variables so you are using them correctly.
Business rules are just really glorified calc scripts, if you want to know about calc script commands have a read of the tech ref :- http://download.oracle.com/docs/cd/E12825_01/epm.111/esb_techref/frameset.htm?launch.htm
It will have all the calculation commands and functions and descriptions on how they work.
Cheers
John
http://john-goodwin.blogspot.com/ -
Use global variable to transfer user parameter in some Vi
Hello,
I have troubles when I use a global variable to transfer the parameter to a first Vi (user interface) to a second vi (acquisition interface).
In the first Vi, the user paramater is wrote to my global variable.
In the second Vi, the acquisition parameter is read to my global variable.
This 2 Vis are include to a master Vi who synchronized by the error bus.
The problem :
For the first use, the user parameter is transfer to the global variable but the acquisition vi read the old parameter. In the second use, acquisition vi read the first use parameter.
After I use the IN/OUT parameter subvi and i have too this problem.
Thanks for help.
VIEW THE PROBLEM : (I use event structure
Attachments:
Problem.zip 52 KBLabview uses the dataflow to chain the execution. That is, as soon as one item of data is ready is is presented to the next stage.
Global (or local) variables do not easily fit in there. A variable is always present and ready to give away it's data. It does not matter that you write to it in one vi. Another vi, that is running concurrently is not aware that the content may have changed.
Especially if you reference variables outside of loops, the value is taken just once and never updated. Be aware! If in doubt, use the tracing facilty (the light bulb) to follow the data flow.
Gabi
7.1 -- 2013
CLA
Maybe you are looking for
-
Invalid extract structure template && of DataSource &&
Hi, While creating a z datasource i have received the above error. Fom the previous threads here (and from notes 202162 & 335342) I can understand that when there are Currency or Quantity fields included in the datasource, their key fields (CUKY for
-
Manual duplex HP LaserJet Pro 200 color MFP M276
I have a HP LaserJet Pro 200 color MFP M276 and my manual duplex is not duplexing properly. There are no error messages just me grumbling at the final output. I am using Windows 8.1 Pro and no new hard or software changes. Here is what happens: I am
-
Is there a short/hotkey to show/hide bookmark toolbar?
I would like to have in options>bookmark toolbar unchecked, and a hot key or shortcut key to show or hide the bookmark toolbar. Having it checked takes room, and the autohide mouse hover addons get annoying when your going type in the URL bar and not
-
Http-xi-RFC synchronous call - multiple records ?
Hi Gurus, Can we have multiple records processing in RFC synchronous call ? for ex, BAPI_COMPANY_GET_DETAIL. I want to feed multiple company ids and get the responses in browser. I have changed cardinality in message mapping and interface mapping as
-
I just purchased Photoshop Elements 13 and now find it doesn't open .eps files.
What adobe product does open .eps files and can I "return" Elements 13?