Adding new object to vector in existing session
Hi,
I'm currently developing a website. In it, the user can click a button(name=option,value=item) and an item gets added to a list. At the end, the list is outputted. I am having difficulties though with my session.
My session("Item") holds a collection,basically a vector. Every time the button is pressed, I want to add a new object (Item) to this vector(ItemCollection) but when I do it simply overrides it so the list is only ever outputting one item. Here is the code. I have traced through it with 'System.out.print' and it only gets to 'System.out.println("session");
The getItem(), gets the item from the database and returns a object of type Item.
This may seem like only a basic thing but I just cant see where it is going wrong.
Thanks
else if(option.equals("item")){
System.out.println("ItemPressed");
String itemIdStr=request.getParameter("id");
int itemId=Integer.parseInt(itemIdStr);
ItemCollection list=new ItemCollection();
list=(ItemCollection)session.getAttribute("Item");
Item item=new Item();
Item itS=new Item();
System.out.println("getItem()");
itS=item.getItem(itemId);
System.out.println(itS.getItemName());
System.out.println("session");
list.addItem(itS);
session.setAttribute("Item",list);
System.out.println("addedToSession");
}
else if(option.equals("item")){
System.out.println("ItemPressed");
String itemIdStr=request.getParameter("id");
int itemId=Integer.parseInt(itemIdStr);
ItemCollection list=new ItemCollection();
list=(ItemCollection)session.getAttribute("Item");
Item item=new Item();
Item itS=new Item();
System.out.println("getItem()");
itS=item.getItem(itemId);
System.out.println(itS.getItemName());
System.out.println("session");
list.addItem(itS);
session.setAttribute("Item",list);
System.out.println("addedToSession");
}Maybe it's too early in the morning here, but it looks to me like you have all of your variables declared in your execution path....
... if that is the case, then uh... ya, they are going to be reinitalized each pass and only have at most the last item in them from your work.
Similar Messages
-
in ical I just added new calendars to a pre-existing calendar group, I can make events with these calendars, but not reminders, any suggestions?
Hi,
Lion has changed the way reminders (todos as was) work. They now seem to need to be in a seperate calendar.
In iCal open the File menu and select New Reminder List... and select where to put it.
Best wishes
John M -
Adding New Customer Address to an Existing one
Adding New Customer Address to an Existing one
Hi
We have a lot customers set up in Oracle and they only have a
ship to address and now we would like to add the bill to address
to these customers. Since there are a lot of customers I was
wondering is there is an open interface we can use to that.
Thank you
alphaHi Chandu,
1.In Infospoke -> General tab -> DataSouce(here infobject - 0BPARTNER).
2. Destination tab -> choose radio button(DB Table or Flat file).
3. Goto tab infoobjects -> select required fields you want to send from left to right.
4. Give the selection accordingly(here i think PATRNER). But it should be available in your datasouce(Infoobject-0BPARTNER), if you want to give selection on this. I didnt understad what you mean of <b>"hide"</b> in your previous reply. If this is not available in your infoobject(OBPARTNER), How CAN YOU GIVE SELECTION ON THIS attribute...?
5. Try to add this field in Infoobject(0BPARTNER) and populate.
6. Trnasformation tab.
Here you can see Source Structure, Target Structure and Addin implementation.
Source Structure - system will generate according to the field you selected in InfoObjects tab(You cant change it).
Target Structure - You can define your own structure if you want or you can modify the generated structure. By default system generates Target Structure same as Source structure(if you want to add any more fields you can add here, but you have to populate those fields with your own coding in BAdi), Which is Addin implementation.
Srini
Message was edited by: Srini -
Issues when adding new objects
A few questions regarding changes in Toplink from 2.5 to the current version.
Say I had object A which contains a collection of Bs and a collection of Cs.
Now when I want to save A and Bs and Cs to the database as an insert.
Is the following code correct ?
A a = new A();
A cloneA = (A)uow.registerObject(a);
Vector bCollectionClone = uow.registerAllObjects(new Vector(bCollection));
Vector cCollectionClone = uow.registerAllObjects(new Vector(cCollection));
uow.commit();
This seemed to work in 2.5. According to the API java docs this should work even today.
The reason I am asking is all of these -A, B and C are new objects. Should they be registered with registerNewObject();
Is it incorrect to register a new object with cloning ?I forgot to add a couple of lines of code to that snippet
A a = new A();
A cloneA = (A)uow.registerObject(a);
Vector bCollectionClone = uow.registerAllObjects(new Vector(bCollection));
Vector cCollectionClone = uow.registerAllObjects(new Vector(cCollection));
cloneA.setBCollection(bCollectionClone);
cloneA.setCCollection(cCollectionClone());
uow.commit();
A few questions regarding changes in Toplink from 2.5
to the current version.
Say I had object A which contains a collection of Bs
and a collection of Cs.
Now when I want to save A and Bs and Cs to the
database as an insert.
Is the following code correct ?
A a = new A();
A cloneA = (A)uow.registerObject(a);
Vector bCollectionClone = uow.registerAllObjects(new
Vector(bCollection));
Vector cCollectionClone = uow.registerAllObjects(new
Vector(cCollection));
uow.commit();
This seemed to work in 2.5. According to the API java
docs this should work even today.
The reason I am asking is all of these -A, B and C
are new objects. Should they be registered with
registerNewObject();
Is it incorrect to register a new object with cloning -
Adding new object type (field BKPF-AWKEY) for BAPI posting
Hi everyone,
I am posting to SAP GL using an input file to read the data and transfer it to BKPF and BSEG tables.
The problem is I have to use BAPI_ACC_DOCUMENT_POST, and it expects values for OBJ_KEY and OBJ_TYPE.. For now, OBJ_TYPE creates a problem, because if I use BKPF, it says it cannot post using this object type, as it is for SAP internal use only.
Does anyone know how to add a new object type for the customer namespace, which can be manually used for this kind of posting? I know that the new entry must be made in tables TTYP, TTYPT, and possibly TTYPV, for which the maintainence view exists: V_TTYPV.
How to add an entry here, or where can I find it in customizing?
All helpful answers will be awarded.
Thank you very much
Srdjanperform fill_internal_tables.
if check_l = 'X'.
call function 'BAPI_ACC_DOCUMENT_CHECK'
destination dest
exporting
documentheader = gd_documentheader
customercpd = gd_customercpd
contractheader = gd_fica_hd
tables
accountgl = it_accountgl
accountreceivable = it_accountreceivable
accountpayable = it_accountpayable
accounttax = it_accounttax
currencyamount = it_currencyamount
criteria = it_criteria
valuefield = it_valuefield
extension1 = it_ext
return = it_return
paymentcard = it_paymentcard
contractitem = it_fica_it.
extension2 = it_ext2
realestate = it_re.
write: / 'Result of check lines:'. "#EC NOTEXT
perform show_messages.
endif.
if check_a = 'X'.
call function 'BAPI_ACC_DOCUMENT_CHECK'
destination dest
exporting
documentheader = gd_documentheader
customercpd = gd_customercpd
contractheader = gd_fica_hd
tables
accountgl = it_accountgl
accountreceivable = it_accountreceivable
accountpayable = it_accountpayable
accounttax = it_accounttax
currencyamount = it_currencyamount
criteria = it_criteria
valuefield = it_valuefield
extension1 = it_ext
return = it_return
paymentcard = it_paymentcard
contractitem = it_fica_it.
extension2 = it_ext2
realestate = it_re.
write: / 'Result of check all:'. "#EC NOTEXT
perform show_messages.
endif.
if post = 'X'.
data: l_type like gd_documentheader-obj_type,
l_key like gd_documentheader-obj_key,
l_sys like gd_documentheader-obj_sys.
if dest = space or
dest = gd_documentheader-obj_sys.
post synchron
call function 'BAPI_ACC_DOCUMENT_POST'
exporting
documentheader = gd_documentheader
customercpd = gd_customercpd
contractheader = gd_fica_hd
importing
obj_type = l_type
obj_key = l_key
obj_sys = l_sys
tables
accountgl = it_accountgl
accountreceivable = it_accountreceivable
accountpayable = it_accountpayable
accounttax = it_accounttax
currencyamount = it_currencyamount
criteria = it_criteria
valuefield = it_valuefield
extension1 = it_ext
return = it_return
paymentcard = it_paymentcard
contractitem = it_fica_it.
extension2 = it_ext2
realestate = it_re.
write: / 'Result of post:'. "#EC NOTEXT
perform show_messages.
else.
create Idoc
it_receivers-logsys = dest.
append it_receivers.
call function 'ALE_ACC_DOCUMENT_POST'
exporting
documentheader = gd_documentheader
customercpd = gd_customercpd
contractheader = gd_fica_hd
tables
accountgl = it_accountgl
accountreceivable = it_accountreceivable
accountpayable = it_accountpayable
accounttax = it_accounttax
currencyamount = it_currencyamount
criteria = it_criteria
valuefield = it_valuefield
extension1 = it_ext
paymentcard = it_paymentcard
contractitem = it_fica_it
extension2 = it_ext2
realestate = it_re
receivers = it_receivers
COMMUNICATION_DOCUMENTS =
APPLICATION_OBJECTS =
exceptions
error_creating_idocs = 1
others = 2 .
if sy-subrc = 0.
write: / 'IDoc created'. "#EC NOTEXT
else.
write: sy-msgid.
endif.
endif.
endif.
if rev_p = 'X' or rev_c = 'X'.
data: rev like bapiacrev,
rev_key like ref_key.
rev_key = ref_key.
rev_key(1) = 'R'.
rev-obj_type = gd_documentheader-obj_type.
rev-obj_key = rev_key.
rev-obj_sys = gd_documentheader-obj_sys.
rev-obj_key_r = ref_key.
if rev_c is initial.
if dest = space or
dest = gd_documentheader-obj_sys.
call function 'BAPI_ACC_DOCUMENT_REV_POST'
exporting
reversal = rev
bus_act = gd_documentheader-bus_act
tables
return = it_return.
else.
it_receivers-logsys = dest.
append it_receivers.
call function 'ALE_ACC_DOCUMENT_REV_POST'
exporting
reversal = rev
busact = gd_documentheader-bus_act
OBJ_TYPE = 'BUS6035'
SERIAL_ID = '0'
tables
receivers = it_receivers
COMMUNICATION_DOCUMENTS =
APPLICATION_OBJECTS =
exceptions
error_creating_idocs = 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.
write: / 'IDoc created'. "#EC NOTEXT
endif.
endif.
else.
call function 'BAPI_ACC_DOCUMENT_REV_CHECK'
exporting
reversal = rev
bus_act = gd_documentheader-bus_act
tables
return = it_return.
endif.
write: / 'Result of Reversal Posting:'. "#EC NOTEXT
perform show_messages.
endif.
commit work.
chk this
Give points if useful -
Adding new object to 0FIGL_V10
Hello All,
I installed the standard data flow for Virtual Infocube 0FIGL_V10 and the report was ok (about monthly result). After that I added a new object to the data flow (0AC_LEDGER). But now I don't have the same result in the report.
Do I need to modify the function RS_BCT_FIGL_DATA_GET_VC10?
ThanksHello Chandran,
The new object (0AC_LEDGER) in the Update Rule from Infosource to ODS is direct assignation and overwrite. From ODS to Infocube is the same direct assignation.
Thanks
Jose -
Infosource -adding new objects
I enhanced the datasource 2lis_02_itm with some objects using abap code. I created the objects in BW and replicated the datasource. I added those objects to the info source.
Now , I am not able to assign these objects in the info source, I do not see these objects in the list.
ThanksYes I activated the cube after adding the fields.Here's what I did exactly:
1. Wrote the abap code for 5 key figures and marked them as "selection" in the datasource.
2. Deleted the data source assignment (I had assigned it earlier)
3. replicated the datasource
4. Reassigned the datasource
5. Added the kf's to the comm structure
6. I see them in the transfer structure but unassigned
7. I assigned these objects in the transfer structure manually
8. activated the info source
9. added the kf's to the cube
10. activated the cube
11. I do not see them in the update rules!!!!
Thanks -
hi, i'm wondering if i could have everything all set up(canvas3d,simpleuniverse,etc.) and i wanted to add to add a transformgroup to the BranchGroup, would everything update to show the new transformgroup?
adn is a simepleuniverse like a virtualuniverse?i see on Canvas3d there's an update() meathod, do i use that?No, please don`t.
The scengraph will update if you set the capability
BranchGroup.ALLOW_CHILDREN_EXTEND
before you add a new object
You should update a scengraph from a Behavior. Please see
You should read the javadoc for Behavior
When the Java 3D behavior scheduler invokes a Behavior object's processStimulus method, that method may perform any computation it wishes. Usually, it will change its internal state and specify its new wakeup conditions. Most probably, it will manipulate scene graph elements. However, the behavior code can only change those aspects of a scene graph element permitted by the capabilities associated with that scene graph element. A scene graph's capabilities restrict behavioral manipulation to those manipulations explicitly allowed.
The application must provide the Behavior object with references to those scene graph elements that the Behavior object will manipulate. The application provides those references as arguments to the behavior's constructor when it creates the Behavior object. Alternatively, the Behavior object itself can obtain access to the relevant scene graph elements either when Java 3D invokes its initialize method or each time Java 3D invokes its processStimulus method.
Behavior methods have a very rigid structure. Java 3D assumes that they always run to completion (if needed, they can spawn threads). Each method's basic structure consists of the following:
* Code to decode and extract references from the WakeupCondition enumeration that caused the object's awakening.
* Code to perform the manipulations associated with the WakeupCondition
* Code to establish this behavior's new WakeupCondition
* A path to Exit (so that execution returns to the Java 3D behavior scheduler)
regards -
Hi, all
I want add new new tab as my new object type. which is not available in standard set ie screens class CV130 TC 'SE80'
the new object requirment as per customer
1] Routing
2] Inspection Lot
3] Plan Maintanence
4] Clibration
Give procedure how to customize these new objects, which r not available as std screens for dms object links.
rgds
BenHi Benaka,
In standard SAP system you can link DIR to various other SAP Objects for that, in customization setting choose :
Cross-application component->Document management->Control Data->Maintain Key fields.
Following steps to be followed as per IMG activity documentation(click & follow the step).
Regards,
Seema Pilankar
If it useful reward me the points. -
Adding new airport extreme to an existing airport express network...
i currently have a home airport network comprising two airport express units; one attached to the cable modem in the bedroom and the other downstairs in my study (extending the existing network and feeding a shared USB printer and airtunes speakers). i've recently bought an airport extreme, to improve network performance. i also plan to add a NAS in the next week or so.
ideally i'd like to situate the new airport extreme in the study, as i don't want to have to keep the NAS in my bedroom!
my question is this, if i add the new airport extreme to the existing airport network, will i see the benefit of the 802.11n connection, or should the extreme be set up as the primary base station?... will i see slower transfer speeds (than if it was connected to the extreme) to / from the NAS when accessing it wirelessly from elsewhere in the house?
No. The transfer speed will be limited by the slowest connection, which is almost certainly your wireless connection speed.
If you buy a switch, buy a gigabit switch. Not because a slower one will limit your transfer speed, but because the Extreme is Gigabit and any newer equipment is likely to be as well. The advantage would only be relevant to the wired LAN.
The Express's Ethernet is not Gigabit but there is no reason for it to be, since it cannot connect to anything other than a slower wireless connection anyway. -
SAVE_TEXT problem in adding new text identifier to an existing text object
I have an existing text object "ZEANR" which stores 9 long text data with identifiers 1 to 9. I want to add a new long text to that text object with id 10. when I use SAVE_TEXT function (with same parameters as others except the ID is set to "0010"), it throws an exception saying : "0010" text identifier is not defined for Text object "ZEANR". How can we append more long texts to an existing object ? I Have tried to change the insert parameter of the SAVE_TEXT function but it didn't work with both cases. I am getting the exception at perform chech_key --> perform check_id of the SAVE_TEXT function.
if someone knows the answer I will be preciated. thanks in advance.The text ID specified in the parameter ID or text header (field TDID) should exist in table TTXID. It must be defined there with the text module object.
Go to transaction SE75, select "Text Objects and IDs", Change. Find your text object (ZEANR) in the list and double click. Choose create. Add a new text id (0010) and description. Save. -
Adding new custom field in already existing custom tab for MM01
Hello Guru,
I have a requirement that add a custom field in already existing custom view of MM01. I did the following steps :
1. I have cerated a new field in MARA using APPEND structure.
2. I have found the function group(Y_FE_MARA) that already there other subscreens, so that I have added another subscreen in that function group and created a field from MARA in the screen.
3. in SPRO went for the path Logistics General->Material Master->Configuring the Material->Define Structure of Data screens for Each Screen sequence
In the 3rd step, I have choosen already existing screen sequence(Y1) and went for Data Screens and choosen for Custom tab and double click on subscreens and then I have added the program as SAPLY_FE_MARA and subscreen number(011) and saved it.
After all the above steps, I have run MM02/MM03 then the field is not getting displayed in the screen of custom view.
Did I miss any steps here? Please suggest me if I did something wrong.
Thanks and Regards,
Muralikrishna PeravaliHi Raymond,
Thank you for the reply. As per the note some one already implemented the Screen Enhancement with 2 custom views. I need to add the field in any one of existing custom view. So for this I have created a Subscreen in copied function group of MGD1(Y_FE_MARA). But in the function group already 10 Subscreens were created. Is this is the problem? or else copy the FG MGD1 into another FG and create the subscreen will be feasible to my scenario?
Please suggest me.
Thanks and Regards,
Muralikrishna Peravali -
Adding new Hub Transport server in existing environment
Hi everyone,
Currently we have 5 exchange servers 2010 :
2 CAS Servers (Virtual)
2 MB and Hub Transport servers (Physical)
1 Edge server in DMZ. (Virtual)
Now I have added 2 more servers
with MB and Hub Tranport Roles (VIRTUAL) and want to configure the mail flow from these new transport servers.
Can anyone help with the steps I should follow. Please note we have 1 existing Edge server in 2010 and email flow should be from Hub Transport to Edge server then from Edge to internet.
Existing environment is working fine without any issues. Main reason to do this is to virtualize the physical servers. Mailbox DB already migrated to new servers.
Thanks.
Manish Kumar MCSA, MCITP Enterprise Admin. MCTS Exchange server 2007, MCITP Virtualization Admin.Dear Manish
Please find your answers below
For mail flow to happen through new hub transport I will make the new edge subscription from new HUB server
to Edge server. Is there any other changes I have to do ?
No other changes is required
Create a new edge subscription and then import it and run start endge sync
So when I will do create the new edge subscription then it will delete the old send connectors and will
create the new one?
IT will create old edge sync and create a new edge sync which will not make any impact on your config
Will there be any downtime while doing this activity ?
Better to do this on after production hours since definitely there will be mail delay and may delay more if you try this on production hours
Remember to mark as helpful if you find my contribution useful or as an answer if it does answer your question.That will encourage me - and others - to take time out to help you Check out my latest blog posts on http://exchangequery.com Thanks Sathish (MVP) -
Adding new object names in Incompleteness Procedure
Hi All.
This is with regard to the Incompleteness Procedure.
Our requirement is to make a certain field in the transaction(requested end date) from Service Ticket mandatory. The system should give a warning/error message upon not finding this entry. I used the ICP to set up the fields for other requirements I have like, priority, description etc, for which the incompleteness works just fine.
But to set it for the date i mentioned above, I am not able to find a relevant object type for choosing the field name.
Is there a possibility to add object types to the list which appears upon using F4?
is there a possibility to know the object type/name that a particluar FIELD NAME belongs to from somewhere?
Kindly throw some light.
Regards,
Ashwinelse if(option.equals("item")){
System.out.println("ItemPressed");
String itemIdStr=request.getParameter("id");
int itemId=Integer.parseInt(itemIdStr);
ItemCollection list=new ItemCollection();
list=(ItemCollection)session.getAttribute("Item");
Item item=new Item();
Item itS=new Item();
System.out.println("getItem()");
itS=item.getItem(itemId);
System.out.println(itS.getItemName());
System.out.println("session");
list.addItem(itS);
session.setAttribute("Item",list);
System.out.println("addedToSession");
}Maybe it's too early in the morning here, but it looks to me like you have all of your variables declared in your execution path....
... if that is the case, then uh... ya, they are going to be reinitalized each pass and only have at most the last item in them from your work. -
i have an old 4.0 project that was using entity 4.0
in VS2013 if I try to update an existing model or add a new one, it will forcefully install the entity framework 5.0 even though the selection in the box was to use 4.0
it goes out to nuget to do this and then it will forever add 5.0 even if I uninstall it.
5.0 getting installed completely breaks my application. References to tables disappear and cross reference for NO reason at all with another model.
How can i get it to just let me use 4.0 so I can move on OR how can i upgrade my old model into 5.0?
I'd rather not got tthe 5.0 route because that changes a lot of the ways things were done and would break even more code.Hello,
>>in VS2013 if I try to update an existing model or add a new one, it will forcefully install the entity framework 5.0 even though the selection in the box was to use 4.0
It is not very clear how you install the Entity Framework, as far as I know, the EF version 4.0 is available with .NET 3.5, from .NET 4.0, it will use the 5.0 by default, if you want to use the EF 4.0, you could change the target to .NET 3.5.
>>How can i get it to just let me use 4.0 so I can move on OR how can i upgrade my old model into 5.0?
If it is EF 5.0, as far as I know, it uses the DbContext API instead of the original ObjectContext API(the EF 4.0 uses this API) which provides a better performance, if you want to keep to use ObjectContext API, you could follow this article:
Reverting Back to ObjectContext Code Generation
The article shows the configuration for VS2012, for VS2013, you could change the Code Generation Strategy from T4 to Legacy ObjectContext.
Regards.
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.
Maybe you are looking for
-
PLSQL function body returning an sql report returns ORA-01403 No Data Found
I am on APEX 3.1.2.00.02 and Oracle 10g. I am developing a report with SQL Query (PL/SQL function body returning SQL query) type. But on running the report I am getting report error: ORA-01403: no data found Region Source declare qry varchar2(32767
-
FDMEE - Write back - No Data and No Errors
I am trying to Write Back from Planning 11.1.2.3.500 to EBS R12 using FDMEE 11.1.2.3.530. There is data in Planning, and when I execute an Import it processes successfully, but the Transform Data Process step has a warning symbol and there is no data
-
Payment terms linkage with Sales order
Hi experts, Validation required on SO/DO of customer in case of overdue payment exist. ex - Overdue days limit in customer master is defined as 60 days and if any sales invoice is pending for payment more than 61 days , in that case , system shoul
-
Given Word, Whether InDesign
I am struggling with whether to buy and learn InDesign. I have used Microsoft Word to create and publish several books. Some of them ended up on Google Books (a direct conversion to .pdf) and others I published privately using Kinko's (also in .pdf).
-
Set cursor position within table control while scrolling
hi, Anybody can guide me how to set the cursor with in table control while scrolling down,normally it is going to first input filed. Thanks and Regards, palani.