Generic attributes with NavigationMenuItem class
hi,
Im building a dynamic navigation using a List<NavigationMenuItem>.
The menu is generated from a database.
I add a ActioListener to the NavigationMenuItem which resolves its value, depending on it the next page is displayed.
But id rather save the primary keys corresponding to the values into the NavigationMenuItems.
Is there a way i can add generic attributes dynamically to a NavigationMenuItem object?
Or do i have to extend NavigationMenuItem and a new property (i that possible at all?)
besides id like some general iformation about generic attributes, i cant find much.
thx in advance!
no pointers? :(
Similar Messages
-
Binding ABAP Class Attribute with BUS2038 in a Standard WF task
Hi,
I need help as mentioned in the subject line.
In my standard task I am capturing event for BUS2038. In the General tab I have a ABAP class which has implemented IF_WORKFLOW. From BUS2038 I just need notification number.
Since my source is a BO and my target is a class. How do I make this conversion and pass the data to my class?
I know there are several solution but none have solved my concern.
Thanks,
Sridhar Karra.Hi,
If you want to access teh attributes of the BOR inside a class emthod then you have to make use of teh MACROS.
1. include INCLUDE CNTN01_SWC in the class local macros section. and in the type groupsof the class include SWC0.
2. Now if you know the key of the BOR instance then create a BOR object inside the class method as below
DATA lo_object TYPE SWC0_OBJECT.
SWC0_CREATE_OBJECT lo_object '<BUSXXXX>' '<Key of the BOR>.
the above line will create the instance of the bor inside the class method
now inorder to access the attributes of the BOR use the below code
DATA lv_notif_no TYPE <type of the notification>.
SWC0_GET_PROPERTY lo_object '<ATTRIBUTE NAME> lv_notif
In this way you can access the BOR attributes inside a class method.
Regards
Pavan
Edited by: Pavan Bhamidipati on Dec 15, 2011 11:01 PM -
Hi,
I'm trying to register an MXBean (using Java 1.6) that has a get attribute that returns a generic class with the type specified in the interface. I get a non-compliant mbean exception thrown indicating that the method in question returns a type that cannot be translated into an open type.
Here is some code that illustrates what I am trying to do:
public static class GenericValue<E>
private final E val;
GenericValue(E val) {
this.val = val;
public E getVal() {
return val;
public interface GenericHolderMXBean {
public GenericValue<Float> getVal();
public static class GenericHolder
implements GenericHolderMXBean {
@Override
public GenericValue<Float> getVal() {
return new GenericValue<Float>(1.0f);
TestMbeanStuff.GenericHolder genericHolder = new GenericHolder();
MBeanServer m = ManagementFactory.getPlatformMBeanServer();
ObjectName name = new ObjectName("com.test:type=GenericHolder");
m.registerMBean( genericHolder, name )Is there a way to make this work? It seems analogous to List working as an attribute in an MXBean, but perhaps support for collections is a special case made by JMX and it is not possible to use one's own generic types?
Thanks,
RyanThanks for your response Éamonn,
I do have a bit of a follow-up question. My original question was a simplification of what I would like to do. What I'm really after is having my MXBean interface return a type that has a generic type nested as an attribute. eg:
public static class GenericHolder {
public GenericValue<Float> getVal() {
return new GenericValue<Float>(1.0f);
public interface NestedGenericHolderMXBean {
public GenericHolder getVal();
public static class NestedGenericHolder
implements NestedGenericHolderMXBean {
public GenericHolder getVal() {
return new GenericHolder();
}I would still like to make this work and can see a way to make it work. But, there are a couple of ugly things about my solution. I can probably live with them, but would like to verify that they're unavoidable before I do.
NestedGenericHolder, as above, cannot be registered any more than my original example (for the same reason). My first thought is to make GenericHolder implement CompositeDataView and define how it should be converted to CompositeData. The modified GenericHolder looks something like:
public static class GenericHolder implements CompositeDataView {
public GenericValue<Float> getGenericVal() {
return new GenericValue<Float>(1.0f);
@Override
public CompositeData toCompositeData(CompositeType ct) {
try {
List<String> itemNames = new ArrayList<String>();
List<String> itemDescriptions = new ArrayList<String>();
List<OpenType<?>> itemTypes = new ArrayList<OpenType<?>>();
itemNames.add("genericVal");
itemTypes.add(SimpleType.FLOAT);
itemDescriptions.add("generic value");
CompositeType xct =
new CompositeType(
ct.getTypeName(),
ct.getDescription(),
itemNames.toArray(new String[0]),
itemDescriptions.toArray(new String[0]),
itemTypes.toArray(new OpenType<?>[0]));
CompositeData cd = new CompositeDataSupport(
xct,
new String[] { "genericVal" },
new Object[] {
getGenericVal().getVal()
assert ct.isValue(cd); // check we've done it right
return cd;
} catch (Exception e) {
throw new RuntimeException(e);
}This doesn't help anything though because introspection still seems to inspect this class' attributes. ie: Even though I've manually defined how to convert to CompositeData, it still seems to want to verify that it could do it automatically if it had to. Anyway, my next fix, is to change the name of the "getGenericValue" method to "genericValue" so that JMX doesn't expect that "genericVal" should be an attribute of my type. (And then I will add it to the CompositeData as an extra item - as described in the CompositeDataView JavaDoc).
Registration now because (I believe) JMX refuses to convert an object to a CompositeData that contains no attributes. As a result, I attempt to fix this by adding another getter to my class:
public static class GenericHolder implements CompositeDataView {
// MXBean introspection rejects classes with no attributes.
public Integer getOtherVal() {
return 17;
public GenericValue<Float> genericVal() {
return new GenericValue<Float>(1.0f);
@Override
public CompositeData toCompositeData(CompositeType ct) {
try {
List<String> itemNames = new ArrayList<String>(ct.keySet());
List<String> itemDescriptions = new ArrayList<String>();
List<OpenType<?>> itemTypes = new ArrayList<OpenType<?>>();
for (String item : itemNames) {
itemDescriptions.add(ct.getDescription(item));
itemTypes.add(ct.getType(item));
itemNames.add("genericVal");
itemTypes.add(SimpleType.FLOAT);
itemDescriptions.add("generic value");
CompositeType xct =
new CompositeType(
ct.getTypeName(),
ct.getDescription(),
itemNames.toArray(new String[0]),
itemDescriptions.toArray(new String[0]),
itemTypes.toArray(new OpenType<?>[0]));
CompositeData cd = new CompositeDataSupport(
xct,
new String[] { "otherVal", "genericVal" },
new Object[] {
getOtherVal(),
genericVal().getVal()
assert ct.isValue(cd); // check we've done it right
return cd;
} catch (Exception e) {
throw new RuntimeException(e);
}It now works, but not without a few compromises:
1. I have to implement toCompositeData(). This one isn't too big of a problem. I can certainly live with this.
2. I have to avoid method names that JMX will interpret as attributes when the return type are ones that it doesn't know how to convert to an OpenType. (I then add them into my MXBean, by adding them into the CompositeDataView I build.)
3. Such classes (GenericHolder) must contain at least one attribute with a type that can automatically be converted to an Open type.
I'd just like to make sure there aren't better solutions to the problems I described above.
Thanks and sorry for the overly long post,
Ryan -
Page Attributes and Application Class Attributes
Hi, everyone,
I am quite new to BSP.
I have a question here:
what is the difference between page attributes and application class attributes of a bsp application? As they are both global attributes, there seems to be no big difference when we use them.
thanks a lot.
FanHi Fan,
a BSP application can be made up of many pages.
A page attribute is visible only in the page it is associated with.
Attributes of the application class are visible from every page in that application.
Cheers
Graham Robbo -
I have all these errors, can anyone help with this all means? trying to get my book published in iBooks. Nedd your help. Thanks, Jo
ERROR ITMS-9000: "index_split_000.html(257): attribute "name" not allowed here; expected attribute "accesskey", "charset", "class", "coords", "dir", "href", "hreflang", "id", "rel", "rev", "shape", "style", "tabindex", "target", "title", "type" or "xml:lang"" at Book (MZItmspBookPackage)
Use of the block quote element can cause ePubecheck to give the error "text not allowed here". Text must not be alone inside of a body tag and if it is not enclosed in some other block level tag, this may lead to the error you are receiving.I have all these errors, can anyone help with this all means? trying to get my book published in iBooks. Nedd your help. Thanks, Jo
ERROR ITMS-9000: "index_split_000.html(257): attribute "name" not allowed here; expected attribute "accesskey", "charset", "class", "coords", "dir", "href", "hreflang", "id", "rel", "rev", "shape", "style", "tabindex", "target", "title", "type" or "xml:lang"" at Book (MZItmspBookPackage)
Use of the block quote element can cause ePubecheck to give the error "text not allowed here". Text must not be alone inside of a body tag and if it is not enclosed in some other block level tag, this may lead to the error you are receiving. -
ABAP Objects with Workflows / Classes and Instances
Hello,
I am currently designing a workflow using an ABAP-Objects. So far I have been been able to get my Workflow to run with my class, but I have a couple of problems:
- I am using the Function 'SAP_WAPI_START_WORKFLOW' to start other subflows, which enables me to decide which subflow to start at runtime. All of the subflows have standart importing-parameters in their containers, such as the key of my class. In each workflow I instantiate my class using a self-written method, which checks the table T_INSTANCES in my object, and then either returns the object reference to an existing instance or creates a new one. Obviously all of the subflows that I call from my main workflow should be able to find the instance. As far as I can see in their protocolls, this happens without any problems. The problem starts when I make changes to the instance. For example the changing of attributes (with setter methods) seems not to work. After the subflows are finished, in my main workflow, I do not see (with getter methods) any changes that has been made to the object. Is local persistence really limited to one workflow ?
- My second problem is basically about the workflow container in workflow protocoll. In the same workflow, I can change the attributes of my object. Nevertheless, the protocoll always show the initial attribute, even though, my task with the getter-method returns the new value of the attribute.
I appreciate any help and thanks a lot in advance.Hello Pauls,
Thank you for your answer. I think we are misunderstanding each other. The problem occurs (I think) because my class is not a singleton class. Or am I mistaken ?
When I directly start a subflow from my main workflow, then the instance that I have created in my main workflow is also visible to the subflow. As well as the static table which actually keeps track of the instances. So, in this case the subflows finds the instance and then can use the object as is.
When I start a subflow from my main workflow using the function I mentioned above, then even though the same object key is used, there is a new instance. And the static table (I assume that you mean a static variable from type table, when you say "class table") is completely empty. In this case, my "new" instance is created which overwrites every attribute that I have set in the main workflow, before I started the subflow. More interestingly, my main workflow instantiates another new object, as soon as the subflow has finished. (I am using an event to wait for the subflow to finish.)
On the other hand, I am not quite sure that I understood your approach with refresh and how it could help me. This method is not well documented anywhere, and all of the examples that I have found are about "leave it empty"
As far as I understood, this method is called by the workflow between the steps, when an object is used. I slowly start to think that I need advanced information about Workflows and Memory Management.
Thanks a lot again. Apparently, I am the only person who came across such a problem
Greetz
G.Fendoglu -
Problem creating in some attribute options for class through java API
Hello everyone,
I am successfully creating class and its attributes but i am not able to create attributes with its option like IS REQUIRED, IS INDEXED, IS SETTABLE and READ ONLY.....
public void create_class(String cname,String cdesc,String scname)
try
ClassObjectDefinition cod = new ClassObjectDefinition(csession);
cod.setSuperclassName(scname);
cod.setName(cname);
ClassObject co = (ClassObject)csession.createSchemaObject(cod);
AttributeDefinition ad2 = new AttributeDefinition(csession);
ad2.setAttributeByUpperCaseName("NAME",AttributeValue.newAttributeValue("Divya"));
ad2.setAttributeByUpperCaseName("DATATYPE",AttributeValue.newAttributeValue(Attribute.ATTRIBUTEDATATYPE_STRING));
ad2.setAttributeByUpperCaseName("DATALENGTH",AttributeValue.newAttributeValue(151));
ad2.setAttributeByUpperCaseName("DESCRIPTION",AttributeValue.newAttributeValue("This the attribute number 2"));
//here is some problem,,, Is Required is not been able to set
//ad2.setAttributeByUpperCaseName("REQUIRED",AttributeValue.newAttributeValue(true));
co.addAttribute(ad2);
catch(IfsException e)
e.printStackTrace();
}Hi Kabilesh,
Could you please let me know the exast soution u had for this?
I even set the SHLIB_PATH in the environment, but still this problem persists.
I am compiling the program and making into a shared library as
cc -c -g -n +z -I$JAVA_HOME/include -I$JAVA_HOME/include/hp-ux -L/opt/java1.4/jre/lib/PA_RISC2.0/server -ljvm Test.c -o Test.o
ld -b Test.o -L/opt/java1.4/jre/lib/PA_RISC2.0/server -ljvm -o Test.slMy java code is looks like this :
void create_Jvm()
JNIEnv * env;
JavaVM * jvm;
//JDK1_1InitArgs vm_args;
/* Note : In JNI1.2 and Java2 SDK 1.4, the new structure JavaVMInitArgs has been introduced.*/
JavaVMInitArgs vm_args;
//JavaVMOption options[1];
jint res;
vm_args.nOptions = 0;
vm_args.ignoreUnrecognized = JNI_TRUE;
/* IMPORTANT: specify vm_args version # if you use JDK1.1.2 and beyond */
vm_args.version = JNI_VERSION_1_4;
//vm_args.version = JNI_VERSION_1_2;
/*In JNI1.2 and Java2 SDK 1.4 the JNI_GetDefaultJavaVMInitArgs method call is not required.*/
//JNI_GetDefaultJavaVMInitArgs( & vm_args);
res = JNI_CreateJavaVM( &jvm, (void**)&env, &vm_args);
if (res < 0) {
fprintf(stderr, "Can't create Java VM\n Error is :%ld\n ", res);
exit(1);
iJvmInitialized = 1;
} hi
Check the lib path
May be u have not included : at the end of the lib
path that u have added
THis was the mistake that i did
kabilesh -
Problem with loading classes!!!
I am loading classes using
// Open File
InputStream jarFile = new BufferedInputStream(new FileInputStream(
pluginPath));
// Get Manifest and properties
Attributes attrs = new JarInputStream(jarFile).getManifest().
getMainAttributes();
jarFile.close();
// Read Main Class
String mainClass = attrs.getValue("Protocol-Class");
// Load all classes from jar file without giving classpath
URL url = new URL("jar:file:" + pluginPath + "!/");
JarURLConnection jarConnection = (JarURLConnection) url.openConnection();
URL[] urls = new URL[] {
url};
ClassLoader classLoader = new URLClassLoader(urls);
// Create new instance of protocol
Protocol protocol = (Protocol) classLoader.loadClass(mainClass).
newInstance();
I am loading classes one by one say a order A, B, C. In my case class c extends class A. So I am loading class A first and later B and finally C. But I am getting exceptions when loading class C that Class A is unknown.The following exception is thrown
java.lang.NoClassDefFoundError: com/a/A at java.lang.ClassLoader.defineClass0(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
Please give me a solution to make it run.You create a new class loader for each class. The class loaders are independent, and so the class hierarchies they load are independent. Class A loader by classLoaderOne doesn't see class B loader by classLoaderTwo - they are loaded into their own sandboxes.
Either load everything with one class loader or create the class loaders in a hierarchy. To create a hierarchy use the class loader constructor that takes a parent class loader as a parameter. One class loader may be easier because then you don't need to worry about loading order. -
Accessing the attributes of a class using field symbols?
An option to pulll a variable into a user exit that otherwise would be out of reach is detailed [here|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/208811b0-00b2-2910-c5ac-dd2c7c50c8e8]
Can a similar approach involving field symbols or otherwise, be used to pull in the attributes of a class into the exit? For now, I'm trying to access the A_FRONTEND_INDEX attribute of the class CL_HRXSS_REM.
any ideas?
~SureshHi,
Have you already tried (PROGRAM)(OBJECT)->A_FRONTEND_INDEX in your code? I prepared small testing scenario with two programs and it works.
REPORT zmv_test1.
FORM test.
FIELD-SYMBOLS: <fs> TYPE ANY.
ASSIGN '(ZMV_TEST2)zip->crc32_map' TO <fs>.
IF sy-subrc EQ 0.
<fs> = 'Test'.
ENDIF.
ENDFORM. "test
REPORT zmv_test2.
DATA: zip TYPE REF TO cl_abap_zip.
START-OF-SELECTION.
CREATE OBJECT zip.
PERFORM test IN PROGRAM zmv_test1.
Cheers, -
Using reflection api to copy like named attributes of a class
Hi guys,
I have been hearing about this for a long time now. How can one copy like named attributes from one class to another using the reflection api??
Can anyone provide a small example, with code??
Thanks.maxim.veksler wrote:
I think that a chronological order of events should describe what happened :
Issue #1 10:55 15/09/2008 - I try to find a solution to retrieving annotations of a field http://forums.sun.com/thread.jspa?threadID=5331440
Issue #211:13 15/09/2008 - I learn that this can be done using the Field class, so I got looking for a way to getting all the fields http://forums.sun.com/thread.jspa?threadID=5331441
Issue #3 13:15 15/09/2008 - I find a solution which is nearly working and post the last issue I have. http://forums.sun.com/thread.jspa?threadID=5331475
Issue #313:26 15/09/2008 - thomas.behr helps me with the issue mentioned from thread 5331475 http://forums.sun.com/thread.jspa?messageID=10424090#10424090
Issue #2 14:32 15/09/2008 - You (kajbj) comment that I need to use suggested solution. Please note that when I posted this I didn't know about the "right" solution.
Issue #2 15:01 15/09/2008 - I thank you and link to an example where I implemented the search. I still don't know if the solution I found was the correct one.
Please understand that I had no intention to create unnecessary hassle.kaj post above came at 11:32 (according to the time display here), and your post, in the other thread, acknowledging that you now had a solution was at 10:37. So how did you "not know" at that time, that you had a solution.
But nevermind, dead conversation anyway, the post would not have been made under any other circumstances than the present (if then) anyway, and we both know it.
Edit: And I didn't say you had any intention of purposely wasting people's time, but I don't believe that you had any intentions of not doing so, either (i.e. as in trying to prevent it). -
Problems with inner classes in JasminXT
I hava problems with inner classes in JasminXT.
I wrote:
;This is outer class
.source Outer.j
.class Outer
.super SomeSuperClass
.method public createrInnerClass()V
.limit stack 10
.limit locals 10
;create a Inner object
new Outer$Inner
dup
invokenonvirtual Outer$Inner/<init>(LOuter;)V
;test function must print a Outer class name
invokevirtual Outer$Inner/testFunction ()V
.end method
;This is inner class
.source Outer$Inner.j
.class Outer$Inner
.super java/lang/Object
.field final this$0 LOuter;
;contructor
.method pubilc <init>(LOuter;)V
.limit stack 10
.limit locals 10
aload_0
invokenonvirtual Object/<init>()V
aload_0
aload_1
putfield Inner$Outer/this$0 LOuter;
return
.end method
;test
.method public testFunction ()V
.limit stack 10
.limit locals 10
;get out object
getstatic java/io/PrintStream/out java/io/PrintStream;
aload_0
invokevirtual java/lang/Object/getClass()java/lang/Class;
;now in stack Outer$Inner class
invokevirtual java/Class/getDeclaringClass()java/lang/Class;
;but now in stack null
invokevirtual java/io/PrintStream/print (Ljava/lang/Object;)V
.end methodI used dejasmin. Code was equal.
What I have to do? Why getDeclatingClass () returns null, but in dejasmin code
it returns Outer class?Outer$Inner naming convention is not used by JVM to get declaring class.
You need to have proper InnerClasses attribute (refer to http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#79996)
in the generated classes. Did you check using jclasslib or another class file viewer and verified that your .class files have proper InnerClasses attribute? -
Generic counter with leading zeros
Good evening everybody,
I was searching the code of a generic counter with leading zeros, but I did not found anything over the Internet. Therefore, I code it all by myself.
I give you the code, it will maybe helps someone.
Only needed leading zeros are generated, which means the following sequences :
0 - 1 - 2 - ... - 7 for a max of 7,or
00 - 01 - 02 - ... - 23 - 24 - ... - 89 for a max of 89, or
000 - 001 - 002 - ... - 432 for a max of 432.
public class LeadingZerosCounter {
public String[] counters = null;
public LeadingZerosCounter(int maximum) {
this.counters = new String[maximum];
public String[] init() {
int maxLeadingZeros = 1;
int index0 = this.counters.length;
while ((index0 /= 10) >= 10) {
maxLeadingZeros += 1;
int counter = 0;
for (int index1 = 0; index1 < maxLeadingZeros + 1; index1++) {
while (counter < java.lang.Math.pow(10, index1 + 1)) {
String stringCounter = new String("");
for(int index2 = 0; index2 < (maxLeadingZeros - index1); index2++) {
stringCounter = stringCounter.concat("0");
stringCounter = stringCounter.concat(new Integer(counter).toString());
this.counters[counter] = stringCounter;
System.out.println(this.counters[counter]);
if (++counter == this.counters.length) {
return(this.counters);
else {
// no action
return(this.counters);
public static void main(String[] args) {
new LeadingZerosCounter(100).init();
NOTE : the two return are mandatory.
Try maximum raised to a power of 10 and maximum raised to a power of 10 + constant in [1; 9] to understand.
If you find any solution to make it faster, please let me know.
Have a nice day,
ChristopheI like Jos' idea better than mine (go figure - he's a better Javanista)....
public class Counter {
private String pattern;
private int count;
private int max;
public Counter(int max) throws IllegalArgumentException {
if (max < 0) {
throw new IllegalArgumentException("Max (" + max + ") must be a positive number");
this.max = max;
int len = String.valueOf(max).length();
this.pattern = "%1$0" + len + "d";
public boolean hasNext() {
return count <= max;
public String next() {
String result = String.format(pattern, count);
count++;
return result;
public static void main(String[] args) {
// for demo purposes only;
// replace with command-line arg parsing, if desired...
String prefix = "picture_";
String suffix = ".jpg";
Counter c = new Counter(99);
while (c.hasNext()) {
System.out.println(prefix + c.next() + suffix);
try {
new Counter(-1);
} catch (IllegalArgumentException e) {
System.out.println("test: " + e.getMessage());
} -
Nested-Generic Type with the same parameter as enclosing type?
Greetings. I want to write a nested generic type with the same type parameter as the enclosing type. For example, consider:
public interface BinaryTree<Type> {
Node<Type> getRoot();
interface Node<Type> {
Type getValue();
void setValue(Type value);
Node<Type> getLeft();
void setLeft(Node<Type> node);
Node<Type> getRight();
void setRight(Node<Type> node);
}In this example, I want Node to be specified to the same type as the binary tree's parameter specification. Does anyone know how to do that? I have tried several methods and am at a loss.
TIAIs there any way to declare that? Essentially I want
the nested type to parameterize the enclosing type.I understand that but I don't think it's possible because of how java generics works.
This ,
SomeClass< SomeNestedClass<Type> >is wrong because you're supposed to give a formal type parameter within <> not an already defined type (like SomeNestedClass).
If you instead do
public class SomeClass<Type > {
public static class SomeNestedClass<Type> {
}To think of the two Type as the same formal type parameter is semantically incorrect. Both the outer type and the inner type must be able to participate in variable declarations "on their own". Say you do
SomeClass<Integer> sc;Just because you did the above in which context is now SomeNestedClass supposed to be bound as SomeNestedClass<Integer>? To me this shows that SomeClass and SomeNestedClass cannot share the same formal type parameter. -
Generic Datasource with Delta and functionmodule
Hi together,
who can help me ??
Ihave created a generic datasource with function module and
delta.
the extractor runs well while i use full update and also initialization.
If i start the delta extraction, the extractor crashed with short-dump.
the message is SAPSQL_INVALID_FIELDNAME
What can i do, and what is wrong.
regards
thorsten WeissHi Roberto,
here is the code from the function-module:
FUNCTION zbw_mm_get_eket.
""Lokale Schnittstelle:
*" IMPORTING
*" VALUE(I_REQUNR) TYPE SBIWA_S_INTERFACE-REQUNR
*" VALUE(I_DSOURCE) TYPE SBIWA_S_INTERFACE-ISOURCE OPTIONAL
*" VALUE(I_MAXSIZE) TYPE SBIWA_S_INTERFACE-MAXSIZE DEFAULT 1000
*" VALUE(I_INITFLAG) TYPE SBIWA_S_INTERFACE-INITFLAG OPTIONAL
*" VALUE(I_READ_ONLY) TYPE SBIW_BOOL DEFAULT SBIW_C_FALSE
*" TABLES
*" I_T_SELECT TYPE SBIWA_T_SELECT OPTIONAL
*" I_T_FIELDS TYPE SBIWA_T_FIELDS OPTIONAL
*" E_T_DATA OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
INCLUDE lrsalk01.
DataSource for table EKET
TABLES: zv_mm_eket.
interne Tabelle für Bearbeitung
DATA: itab_0 TYPE TABLE OF zstr_eket WITH HEADER LINE.
TYPES: BEGIN OF typ_categ,
j_4kbwef TYPE atnam,
/afs/bwel TYPE j_4kbwef,
END OF typ_categ.
DATA: l_s_data_eket TYPE zstr_eket,
ld_cat_struct TYPE j_4kcsgr,
lt_cat_fields TYPE TABLE OF j_4kcif001,
ls_cat_fields TYPE j_4kcif001,
ls_mara TYPE mara,
l_tabix LIKE sy-tabix,
itab_cat TYPE TABLE OF typ_categ ,
ls_cat TYPE typ_categ,
h_feldsize1(8) TYPE c,"wegen Typ-konflikt im FB
h_feldsize2(8) TYPE c."wegen Typ-konflikt im FB
Auxiliary Selection criteria structure
DATA: l_s_select TYPE rsselect.
Maximum number of lines for DB table
STATICS: s_t_select LIKE rsselect OCCURS 0 WITH HEADER LINE,
s_t_fields LIKE rsfieldsel OCCURS 0 WITH HEADER LINE,
counter
s_counter_datapakid LIKE sy-tabix,
cursor
s_cursor TYPE cursor.
Select ranges
RANGES: l_r_ebeln FOR zv_mm_eket-ebeln,
l_r_ebelp FOR zv_mm_eket-ebelp,
l_r_bsart FOR zv_mm_eket-bsart.
Initialization mode (first call by SAPI) or data transfer mode
(following calls) ?
IF i_initflag = sbiwa_c_flag_on.
Initialization: check input parameters
buffer input parameters
prepare data selection
Check DataSource validity
CASE i_dsource.
WHEN 'ZDS_V_MM_EKET'.
WHEN OTHERS.
IF 1 = 2. MESSAGE e009(r3). ENDIF.
this is a typical log call. Please write every error message like this
log_write 'E' "message type
'R3' "message class
'009' "message number
i_dsource "message variable 1
' function modul was created for DS ' &
'ZDS_V_MM_EKET"!'.
"message variable 2
RAISE error_passed_to_mess_handler.
ENDCASE.
APPEND LINES OF i_t_select TO s_t_select.
Fill parameter buffer for data extraction calls
S_T_SELECT-REQUNR = I_REQUNR.
S_T_SELECT-DSOURCE = I_DSOURCE.
S_T_SELECT-MAXSIZE = I_MAXSIZE.
Fill field list table for an optimized select statement
(in case that there is no 1:1 relation between InfoSource fields
and database table fields this may be far from beeing trivial)
APPEND LINES OF i_t_fields TO s_t_fields.
ELSE. "Initialization mode or data extraction ?
Data transfer: First Call OPEN CURSOR + FETCH
Following Calls FETCH only
First data package -> OPEN CURSOR
IF s_counter_datapakid = 0.
Fill range tables BW will only pass down simple selection criteria
of the type SIGN = 'I' and OPTION = 'EQ' or OPTION = 'BT'.
LOOP AT s_t_select INTO l_s_select WHERE fieldnm = 'EBELN'.
MOVE-CORRESPONDING l_s_select TO l_r_ebeln.
APPEND l_r_ebeln.
ENDLOOP.
LOOP AT s_t_select INTO l_s_select WHERE fieldnm = 'EBELP'.
MOVE-CORRESPONDING l_s_select TO l_r_ebelp.
APPEND l_r_ebelp.
ENDLOOP.
LOOP AT s_t_select INTO l_s_select WHERE fieldnm = 'BSART'.
MOVE-CORRESPONDING l_s_select TO l_r_bsart.
APPEND l_r_bsart.
ENDLOOP.
Determine number of database records to be read per FETCH statement
from input parameter I_MAXSIZE. If there is a one to one relation
between DataSource table lines and database entries, this is trivial.
In other cases, it may be impossible and some estimated value has to
be determined.
OPEN CURSOR WITH HOLD s_cursor FOR
SELECT (s_t_fields) FROM zv_mm_eket
WHERE
ebeln IN l_r_ebeln AND
ebelp IN l_r_ebelp AND
bsart IN l_r_bsart.
ENDIF. "First data package ?
Fetch records into interface table.
named E_T_'Name of extract structure'.
FETCH NEXT CURSOR s_cursor
APPENDING CORRESPONDING FIELDS
OF TABLE e_t_data
PACKAGE SIZE i_maxsize.
FETCH NEXT CURSOR s_cursor
APPENDING CORRESPONDING FIELDS
OF TABLE itab_0
PACKAGE SIZE i_maxsize.
LOOP AT itab_0 INTO l_s_data_eket.
l_tabix = sy-tabix.
Lesen Erstellungsdatum aus EKKO
SELECT SINGLE aedat FROM ekko INTO l_s_data_eket-sydat
WHERE ebeln = l_s_data_eket-ebeln.
Lesen Partner aus EKPA
SELECT SINGLE lifn2 FROM ekpa INTO l_s_data_eket-plief
WHERE ebeln = l_s_data_eket-ebeln AND
ebelp = l_s_data_eket-ebelp AND
ekorg = l_s_data_eket-ekorg AND
werks = l_s_data_eket-werks .
IF NOT l_s_data_eket-matnr IS INITIAL .
*A Lesen material für Kategoriestruktur j_4kcsgr(F001 oder R002)
CLEAR ls_mara.
CALL FUNCTION 'J_3A1_LESEN_MARA_SINGLE'
EXPORTING
i_matnr = l_s_data_eket-matnr
IMPORTING
e_mara = ls_mara
EXCEPTIONS
param_not_valid = 1
OTHERS = 2.
IF sy-subrc NE 0.
ENDIF.
*E Lesen material für Kategoriestruktur j_4kcsgr(F001 oder R002)
*A Aufsplitten Bestandskategorie
REFRESH lt_cat_fields.
CALL FUNCTION 'J_4KG_SPLIT_CAT'
EXPORTING
client = sy-mandt
csgr = ls_mara-j_4kcsgr
cat_appl = 'S'
cat_value = l_s_data_eket-j_4kscat
NECESSARY_SPECIFIED = ' '
TABLES
cat_fields_tab = lt_cat_fields
EXCEPTIONS
no_category_structure_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE."sy-subrc <> 0
Verarbeitung der Ergebnisse
LOOP AT lt_cat_fields INTO ls_cat_fields.
IF ls_cat_fields-j_4kbwef EQ 'BW_CAT_SCONFIG'.
l_s_data_eket-zz_bwel_sconfig = ls_cat_fields-j_4kcatv.
ENDIF.
IF ls_cat_fields-j_4kbwef EQ 'BW_CAT_CONFIG'.
l_s_data_eket-zz_bwel_config = ls_cat_fields-j_4kcatv.
ENDIF.
IF ls_cat_fields-j_4kbwef EQ 'BW_CAT_COUNTRY'.
l_s_data_eket-j_3abwel_country = ls_cat_fields-j_4kcatv.
ENDIF.
IF ls_cat_fields-j_4kbwef EQ 'BW_CAT_COUNTRYGRP'.
l_s_data_eket-zz_bwel_coungrp = ls_cat_fields-j_4kcatv.
ENDIF.
IF ls_cat_fields-j_4kbwef EQ 'BW_CAT_STOCKTYPE'.
l_s_data_eket-zz_bwel_stktype = ls_cat_fields-j_4kcatv.
ENDIF.
IF ls_cat_fields-j_4kbwef EQ 'BW_CAT_ORDER'.
l_s_data_eket-zz_bwel_order = ls_cat_fields-j_4kcatv.
ENDIF.
IF ls_cat_fields-j_4kbwef EQ 'BW_CAT_QUALITY'.
l_s_data_eket-j_3abwel_qual = ls_cat_fields-j_4kcatv.
ENDIF.
ENDLOOP."lt_cat_fields
ENDIF.
*E Aufsplitten Bestandskategorie
*A Aufsplitten MAtrix
IF NOT l_s_data_eket-j_3asize IS INITIAL.
CALL FUNCTION 'J_3A_SPLIT_SIZES'
EXPORTING
matnr = l_s_data_eket-matnr
j_3asize = l_s_data_eket-j_3asize
IMPORTING
j_3akord1 = l_s_data_eket-j_3abwel_color
j_3akord2 = h_feldsize1
j_3akord3 = h_feldsize2
EXCEPTIONS
no_grid_determined = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
l_s_data_eket-zz_bwel_size1 = h_feldsize1.
l_s_data_eket-zz_bwel_size2 = h_feldsize2.
ENDIF.
ENDIF."not l_s_data_eket-J_3ASIZE is initial
*E Aufsplitten MAtrix
MODIFY itab_0 FROM l_s_data_eket INDEX l_tabix.
ENDIF."not l_s_data_eket-matnr is initial
ENDLOOP. "itab_0
An Ausgabe-Tabelle übergeben
APPEND LINES OF itab_0 TO e_t_data.
IF sy-subrc <> 0.
CLOSE CURSOR s_cursor.
RAISE no_more_data.
ENDIF.
s_counter_datapakid = s_counter_datapakid + 1.
ENDIF. "Initialization mode or data extraction ?
ENDFUNCTION.
regards
thorsten -
Generic Attribute Access Pattern
Hi all,
I'd like to implement my BMP Beans with the Generic Attribute Access Pattern. So instead of using get/set methods I simply do get/put of the HashMap stored in the EJB.
Now my question is: how to I implement persitance of data on the DB with this pattern ?
Do I have to move the content of ejbStore into the method setAttributes(Map map) ? this way after calling setAttributes data is persited on the DB. But then what should I do with ejbStore? should I leave it empty?
thanks a lot
FrancescoThe setAttributes method should set the attributes of the bean from the hashmap, not do
anything in the database itself. Your ejbStore method will take the attributes of the bean
and put them in the database. This is since you say you are using BMP. If you were using CMP
the case would be different.
Maybe you are looking for
-
Creating logical standby database
Hi all, 10.2.0.1 Following this link http://download.oracle.com/docs/cd/B19306_01/server.102/b14239/create_ls.htm Where do i need to issue these statements: SQL> EXECUTE DBMS_LOGSTDBY.BUILD; SQL> ALTER DATABASE RECOVER TO LOGICAL STANDBY db_name; on
-
BPM: Messages stuck in Queue
Hi All, I am working on BPM scenario. My scenario is I am collecting 100 messages in 10 mins and sending to receiver. Here correlation I used as constant. In my deadline step I am using Transform step and Send why because if my scenario collec
-
I am trying to set up Apple TV in my classroom, but can't put in my network password (which I usually do online?) I have full network strength. Any help out there?
-
Unit Conversion from Different units to TO ( Ton )
Hi all, I am getting the Quantity with different unit of Measures from R/3 Datasource. So my requirment is I have to convert all Units to TO ( TON ). I have searched in the forum and find one function module i.e UNIT_CONVERSION_SIMPLE. But when I am
-
I don't remember my security answer , how to reset
Help