Dynamic IP/Tacacs+ problem
Hi,
I have several sites using Cisco 877 routers connecting to the Internet through a broadband connection. The ISP is giving us a dynamic ip to the routers. I want to reach an ACS server (using Dynamic DNS) to authenticate users to have access to the internet.
Can the router be configured to look for the Tacacs server using the server domain (www.whatever.com), instead of the ip address? If so, how?
Any help will be very much appreciated.
Regards,
Eduardo
You may consider using a dynamically negotiated IPsec tunnel and use the local ethernet on the router (mostly a private IP) to authenticate. You can force the interface to be used for authentication using the command:
ip radius source-interface ...
In that way, you will always have a unique ip for authentication.
Regards,
Leo
Similar Messages
-
Dynamic Credit check - problem -Delivery creation from Sales order
Hi
we have a problem which i would appreciate some help with.
Sales order is blocked for credit and subsequently released via VKM1
BUT as soon as line item is selected and then Sales document > deliver -
the Dynamic credit block kicks in again straight away, no other changes have been made
why is this occurring ?
I managed to get round the problem by creating delivery via VL10c and selecting line item and then create in backgroundHi Tony,
Do you have a credit check active again at Delivery level?
In OVA8 - for the combination of credit control area, risk cat & credit group - please check field 'Number of days'.
If you do not wish to carry out the credit check again for the released doc, here you can maintain the number of days.
Description of F1 for this field is as below.
Credit check: Number of days without check
Specifies the number of days after which a changed document must be re-checked for credit.
Use
This function is used for checking documents that have already been released by a credit representative, but that have subsequently been changed. The system does NOT carry out another credit check if the following conditions are met:
The value of the changed order is not greater than the value already approved for credit (inclusive of the deviation factor), AND
The current date is not greater than the original release date plus the number of days specified here
thanks
Anirudh -
Dynamic internal table problem in FM - HR_INFOTYPE_OPERATIONS
Dear All,
I have a problem when I use a Dynamic internal table in FM - HR_INFOTYPE_OPERTATION..
Please suggest me on the way to overcome this problem..
We wanted to have a dynamic Program for Info type operations which can be used for any info types as we are changing only BEGDA and the related actions
So in my program I have the parameters to accept
P_BEGDA - 01.10.2007
P_INFTY - P0008
P_ACTIO - COPY
I am able to create a dynamic table based on the parameters P_INFTY and able to read it also using the FM - HR_READ_INFOTYPE
BUT when I pass the dynamic internal table to a FM - HR_INFOTYPE_OPERTATION I am getting a DUMP
The DUMP is at the below statement from FM - HR_INFOTYPE_OPERTATION
ASSIGN record TO <record> CASTING TYPE (tabname). "XDP UniCode
It gives the below possiblities
"ASSIGN_BASE_TOO_SHORT" C
"SAPLHRMM" or "LHRMMU03"
"HR_INFOTYPE_OPERATION"
But If I use the below internal table
Data : g_t_0008 like P0008 occurs 0 with header line.
And If I use the internal table g_t_0008 instead of dynamic tables then it works. So I strongly feel it's due to not having a header in the dynamic table below see below the sample code on how I am generating a dynamic internal table
field-symbols: <dyn_table> type standard table.
data: dy_table type ref to data,
dy_line type ref to data,
xfc type lvc_s_fcat,
ifc type lvc_t_fcat.
to get the srurcute
perform get_structure using l_f_table.
perform create_dynamic_itab .
assign dy_table->* to <dyn_table>.
perform get_data tables <dyn_table01>
using pernr-pernr p_infty.
below are the forms routine .
form get_structure using p_table.
data : idetails type abap_compdescr_tab,
xdetails type abap_compdescr.
data : ref_table_des type ref to cl_abap_structdescr.
clear : ifc[], dy_table.
Get the structure of the table.
ref_table_des ?=
cl_abap_typedescr=>describe_by_name( p_table ).
idetails[] = ref_table_des->components[].
loop at idetails into xdetails.
clear xfc.
xfc-fieldname = xdetails-name .
xfc-datatype = xdetails-type_kind.
xfc-inttype = xdetails-type_kind.
xfc-intlen = xdetails-length.
xfc-decimals = xdetails-decimals.
append xfc to ifc.
endloop.
endform.
form create_dynamic_itab.
Create dynamic internal table and assign to FS
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = ifc
importing
ep_table = dy_table.
endform.
*& Form get_data
form get_data tables p_table
using p_pernr
p_infty.
clear : p_table, p_table[].
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
PERNR = P_PERNR
INFTY = p_infty
BEGDA = p_datum
ENDDA = p_datum
TABLES
INFTY_TAB = p_table
EXCEPTIONS
INFTY_NOT_FOUND = 1
OTHERS = 2.
CHECK SY-SUBRC EQ 0.
IF lines( p_table ) GT 0.
*write :/'Record exist' , 'IT', p_infty.
clear p_table.
PERFORM hr_operation tables p_table
using g_t_t588d-actio g_t_t588d-INFTY
g_t_t588d-SUBTY.
else.
PERFORM append_status using g_t_itab-pernr p_infty ' '
'Error' 'No records'.
ENDIF.
endform. " get_data
form hr_operation tables p_table
using p_actio P_INFTY P_SUBTY.
data: l_f_return LIKE bapireturn1.
ASSIGN COMPONENT 'BEGDA' OF STRUCTURE p_table TO <l_field>.
<l_field> = p_begda.
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
infty = P_infty
number = G_T_ITAB-PERNR
subtype = P_subty
validityend = g_f_endda
validitybegin = P_datum
record = P_TABLE
operation = p_actio
IMPORTING
return = l_f_return.
IF sy-subrc NE 0.
ENDIF.
ENDFORM.try
using field symbol for a wrk area instead of Field symbol for a table
loop your inernal table (again a field symbol) assigning to <fs_wrkarea>
in loop call HR_INFO.._OP..
reward if helpful -
Error Message through Dynamic Configuration length problem
HI All,
We are trying to raise an error message with the help of Dynamic configuration in the Message mapping.
The need is to populate the message with certain variables.
However we are facing the problem that the message is getting truncated beyond a certain length.(Around 60 characters)
Similar custom messages in other interfaces are working fine for messages up to 100 characters.
Question:
1. What could be the maximum length for an error message in case of mapping failure?
2. What could be limiting the length of the message in our case?
Thank you for looking into this.
Regards,
Ankeshhi Ankesh,
yes, there is limit length, see this oss [Note 974481 - XI Adapter Framework DynamicConfiguration Module|https://service.sap.com/sap/support/notes/974481]
regards.
Mickale -
I have created a dynamic text box and an input text box.
I have produced code that replicates whatever is typed in the
input box to display in the dynamic box along with a date and time
stamp once a button is clicked.
This all works fine, except for the sizes of the fonts. for
both boxes, i selected font size 10 . The input box is fine,
however the dynamic box text is huge.
When i make the dynamic text font smaller, it fits in fine,
but the input text that is inserted into the dynamic text box comes
in too big. If i make the input text box font smaller it is
unreadable when typing it in.
any soultion to how to make my font consistent. I am assumin
the problem is because both the text boxes are different sizes,
however i don't know how to resolve the issue.
Any help is much appreciated.
Laurahi laura
i think the problem it's in the targetPath "
mainClip.newspaper_mc.newinstructions.text =
lu.welcome[langIdx];".
chech if you have mistype the instance names of your
movieClip and rewrite it or in the Actions panel select the path "
mainClip.newspaper_mc.newinstructions" and click the button
"Insert Target Path" this will open a popup with a tree of your
MC's on the stage, so you can browse and find the textfield. i hope
i helped you if not let me know! -
Dynamic class loading problem using unknown JAR archive and directory names
I read the following article, which enlightened me a lot:
Ted Neward: Understanding Class.forName().
However, it took me some while to understand that my problem is the other way around:
I know the name of the class, I know the name of the method,
but my program/JVM does not know where to load the classes from.
Shortly, my problem is that the server engine that I am writing
uses two different versions of the same library.
So I am trying out the following solution:
My program is named TestClassPathMain.java
Assume the two libraries are named JAR1.jar and JAR2.jar
and the class/instance method that should
be exposed to TestClassPathMain.java by them is named
TestClass1.testMethod().
As long as I was depending on just one library,
I put JAR1.jar in the classpath before starting java,
and I was happy for a while.
At the moment I got the need to use another version of
TestClass1.testMethod() packaged in JAR2.jar,
a call would always access JAR1.jar's
TestClass1.testMethod().
I then decided to remove JAR1.jar from the classpath,
and programmatically define two separate ClassLoaders, one for use
with JAR1.jar and the other for use with JAR2.jar.
However, the problem is only partly solved.
Please refer to the enclosed code for details.
(The code in the JAR1.jar/JAR2.jar is extremely simple,
it just tells (by hardcoding) the name of the jar it is packaged in
and instantiates another class packaged in the same jar using
the "new" operator and calls a method on it. I don't enclose it.)
The TestClassPathMain.java/UC1.java/UC2.java code suite was
successfully compiled with an arbitrary of JAR1 or JAR2 in the classpath,
however removed from the classpath at runtime.
(I know that this could have been done (more elegantly...?) by producing an Interface,
but I think the main problem principle is still untouched by this potential lack of elegancy(?))
1) This problem should not be unknown to you experts out there,
how is it generally and/or most elegantly solved?
The "*** UC2: Variant 2" is the solution I would like best, had it only worked.
2) And why arent "*** UC2: Variant 2" and
"*** static UC2: Variant 2" working,
while "*** Main: Variant 2" is?
3) And a mal-apropos:
Why can't I catch the NoClassDefFoundError?
The output:
*** Main: Variant 1 JAR 1 ***:
Entering TestClass1.testMethod() packaged in JAR1.jar
About to instantiate TestClass2 with the new operator
About to call TestClass2.testMethod()
Entering TestClass2.testMethod() packaged in JAR1.jar
*** Main: Variant 1 JAR 2 ***:
Entering TestClass1.testMethod() packaged in JAR2.jar
About to instantiate TestClass2 with the new operator
About to call TestClass2.testMethod()
Entering TestClass2.testMethod() packaged in JAR2.jar
*** Main: Variant 2 JAR 1 ***:
Entering TestClass1.testMethod() packaged in JAR1.jar
About to instantiate TestClass2 with the new operator
About to call TestClass2.testMethod()
Entering TestClass2.testMethod() packaged in JAR1.jar
*** Main: Variant 2 JAR 2 ***:
Entering TestClass1.testMethod() packaged in JAR2.jar
About to instantiate TestClass2 with the new operator
About to call TestClass2.testMethod()
Entering TestClass2.testMethod() packaged in JAR2.jar
*** UC1: Variant 1 JAR 1 ***:
Entering TestClass1.testMethod() packaged in JAR1.jar
About to instantiate TestClass2 with the new operator
About to call TestClass2.testMethod()
Entering TestClass2.testMethod() packaged in JAR1.jar
*** UC1: Variant 1 JAR 2 ***:
Entering TestClass1.testMethod() packaged in JAR2.jar
About to instantiate TestClass2 with the new operator
About to call TestClass2.testMethod()
Entering TestClass2.testMethod() packaged in JAR2.jar
*** static UC2: Variant 2 JAR 1 ***:
Exception in thread "main" java.lang.NoClassDefFoundError: TestClass1
at UC2.runFromJarVariant2_static(UC2.java:56)
at TestClassPathMain.main(TestClassPathMain.java:52)
TestClassPathMain.java
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
public class TestClassPathMain {
public static void main(final String args[]) throws MalformedURLException, ClassNotFoundException, InstantiationException, SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
// Commented out because I cannot catch the NoClassDefFoundError.
// Why?
try {
final TestClass1 testClass1 = new TestClass1();
System.out.println(
"\nThe class TestClass1 is of some unexplicable reason available." +
"\nFor the purpose of the test, it shouldn't have been!" +
"\nExiting");
System.exit(1);
} catch (NoClassDefFoundError e) {
System.out.println("\nPositively confirmed that the class TestClass1 is not available:\n" + e);
System.out.println("\n\nREADY FOR THE TEST: ...");
// Works fine
System.out.println("\n*** Main: Variant 1 JAR 1 ***:");
runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
System.out.println("\n*** Main: Variant 1 JAR 2 ***:");
runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
// Works fine
System.out.println("\n*** Main: Variant 2 JAR 1 ***:");
runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
System.out.println("\n*** Main: Variant 2 JAR 2 ***:");
runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
// Works fine
final UC1 uc1 = new UC1();
System.out.println("\n*** UC1: Variant 1 JAR 1 ***:");
uc1.runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
System.out.println("\n*** UC1: Variant 1 JAR 2 ***:");
uc1.runFromJarVariant1("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
// Crashes
System.out.println("\n*** static UC2: Variant 2 JAR 1 ***:");
UC2.runFromJarVariant2_static("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
System.out.println("\n*** static UC2: Variant 2 JAR 2 ***:");
UC2.runFromJarVariant2_static("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
// Crashes
final UC2 uc2 = new UC2();
System.out.println("\n*** UC2: Variant 2 JAR 1 ***:");
uc2.runFromJarVariant2("file:/W:/java/eclipse/workspaces/simped_test/CP1/JAR1.jar");
System.out.println("\n*** UC2: Variant 2 JAR 2 ***:");
uc2.runFromJarVariant2("file:/W:/java/eclipse/workspaces/simped_test/CP2/JAR2.jar");
private static void runFromJarVariant1(final String jarFileURL)
throws MalformedURLException,
ClassNotFoundException,
InstantiationException,
IllegalArgumentException,
IllegalAccessException,
InvocationTargetException,
SecurityException,
NoSuchMethodException {
final URL url = new URL(jarFileURL);
final URLClassLoader cl =
new URLClassLoader(new URL[]{url},
Thread.currentThread().getContextClassLoader());
final Class clazz = cl.loadClass("TestClass1");
final Object testClass1 = clazz.newInstance();
final Method testMethod1 = clazz.getMethod("testMethod", null);
testMethod1.invoke(testClass1, null);
private static void runFromJarVariant2(final String jarFileURL)
throws MalformedURLException,
ClassNotFoundException,
InstantiationException,
IllegalArgumentException,
IllegalAccessException,
InvocationTargetException,
SecurityException,
NoSuchMethodException {
final URL url = new URL(jarFileURL);
final URLClassLoader cl =
new URLClassLoader(new URL[]{url},
Thread.currentThread().getContextClassLoader());
final Class clazz = cl.loadClass("TestClass1");
final TestClass1 testClass1 = new TestClass1();
testClass1.testMethod();
UC1.java
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
public class UC1 {
public void runFromJarVariant1(final String jarFileURL)
throws MalformedURLException,
ClassNotFoundException,
InstantiationException,
IllegalArgumentException,
IllegalAccessException,
InvocationTargetException,
SecurityException,
NoSuchMethodException {
final URL url = new URL(jarFileURL);
final URLClassLoader cl =
new URLClassLoader(new URL[]{url},
Thread.currentThread().getContextClassLoader());
final Class clazz = cl.loadClass("TestClass1");
final Object testClass1 = clazz.newInstance();
final Method testMethod1 = clazz.getMethod("testMethod", null);
testMethod1.invoke(testClass1, null);
UC2.java
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLClassLoader;
public class UC2 {
public void runFromJarVariant2(final String jarFileURL)
throws MalformedURLException,
ClassNotFoundException,
InstantiationException,
IllegalArgumentException,
IllegalAccessException,
InvocationTargetException,
SecurityException,
NoSuchMethodException {
final URL url = new URL(jarFileURL);
final URLClassLoader cl =
new URLClassLoader(new URL[]{url},
Thread.currentThread().getContextClassLoader());
final Class clazz = cl.loadClass("TestClass1");
final TestClass1 testClass1 = new TestClass1();
testClass1.testMethod();
* Identic to the "runFromJarVariant2" method,
* except that it is static
public static void runFromJarVariant2_static(final String jarFileURL)
throws MalformedURLException,
ClassNotFoundException,
InstantiationException,
IllegalArgumentException,
IllegalAccessException,
InvocationTargetException,
SecurityException,
NoSuchMethodException {
final URL url = new URL(jarFileURL);
final URLClassLoader cl =
new URLClassLoader(new URL[]{url},
Thread.currentThread().getContextClassLoader());
final Class clazz = cl.loadClass("TestClass1");
final TestClass1 testClass1 = new TestClass1();
testClass1.testMethod();
}2. i need to load the class to the same JVM (i.e. to
the same environment) of the current running
aplication, so that when the loaded class is run, it
would be able to invoke methods on it!!!
ClassLoader(s) do this. Try the URLClassLoader.
(I was talking about relatively esoteric "security"
issues when I mentioned the stuff about Class objects
"scope".) You might use the URLClassLoader kind of
like this.
Pseudo-code follows:
// setup the class loader
URL[] urls = new URL[1];
urls[0] = new URL("/path/to/dynamic/classes");
URLClassLoader ucl = new URLClassLoader(urls);
// load a class & use make an object with the default constructor
Object tmp = ucl.loadClass("dynamic.class.name").newInstance();
// Cast the object to a know interface so that you can use it.
// This may be used to further determine which interface to cast
// the class to. Or it may simply be the interface to which all
// dynamic classes have to conform in your program.
InterfaceImplementedByDynamicClass loadedObj =
(InterfaceImplementedByDynamicClass)tmp;It's really not as hard as it sounds, just write a little test of
this and you will see how it works. -
Dynamic class load problem..
Hello all,
I am rather new to this concept of creating class loaders.
I started on a simple test and landed into a problem right away. I have a Java class file stuffed away somewhere on m machine (at a location not on my CLASSPATH) . I just want to load that class dynamically. Here is my humble code :
import java.io.*;
public class DynamicClassLoadTest extends ClassLoader {
String classFileName;
String pathToClassFile;
public static void main(String[] args) {
try {
if(args.length != 2) {
System.out.println("Usage : java DynamicClassLoadTest <path to class file> <name of class file>");
System.exit(0);
System.out.println("MISSION: To dynamically load class " + args[1] + " from path : " + args[0]);
DynamicClassLoadTest dcl = new DynamicClassLoadTest();
Class cls = dcl.loadClass(args[1], args[0], true);
catch(Exception e) {
System.out.println("Mission failed with error : " + e);
e.printStackTrace();
public Class loadClass(String name, String path, boolean resolve)
throws ClassNotFoundException
this.pathToClassFile=path;
this.classFileName= name;
return (loadClass(name, resolve));
public Class loadClass(String name, boolean resolve)
throws ClassNotFoundException
try {
File f = new File(pathToClassFile, name + ".class");
if(!f.exists())
throw new ClassNotFoundException("Specified class not found");
FileInputStream fis = new FileInputStream(f);
long fileSize = f.length();
System.out.println("Size of class file = " + fileSize);
byte[] classBytes = new byte[(int) fileSize];
int r = fis.read(classBytes);
System.out.println("Bytes read is " + r + " and file size is " + fileSize + " and byte array length is " + classBytes.length);
Class c = defineClass(name, classBytes, 0, classBytes.length);
System.out.println("CLASS created..");
return c;
catch(Exception e) {
throw new ClassNotFoundException(e.getMessage());
When I execute as :
java DynamicClassLoadTest /Users/user1 JustTest
the below is printed on execution :
MISSION: To dynamically load class JustTest from path : /Users/user1
Size of class file = 421
Bytes read is 421 and file size is 421 and byte array length is 421
Exception in thread "main" java.lang.NoClassDefFoundError: java/lang/Object
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
at java.lang.ClassLoader.defineClass(ClassLoader.java:431)
at DynamicClassLoadTest.loadClass(DynamicClassLoadTest.java:56)
at DynamicClassLoadTest.loadClass(DynamicClassLoadTest.java:33)
at DynamicClassLoadTest.main(DynamicClassLoadTest.java:18)
The class file has apparently been read fine - then why is this java/lang/object reference ?
Any tips would be of huge help.
Thanks.An extension to this.
What should I do when I have to load a jar dynamically ? I manage to load the main class of the jar successfully. But what about classes in the jar which are invoked by this class. Say we have case as below :
JustAJar.jar contains :
sh-2.05a$ jar tvf JustAJar.jar
0 Fri May 23 14:41:14 PDT 2003 META-INF/
70 Fri May 23 14:41:14 PDT 2003 META-INF/MANIFEST.MF
567 Fri May 23 14:40:52 PDT 2003 InvokeTheNext.class
475 Fri May 23 14:40:52 PDT 2003 InvokeMe.class
Now, InvokeMe is the class I instantiate :
public class InvokeMe {
public static void main(String[] args) {
System.out.println("Welcome to InvokeMe");
InvokeTheNext itn = new InvokeTheNext("InvokeMe");
InvokeTheNext is :
public class InvokeTheNext {
public InvokeTheNext(String str) {
System.out.println("Welcome to InvokeTheNext");
System.out.println("Recd ur msg " + str);
Now I manage to define and resolve the class InvokeMe, but when the class is invoked, the foll error is thrown :
Resolved class with name InvokeMe successfully
Welcome to InvokeMe
Mission failed with error : java.lang.reflect.InvocationTargetException
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at InvokeForClassLoad.main(InvokeForClassLoad.java:46)
Caused by: java.lang.NoClassDefFoundError: InvokeTheNext
at InvokeMe.main(InvokeMe.java:4)
I tried loading the entire jar file into the CLASSPATH dynamically (using System.setProperty) but that doesnt help. Any inputs please ?
Thanks. -
Urgent, creating xml files dynamically, request dispatcher problem
hi all,
Problem 1:
There is a problem we are facing, while request dispatching.
The files CBECBC.XML & CBECBC_Envelop.XML,
both xml files. These files are created on request from the user, dynamically, and displayed on the browser,
by including them in a jsp page.
Here we face a problem when they are to be included into the jsp page.
The error is the following :
//////// Error ////////
Could not find request dispatcher for the url CBECBC.xml
Could not find request dispatcher for the url CBECBC_Envelop.xml
The created files are stored in the "d:\pstudio35\desks\bank\BankWeb\".
We are using " <jsp:include page="...."/> " (dynamic jsp include tag), to include the xml files.
Problem 2:
And could you just let me know how to include a xml file in a jsp file,
so that the xml file is displayed in the exact format of xml(with the tags).
I am using Pramati Studio 3.5
Its urgent!!!
Regards,
Deepa Datarproblem 2:
either translate all < en > into < and > or display the XML in a textarea -
A challenging dynamic SQL query problem
hi All,
I have a very interesting problem at work:
We have this particular table defined as follows :
CREATE TABLE sales_data (
sales_id NUMBER,
sales_m01 NUMBER,
sales_m02 NUMBER,
sales_m03 NUMBER,
sales_m04 NUMBER,
sales_m05 NUMBER,
sales_m06 NUMBER,
sales_m07 NUMBER,
sales_m08 NUMBER,
sales_m09 NUMBER,
sales_m10 NUMBER,
sales_m11 NUMBER,
sales_m12 NUMBER,
sales_prior_yr NUMBER );
The columns 'sales_m01 ..... sales_m12' represents aggregated monthly sales, in which 'sales_m01' translates to 'sales for the month of january, january being the first month, 'sales_m02' sales for the month of february, and so on.
The problem I face is that we have a project which requires that a parameter be passed to a stored procedure which stands for the month number which is then used to build a SQL query with the following required field aggregations, which depends on the parameter passed :
Sample 1 : parameter input: 4
Dynamically-built SQL query should be :
SELECT
SUM(sales_m04) as CURRENT_SALES,
SUM(sales_m01+sales_m02+sales_m03+sales_m04) SALES_YTD
FROM
sales_data
WHERE
sales_id = '0599768';
Sample 2 : parameter input: 8
Dynamically-built SQL query should be :
SELECT
SUM(sales_m08) as CURRENT_SALES,
SUM(sales_m01+sales_m02+sales_m03+sales_m04+
sales_m05+sales_m06+sales_m07+sales_m08) SALES_YTD
FROM
sales_data
WHERE
sales_id = '0599768';
So in a sense, the contents of SUM(sales_m01 ....n) would vary depending on the parameter passed, which should be a number between 1 .. 12 which corresponds to a month, which in turn corresponds to an actual field range on the table itself. The resulting dynamic query should only aggregate those columns/fields in the table which falls within the range given by the input parameter and disregards all the remaining columns/fields.
Any solution is greatly appreciated.
Thanks.Hi another simpler approach is using decode
try like this
SQL> CREATE TABLE sales_data (
2 sales_id NUMBER,
3 sales_m01 NUMBER,
4 sales_m02 NUMBER,
5 sales_m03 NUMBER,
6 sales_m04 NUMBER,
7 sales_m05 NUMBER,
8 sales_m06 NUMBER,
9 sales_m07 NUMBER,
10 sales_m08 NUMBER,
11 sales_m09 NUMBER,
12 sales_m10 NUMBER,
13 sales_m11 NUMBER,
14 sales_m12 NUMBER,
15 sales_prior_yr NUMBER );
Table created.
SQL> select * from sales_data;
SALES_ID SALES_M01 SALES_M02 SALES_M03 SALES_M04 SALES_M05 SALES_M06 SALES_M07 SALES_M08 SALES_M09 SALES_M10 SALES_M11 SALES_M12 SALES_PRIOR_YR
1 124 123 145 146 124 126 178 189 456 235 234 789 19878
2 124 123 145 146 124 126 178 189 456 235 234 789 19878
1 100 200 300 400 500 150 250 350 450 550 600 700 10000
1 101 201 301 401 501 151 251 351 451 551 601 701 10000----now for your requirement. see below query if there is some problem then tell.
SQL> SELECT sum(sales_m&input_data), DECODE (&input_data,
2 1, SUM (sales_m01),
3 2, SUM (sales_m01 + sales_m02),
4 3, SUM (sales_m01 + sales_m02 + sales_m03),
5 4, SUM (sales_m01 + sales_m02 + sales_m03 + sales_m04),
6 5, SUM (sales_m01 + sales_m02 + sales_m03 + sales_m04 + sales_m05),
7 6, SUM (sales_m01 + sales_m02 + sales_m03 + sales_m04+sales_m05+sales_m06),
8 7, SUM (sales_m01 + sales_m02 + sales_m03 + sales_m04+sales_m05+sales_m06+sales_m07),
9 8, SUM (sales_m01 + sales_m02 + sales_m03 + sales_m04+sales_m05+sales_m06+sales_m07+sales_m08),
10 9, SUM (sales_m01 + sales_m02 + sales_m03 + sales_m04+sales_m05+sales_m06+sales_m07+sales_m08+sales_m09),
11 10,SUM (sales_m01 + sales_m02 + sales_m03 + sales_m04+sales_m05+sales_m06+sales_m07+sales_m08+sales_m09+sales_m10),
12 11,SUM (sales_m01 + sales_m02 + sales_m03 + sales_m04+sales_m05+sales_m06+sales_m07+sales_m08+sales_m09+sales_m10+sales_m11),
13 12,SUM (sales_m01 + sales_m02 + sales_m03 + sales_m04+sales_m05+sales_m06+sales_m07+sales_m08+sales_m09+sales_m10+sales_m11+sales_m12)
14 ) total
15 FROM sales_data
16 WHERE sales_id = 1;
Enter value for input_data: 08
Enter value for input_data: 08
old 1: SELECT sum(sales_m&input_data), DECODE (&input_data,
new 1: SELECT sum(sales_m08), DECODE (08,
SUM(SALES_M08) TOTAL
890 5663 -
Dynamic Table creation Problem
Hi All,
I have a requirement to create tables dynamically based on data coming from backend .
The problem is there can be muliple tables created based on data.and I need to fill each row of tables correspondingly.Row and column values might very for each and every tables.
Other issue is how will I attach a selection listener to any column created dynamically.
It will be useful if anyone can provide some example for implementing same.
Thanks in Advance.Hi,
1. You don't add a selection listener to a column but the table. The selection listener is a MethodExpression that points to a managed bean method. You can manually create a MethodExpression from FacesContext --> Application --> ExpressionFactory (for this you need FacesContext --> ELContext). Once you have the MethodExpression you can call the setter on RichTable
2. For querying the data, you can build tables based on Arrays. So queue the data in an array and you will be good to go. The question however is, what is the object type to put into the array and this I don't know because I no nothing about how the data arrives in your managed bean
However, since tables rows are not stuffed cell-by-cell you need to provide a row object
Frank -
I have followed the tutorial in on dynamic query and created a region where the type is SQL Query (PL/SQL function body returning SQL Query)
The source is
declare
q varchar2(4000);
teatid NUMBER := :P305_TARGET_ID;
begin
wwv_flow.debug('teatid = ' || teatid);
q:=' select f.id, ';
q:=q||' f.eat_id ';
q:=q||' from xmlTransactions f ';
q:=q||' where f.eat_id = ' || teatid; -- I've also tried putting :P305_TARGET_ID here
wwv_flow.debug('sql = ' || q);
return q;
end;
I have chosen "Use Generic Column Names...".
When I run the page, I get NO ROWS FOUND. However, when I cut and paste the SQL statement printed out by the debug statement and run it, it returns rows. Both debug statements print correct values.
I'm not sure what the problem is here, but basically, I want to do a query where I substitute a value passed into the page from another page.
In this case the value in P305_TARGET_ID is passed in via a button spawning a popup as in var url = 'f?p=&APP_ID.:305:&APP_SESSION.::::P305_TARGET_ID:' + targetID;
APEX version is 3.0.1.00.08
Thank you.
- JohnWHi, JohnW
I don't understand why you use a dynamic query for that.
A "direct" SQL query like this :
select f.id,f.eat_id from xmlTransactions f where f.eat_id=:P305_TARGET_ID;
should work.
Mike -
Dynamic Jump Menu Problem in CS3
I'm trying to create a link in a Jump Menu to a Detail Page.php by setting the parameters in the menu item to match a value in a recordset. When selected from the menu, a new page should open with a subset of the original php page. So far I haven't found a method to transfer a value in the menu to a url parameter which can be used by the target php page. Any suggestions appreciated.
Regards to the ListNevermind. I was over-thinking the problem and adding dynamic parameters, when a simple solution was all that was required.
Regards to the list. -
Dynamic Admin Role Problems - IDM7.1
Hi Everyone. I'm having problems getting a dynamic admin role to work correctly. No matter what I do I always get the error at logon that the user controls no organizations and has no capabilities. Here is how the admin role is configured.
General:
Type = Identity Objects
Assigners = blank (I have also tried configurator)
Organizations = Top
Scope of Control:
Controlled Organizations = Top
None for everything else.
Capabilities:
All caps assigned, no cap rule.
Assign to users:
Has the rule below assigned to it. If I check a user that is in the AD group mentioned in the rule, it gives me a '1', if I check one that doesn't have the group, a '0'
Rule:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE Rule PUBLIC 'waveset.dtd' 'waveset.dtd'>
<!-- MemberObjectGroups="#ID#Top" authType="UserIsAssignedAdminRoleRule" id="#ID#Rule:IAM Admin Admin Role Rule" lastMod="26" lastModifier="Configurator" name="IAM Admin Admin Role Rule"-->
<Rule authType='UserIsAssignedAdminRoleRule' id='#ID#Rule:IAM Admin Admin Role Rule' name='IAM Admin Admin Role Rule' createDate='1239044336520' lastModifier='Configurator' lastModDate='1248287397906' lastMod='26'>
<RuleArgument name='context'/>
<RuleArgument name='runAsUser'/>
<isTrue>
<contains>
<rule name='my_rulelibrary:get_DownCaseList'>
<argument name='dnlist' value='$(runAsUser.accounts[AD].groups)'/>
</rule>
<downcase>
<rule name='my_Configuration:IAM Admin Group Name'/>
</downcase>
</contains>
</isTrue>
<MemberObjectGroups>
<ObjectRef type='ObjectGroup' id='#ID#Top' name='Top'/>
</MemberObjectGroups>
</Rule>I have also added the item below to the system configuration and reset the app server
<Attribute name='authz'>
<Object>
<Attribute name='checkDynamicallyAssignedAdminRolesAtLoginTo'>
<Object>
<Attribute name='Administrator Interface'>
<Boolean>true</Boolean>
</Attribute>
<Attribute name='Service Provider User Interface'>
<Boolean>false</Boolean>
</Attribute>
<Attribute name='User Interface'>
<Boolean>true</Boolean>
</Attribute>
</Object>
</Attribute>
</Object>
</Attribute>Any ideas?Hi,
the view handed to these kind of rules is created with the noFetch option set to true. As a result the AD groups of the user are not available during rule evaluation.
You could solve your task by doing a search using the FormUtil class.
I would however advise you to only do this in a small or demo environment as the usage of usermember rules does not scale at all. This is a pure sales feature that will quickly bring down a production environment with high CPU utilization and horrible response times. Unlike what one might guess these rules are not only evaluated during login but almost all the time, often multiple times for each click. Even if the rule as such only performs cheap operations the AuthCache class hogs more and more CPU time with each rule of this kind you add to the system.
Regards,
Patrick -
Dynamic ITAB copy problem with field type P
Hello everyone
I need to copy the structure of an internal table that is pass by reference into a method.
Actually everything is fine else than the field type P with decimal is not created properly in the new itab.
Scenario:
An internal table is pass by reference to a method. We need to trait the data without modifying the original table. The Idea is to copy the structure and the data of the referenced internal table into an internal table created dymanically in the method.
Here is what I did and working fine when there are no field of data type "CURR".
Extract the structure of the reference data.
Create a dynamic internal table.
So far so good. Everything seams to work fine. BUT
when I am trying to copy the data from the reference table to the just created internal table the field with data type "CURR" doesn't work.
Here is my example:
FIELD-SYMBOLS: <FS_TABLE> TYPE STANDARD TABLE,
<TMP_TABLE> TYPE STANDARD TABLE,
<LS_TMP_TABLE> TYPE ANY,
<LS_TABLE> TYPE ANY,
<LS_VALUE> TYPE ANY.
DATA: lt_data TYPE STANDARD TABLE OF vbak,
ls_data LIKE LINE OF lt_sortfield,
ref_data TYPE REF TO data,
l_structure TYPE REF TO DATA,
lv_ltname TYPE string.
select * from vbak UP TO 10 rows INTO CORRESPONDING FIELDS OF TABLE lt_data.
* --- Assign the reference variable to the table
* ---- Only use to simulate a parameter that is assign to a reference to a internal table
unassign <FS_TABLE>.
lv_ltname = 'lt_data[]'.
ASSIGN (lv_ltname) to <FS_TABLE>.
GET REFERENCE OF <FS_TABLE>[] INTO ref_data.
* --- Assign the reference to the field-symbol
UNASSIGN <FS_TABLE>.
ASSIGN ref_data->* TO <FS_TABLE>.
* --- Create a working area for the reference table to a field-table
CREATE DATA l_structure LIKE LINE OF <FS_TABLE>.
ASSIGN l_structure->* TO <LS_TABLE>.
* --- Retrieve the structure of the field-symbol pointing to the internal table
DATA: lr_tabledescr TYPE REF TO cl_abap_tabledescr, " Internal Table description
_r_structdescr TYPE REF TO cl_abap_structdescr.
lr_tabledescr ?= cl_abap_tabledescr=>describe_by_data( <fs_table> ).
_r_structdescr ?= lr_tabledescr->get_table_line_type( ).
* --- Read internal table structure to create dynamic internal table
data: ls_struc like LINE OF _r_structdescr->components,
xfc type lvc_s_fcat,
ifc type lvc_t_fcat.
* --- Why the field (component) NETWR length is now 8 instead of 15?
LOOP AT _r_structdescr->components into ls_struc.
clear xfc.
xfc-fieldname = ls_struc-name .
xfc-datatype = ls_struc-type_kind.
xfc-inttype = ls_struc-type_kind.
xfc-intlen = ls_struc-length.
xfc-decimals = ls_struc-decimals.
append xfc to ifc.
ENDLOOP.
DATA: dy_table type ref to data,
* --- Create dynamic internal table
call method cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = ifc
IMPORTING
ep_table = dy_table.
* --- assign reference internal table to Field-symbol
assign dy_table->* to <tmp_table>.
unassign <ls_tmp_table>.
DATA: ls_tmp_struc type REF TO DATA.
CREATE DATA ls_tmp_struc like LINE OF <tmp_table>.
ASSIGN ls_tmp_struc->* TO <ls_tmp_table>.
Loop at <fs_table> INTO <LS_TABLE>.
MOVE-CORRESPONDING <ls_table> TO <ls_tmp_table>.
APPEND <ls_tmp_table> TO <tmp_table>.
ENDLOOP.
* <fs_table>-netwr length is 15
* <ls_tmp_table>-netwr length is 8
* ??????????? Why the length is different?
* ??????????? It should a structure copy and have the
* ??????????? same length
I use VBAK as example, and the field NETWR is using data type "NETWR_AK" where it us a data type "CURR" with length 15 and decimal 2.
When reading the structure, the method get_table_line_type of the class cl_abap_tabledescr return a length of 8 instead of 15.
Any idea how to get the exact structure of a variable that is refering to a data type?
Regards
DanielHello Everyone
Thank you for your replies.
I think I didn't explain myself clearly.
My goal is to be able to create an exact structure copy of a "Type ref to data" into a new internal table that is not defined yet.
Example:
A method contain a parameter that is a ref to DATA type.
That parameter is refering to an internal table from the calling program.
Now I want to create an internal table into the method where this one will be an exact structure copy of the parameter.
So, lets put some name here.
parameter: ip_data type ref to data.
FIELD-SYMBOLS: <FS_REF_DATA> TYPE STANDARD TABLE,
<FS_CP_DATA> TYPE STANDARD TABLE.
ASSIGN ip_data->* TO <FS_REF_DATA>.
" some code to assign the same structure to <FS_CP_DATA> from <FS_REF_DATA>
" than copy the data from <FS_REF_DATA> to <FS_CP_DATA>.
<FS_CP_DATA> [ ] = <FS_REF_DATA> [ ]. " This is working if no type P with decimal exist into the structure
" Than I can play with the data of <FS_CP_DATA> without modifying the data of <FS_REF_DATA>.
My problem would be solved if I can create dynamically an internal table that has an exact structure copy of the passed parameter.
Regards
Daniel -
Hi,
I'm adding a dynamically created iFrame tag to my main page using javascript to function as a popup page instead of faces-config navigation rules. It dramatically furthers data/page load rendering performance. However, I've got a problem with values I want to pass to my main page since there's no dialog:popup or ReturnListener facility.
I'm using Jdev 10g.
Here is the javascript code to fire the iframe in my page:
<script language="JavaScript">
function newwindow(address) {
var w= screen.width;
var h = screen.height;
var load = window.open(address,'','scrollbars=yes,menubar=no,height='+h+',width='+w+',left=0,top=0,screenX=0,screenY=0,resizable=yes,toolbar=no,location=no,status=yes');
function openPopup (popUpUrl,popUpTitle,popUpWith,popUpHeight){
document.getElementById("mainModalPopBg").style.display = "block";
document.getElementById("mainModalPopBox").style.display = "block";
var neww= screen.width;
var newh = screen.height;
var boxw= popUpWith;
var boxh = popUpHeight;
var boxleft = (neww-boxw)/2;
var boxtop = (newh-boxh)/2;
document.getElementById("mainModalPopBox").style.left = boxleft+"px";
document.getElementById("mainModalPopBox").style.top = 60+"px";
document.getElementById("modalPopBoxFrameContainer").innerHTML = "<iframe allowTransparency='true' id='popUpFrame' frameborder='0' src='" + popUpUrl + " '> </iframe>";
document.getElementById("popupTitle").innerHTML = popUpTitle;
document.getElementById("popUpFrame").style.width = boxw+"px";
document.getElementById("popUpFrame").style.width = popUpWith+"px";
document.getElementById("popUpFrame").style.height = popUpHeight+"px";
document.body.style.overflow = "hidden";
function closePopUp (){
document.getElementById("mainModalPopBg").style.display = "none";
document.getElementById("mainModalPopBox").style.display = "none";
document.body.style.overflow = "auto";
</script>
Finally, the function openPopup is added to 'Onmousedown' javascript event of a commandlink in my main page.
I would be thankful if you guys could help me out with some handy solutions in my case.Hi,
Thanks for the reply. I suppose I'll encounter a problem accessing data in the popup page which is a row of a table. Could you clarify how I should reference Attribute Values/SelectedRowsData in the destination page with opener reference?
I'm embedding a html Iframe tag in the main page when clicking on a commandLink. It adds a <div> tag containing an iFrame which fires a .jspx page that renders a viewObject's data as a readOnly table. I merely need to return some attribute values of the corresponding viewObject or SelectedRows of the table. I cannot use traditional returnListener method of my commandLink since the page is opened with javascript using an iframe tag.
Great thankfully
Maybe you are looking for
-
My HP C6200 will not print, window not capatible, never before,last 4 days
I had a box come and say this version of firefox won't work with my HP C6200 printer. Last 4 days or so and was never like this before. Any fixes? Have I inadvertently caused myself a problem. I updated firefox and will try to update HP, my impressio
-
I own Logic Pro 7( I used to have a PowerPC and need to upgrade to Logic Pro 9 (new Intel chip, system 10.8) . Do I need to buy a whole new set or do I upgrade for less cost?
-
Fully updated DPM 2k12 R2. Have some protection groups with total of 11 servers in it (mainly w2k12 r2 servers and w2k8 r2 servers). After update rollup 3 try to update agents on protected servers. All agents excluding one were updated. Update can't
-
Dear Experts , can anyone please tell me the setp by step configuration for printing material document for 1. GI ( all kinds as in 201 , 261 , 551, 543 ) 2. GR( all kinds as in 101 , 501) 3. Transfer Posting ( 541, 311 , 301 ) Pls tell me wat are the
-
Attach employee photo to KMContent
We would like to attach employee photo to KMContent for storage via ESS/MSS or R3. Is there any document on how to do it ? Thanks. Edward Tso