About Save_text
Hello...
I have a some question about SAVE_TEXT function..
Now. I will change a delivery header text
How to change a delivery header text using Save_TEXT funcion ??
I already execute save_text fucntion for changing text
But. I cannot change a delivery header text...
Please.. Help..me.. Thank you
Hi Dalho,
as delivery header texts are to be saved within the update process for a delivery creation or changed, this is done in UPDATE TASK.
You have to call function COMMIT_TEXT afetr SAVE_TEXT. Then is should work.
Regards,
Clemens
Similar Messages
-
Creating a long text using ABAP code.. fm SAVE_TEXT
When you create an order via IW31 one of the options is to click on the text button and create a long text. I am basically trying to mimic this action from within my ABAP code.
The text id details are as follows:
Text Name 500000015000046 which is (5000000 + order number)
Language EN
Text ID KOPF Order header text
Text Object AUFK Order text
If i manually create the text within the transaction i am then able to view and update it via function modules READ_TEXT and SAVE_TEXT. But if the text has not already been created READ_TEXT obviously returns nothing as it does not exist and SAVE_TEXT does not seem to created it!
Anyone know how i would go about creating this text using ABAP code?
Hope this make a bit of sense
Thanks in advance
MartI have implemented the code as i think it should be. See below, can any see what is wrong. If i add init_text it makes no difference and adding the commit_text just makes it hang
DATA: IT_TEXTS type standard table of TLINE,
wa_texts like line of it_texts,
wa_txtheader type THEAD.
wa_txtheader-TDID = 'KOPF'.
wa_txtheader-TDSPRAS = 'EN'.
wa_txtheader-TDNAME = '500000015000056'.
wa_txtheader-TDOBJECT = 'AUFK'.
wa_texts-tdformat = '*'.
wa_texts-tdline = 'hello'.
append wa_texts to it_texts.
wa_texts-tdformat = '*'.
wa_texts-tdline = 'hello'.
append wa_texts to it_texts.
wa_texts-tdformat = '*'.
wa_texts-tdline = 'hello'.
append wa_texts to it_texts.
wa_texts-tdformat = '*'.
wa_texts-tdline = 'hello'.
append wa_texts to it_texts.
wa_texts-tdformat = '*'.
wa_texts-tdline = 'hello'.
append wa_texts to it_texts.
wa_texts-tdformat = '*'.
wa_texts-tdline = 'hello'.
append wa_texts to it_texts.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
HEADER = wa_txtheader
INSERT = 'X'
SAVEMODE_DIRECT = ' '
OWNER_SPECIFIED = 'X'
LOCAL_CAT = ' '
IMPORTING
FUNCTION =
NEWHEADER =
TABLES
LINES = IT_TEXTS
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
About updating long text in the document item with bdc of fb02
HI,
I have a question about updating long text in the document item of sap:
Can I directly updating the long text information with the fuction save_text?
The long text is in :
tcode: fb02 -->input document no ... --> Document overview --> select one document
long text --> updating the value.
Becaust I want to update some items in a G/L Account with bdc or other technique, but I found I can't choose the items in the G/L Account with bdc automatically .That means I can't get the selected items and update them.So I try to update them with the function save_text directly (I know the doc no,bukrs,fiscal year ,item no which will decide the long text item).
Who can help me ?Or is there any way to solve the problem? Thanks very much.Yes, you can update directly using SAVE_TEXT.
Check this for the same.
[update long text in FB02|https://forums.sdn.sap.com/click.jspa?searchID=22194840&messageID=5418662] -
Hello All,
I am copying text from sales order and inserting into the production order.
I have used read_text, save_text and commit text.
In the debuggin i can see all the data getting populated, even iam getting sy-subrc = 0 in the save_text FM. <b>However text is not copied into the production order.</b>
Also i have a entry in STXH table.
I have posted my code for your reference
FORM ADD_LONG_TEXT1.
DATA: ID LIKE THEAD-TDID VALUE 'KOPF',
LANGUAGE LIKE THEAD-TDSPRAS,
NAME LIKE THEAD-TDNAME,
OBJECT LIKE THEAD-TDOBJECT VALUE 'AUFK'.
DATA: TLINES LIKE TLINE OCCURS 0 WITH HEADER LINE.
DATA: IT_THEAD LIKE THEAD OCCURS 0 WITH HEADER LINE.
*Prepare text criteria
CONCATENATE SY-MANDT txt-aufnr INTO NAME.
LANGUAGE = SY-LANGU.
*Begin of insert
MOVE id TO IT_THEAD-TDID.
MOVE language to IT_THEAD-TDSPRAS.
MOVE NAME to IT_THEAD-TDNAME.
MOVE OBJECT to IT_THEAD-TDOBJECT.
append it_thead.
*clear it_thead.
*End of insert
*First read text for existing data
CALL FUNCTION 'READ_TEXT'
EXPORTING
ID = ID
LANGUAGE = LANGUAGE
NAME = NAME
OBJECT = OBJECT
TABLES
LINES = TLINES
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
*Append/Insert new text data
LOOP AT txt-tline INTO wa_bdc.
CLEAR TLINES.
TLINES-TDFORMAT = '*'.
TLINES-TDLINE = wa_bdc-tdline.
APPEND TLINES.
ENDLOOP.
Secondly append new text data to existing data
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
HEADER = it_thead
INSERT = ' '
SAVEMODE_DIRECT = 'X'
OWNER_SPECIFIED = ' '
LOCAL_CAT = ' '
IMPORTING
FUNCTION =
NEWHEADER =
TABLES
LINES = TLINES
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'COMMIT_TEXT'
EXPORTING
OBJECT = OBJECT
NAME = NAME
ID = ID
LANGUAGE = LANGUAGE
SAVEMODE_DIRECT = 'X'
KEEP = ' '
LOCAL_CAT = ' '
IMPORTING
COMMIT_COUNT =
TABLES
T_OBJECT =
T_NAME =
T_ID =
T_LANGUAGE =
ENDFORM. "ADD_LONG_TEXTHi,
This is not a user exit, iam not sure about the update task.
It is a normal report program, have to copy the sales text to prod order and mark the user status check for TXTU .
This piece of code.
SELECT SINGLE matnr INTO i_matnr FROM vbap
WHERE vbeln = afpo-kdauf AND posnr = afpo-kdpos.
SELECT SINGLE mtart INTO i_mtart FROM mara
WHERE matnr = i_matnr-matnr.
IF i_mtart-mtart NE 'ZPPG'. " or i_mtart-mtart NE 'HALB'.
IF txt-t_user CS 'TXTU'.
ELSE.
If the status was changed write out the Order and Date.
PERFORM ADD_LONG_TEXT1.
IF sy-subrc = 0.
READ TABLE GT_STATUS WITH KEY TXT04 = 'TXTU'.
IF SY-SUBRC = 0.
PERFORM UPDATE_USER_STATUS
USING txt-aufnr GT_STATUS-ESTAT ''. "D01K956913+
ENDIF.
WRITE: / txt-aufnr.
ELSE.
FORMAT COLOR COL_NEGATIVE.
WRITE: / txt-aufnr.
FORMAT COLOR OFF.
ENDIF.
ENDIF. -
Longtext update by using save_text F.M
Hi All ,
I am updating longtext using F.M save_text the problem is
my longtext is in the form longtext type c length 1000.
Now how do i split this longtext such that i can pass the data in save_text.
the parameter TDLINE is only 132 character.
i tried using F.M tr_split_text at 132 char but the input parameter of this F.M can only take data of certain
length
Do any bdy know hw to go about it?
Regards
BhanuHi,
If your long text is in multiple lines of an internal table use the below code and take the text into some string varaible (lv_text_string here).
Concatenate the text into a string variable
LOOP AT lt_lines INTO lw_lines.
CONCATENATE lv_text_string lw_lines-tdline INTO
lv_text_string SEPARATED BY space.
CLEAR : lw_lines.
ENDLOOP.
Split the text into 132 char lines
CALL FUNCTION 'RSDG_WORD_WRAP'
EXPORTING
textline = lv_text_string
delimiter = space
outputlen = 132
IMPORTING
out_line1 = lv_outline1
out_line2 = lv_outline2
out_line3 = lv_outline3
TABLES
out_lines = lt_text_lines
EXCEPTIONS
outputlen_too_large = 1
OTHERS = 2.
Now use lt_text_lines for calling save_text FM. (Here lt_text_lines should be delared as an internal table of char132).
Hope this helps you !!!
Regards,
Ganga -
Urgent: Updating Item Text Via SAVE_TEXT
HI Friends,
I need to update the item text in me22n via some FM.
Can somebody suggest some FM with eg..
I have found SAVE_TEXT FM to update the item text.
i am not sure about the parameters and value could any body help me with some code ..
I have written a code like this
I have got a error like the length of the header table passed is higher ...and goes to short dump.
GW_THEAD-TDNAME = 'Concatenated value of Ebeln and Ebelp".
GW_THEAD-TDID = ?F01?.
GW_THEAD-TDSPRAS = SY-LANGU.
GW_THEAD-TDOBJECT = ?EKPO?.
IT_LINE-TDFORMAT = ?*?.
IT_LINE-TDLINE = ?Test Create Text?.
APPEND IT_LINE.
CALL FUNCTION ?SAVE_TEXT?
EXPORTING
CLIENT = SY-MANDT
HEADER = GW_THEAD
INSERT = ? ?
SAVEMODE_DIRECT = ? ?
OWNER_SPECIFIED = ? ?
LOCAL_CAT = ? ?
IMPORTING
FUNCTION =
NEWHEADER =
TABLES
LINES = IT_LINE
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Please help with some code /Hi
thank you very much for your reply.
Can you explain more about the inport parameters of the FM. lets say for example I need to update "item note" in the item of a outbound delivery with text " I am doind the testing". for this scenario what the are the parameters i need to send to the FM
thanks
sankar -
ABAP: FN MODULE "SAVE_TEXT"
HAI FRIENDS,
I AM USING ON FUNCTION MODULE I.E "READ_TEXT".
HERE I GET THE IN TWO TYPES I.E
1) TO GET A MATERIAL WITH TEXT.
2) TO GET A MATERIAL WITHOUT TEXT.
NOW I WANT TO ADD SOME TEXT FOR WITHOUT TEXT MATERIAL
HERE I AM USING ON FUNCTION MODULE I.E "SAVE_TEXT".
MY DOUBT IS WHERE WE GIVE NEWTEXT FOR THE FOLLOWING FUCTION MODULE
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
HEADER = I_THEAD
INSERT = 'X'
SAVEMODE_DIRECT = 'X'
OWNER_SPECIFIED = ' '
LOCAL_CAT = ' '
IMPORTING
FUNCTION =
NEWHEADER =
TABLES
LINES = I_TLINE.
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5
THANKS & REGARDS
VALLAMUTHU.MDATA: IT_TLINES LIKE TLINE OCCURS 0 WITH HEADER LINE.
Lets assume you have the text to be saved in the internal table IT_TEXT.
data : x_header TYPE thead.
to populate the data into SAVE_TEXT,you should know the values for the below fields.
x_header-tdobject = 'VBBK'.
x_header-tdname = lv_name . <--your material no
x_header-tdid = 'ZMAN'.
x_header-tdspras = 'E'.
LOOP AT IT_TEXT .
IT_TLINES-TDFORMAT = '*'.
IT_TLINES-TDLINE = IT_TEXT-LINE.
APPEND IT_TLINES.
CLEAR IT_TLINES.
ENDLOOP.
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
HEADER = X_HEADER
* INSERT = ' '
SAVEMODE_DIRECT = 'X'
* OWNER_SPECIFIED = ' '
* LOCAL_CAT = ' '
* IMPORTING
* FUNCTION =
* NEWHEADER =
TABLES
LINES = IT_TLINES
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
OBJECT = 4
OTHERS = 5
IF SY-SUBRC <> 0.
*--ERROR.
ELSE.
*--SUCCESS.
ENDIF.
regards
Srikanth
but remember,if you use SAVE_TEXT all previous text will be overwritten with the new text from IT_TLINES table.
so before using this you should use READ_TEXT and append your new text to this IT_TLINES table and then call SAVE_TEXT.
check this link,for more info about this FM
Re: How to get tem level text of PO???
Message was edited by: Srikanth Kidambi -
Hi everyone! I am actually in love with this adobe photoshop. I used PSCS2 before, but later on upgraded to CS4. But I feel tired in upgrading to CS5.
One time, I found a tutorial in youtube about camera raw, and would really want to use it. But I was wondering how to install the camera raw. I believe camera raw is a plugin? so I downloaded the plugin here, installed it in my PS. I downloaded a file Camera Raw.8bi and paste it on my C drive - C:\Program Files\Adobe\Photoshop CS4\Plug-ins\File Formats.
I now am very confused, how will I open it? I do not have adobe bridge! After I installed the camera raw, I opened my PS. I clicked the file>then browse in bridge. I had an error, it's "error 2 photoshop11 undefined". Which is what I thought, I might have done something wrong with installing it.
My question is, do you still need adobe bridge installed in order to use camera raw?
If yes, how does it work? How am I suppose to open camera raw?
If no, how am I going to open camera raw without bridge?
And also, where will I download adobe bridge? I cannot find one here for CS4, only adobe bridge for CS5. I am wondering, is it okay to install adobe bridge CS5 and use it with my PS CS4?
I badly need help!WebDAV (Web-based Distributed Authoring and Versioning) is a set of extensions to HTTP/1.1.
The main difference from FTP as far as I can see is that it allows you to edit documents on a remote web server.
WebDAV was used by the Apple server - MobileMe but is not generally supported by hosting services.
Using WebDAV you can mount a directory locally. This was how iDisk worked on your Mac and you could drag files onto it to upload them to the remote directory.
With WebDAV, a number of users can share a directory which is why its used in local networks but presents security problems when using a remote server.
If you are into file sharing rather than publishing, Dropbox or its new rival SugarSync are more appropriate. -
A few days ago i bought the macbook pro in a Providence. In late Summer i will come back to my Country - Ukraine. I would like to know about a tax for my
laptop. Can i return tax? Through the TAX FREE or return in airport? What should i do?You need to talk with the tax authorities in the countries to which you traveled and that of your home country. We are all end-users liek you and not Apple agents.
-
ok i have a advent roma laptop with window 7. my itunes used to work fine, completely. every time i plugged in my ipod it was ok. recently my ipod was not working so i never bothered with itunes, however i have movies/tv prog that i purchased and would like to view them. i have an ipod nano from about 5 years ago, the problem with thet is, it switches on, but the circular control panel does nothing, all you can do is lock and unlock it - nothing else.
i tried to download new version of itunes, then uninstalled my origonal version, incase it was corrupted etc, i then again tried to down load new version and also version that is windows 64bit. still when i select the downlaod to open as son as it is finnished nothing happens. and now my desktop shortcut has dissapeared. before when it was there, id double click it, nothing, right click to open it, nothing.
im not the best technically minded but i just dont see what im doing wrong here, please helpPerhaps it would be helpful for you to view the page source code of this page
http://www.alanwork.com/
As you can see, the submenu code links are immediately below the top level code, and are
wrapped in their own <UL> </UL> tag pairs.
Hope that helps -
Vendor payments and debts about an asset
Dear sap colleages
I need to know these information about an ASSET:
Purchased orders,
Items from purchase orders,
which of these items i've received, i've paid (also date), i've not paid ( amount of debt related to asset)
payments in advanced (date),
wich of these payments have been cleared (clearing date) and wich not,
who is the vendor,
other expenses (such as delivery)
the amount of taxes,
invoices related and NOT RELATED TO purchase order
payments without invoice
Which transactions do i need to follow?
or
Which document flow?
or
Which tables? Wich keys?
or
Is there a standard report that can give me such information?
Any documentation and/or code will be appreciated.
I need to program a report to integrate all these information.
Thanks and Kind RegardsHi,
Refer to T.code AW01N - Asset Explorer .
Additionally you cna also refer to SAP Standard reports in Asset Accounting
Accounting - Financial Accounting - Fixed Assets - Information System - Reports on Asset Accounting
Please let me know if you need more information.
Assign points if useful.
Regards
Sridhar M -
I cannot receive email properly on either my IPad or my IPhone. I have had them for over a year and they have always worked fine. Until three days ago, when they both started acting up. On the IPad, when I open mail, it says it is downloading about 1,700 emails. At the very end, which takes quite a while to get to, I finally get the most recent ones. The IPad is sending emails just fine.
On my IPhone, when I open mail, it says it is downloading 100 emails, but it doesn't do that. And it gives me no new emails at all. The IPhone is sending email just fine.
I have already deleted the email accounts on both devices and reinstalled them. I've contacted the Internet service provider and verified all the right settings. The Outlook email on my desktop is working perfectly.WMV is a heavily-compressed format/CODEC, and the processing time will depend on several factors:
Your CPU, which is not that powerful in your case
Your I/O sub-system, which is likely a single HDD on your laptop
The source footage. What is your source footage?
Any Effects added to that footage. Do you have any Effects?
Each of those will have an impact on the time required.
The trial has only one main limitation - the watermark. Now, there are some components, that have to be activated, but are not with the trial, but they would be evident with Import of your source footage, if it's an issue.
Good luck,
Hunt -
I have had my IPAD2 for quite a while but haven't activated my cellular data for about a year. I am now trying to activate and when I go to cellular data, turn it on and try to tap view account i just get a message that says "connection to server lost". I could swear the last time I used cellular data you would see the signal in the upper left corner and I only see "no service" there, I am in a location where I know I should have service. Is there something I should do to my IPAD? I tried resetting, I tried clearing cookies and history in Safari (after reading a post n these discussions). I don't know what to do next. My IOS version is 6.1.3. I did go into Network from the general tab and I see it says "SIM not provisioned". HELP and Thank you in advance.
Hello Theresa818,
Thank you for using Apple Support Communities!
It sounds like the cellular data will not activate for some reason on the iPad.
I found this article that will help you resolve this issue here, named iPad (Wi-Fi + Cellular Models): Troubleshooting a cellular data connection, found here http://support.apple.com/kb/TS4249
Check for a carrier settings update.
Update your iPad.
Toggle the Cellular Data setting off and on under Settings > Cellular Data.
Restart your iPad.
Tap Settings > General > About. Locate the Carrier entry and make sure that your carrier is correct.
If your SIM card has SIM PIN enabled, try turning it off: Tap Settings > Cellular Data > SIM PIN.
Make sure you're in an area of good coverage. If the cellular data connection works in another area, contact your carrier to report the original affected area.
Reset network settings: Tap Settings > General > Reset > Reset Network Settings.
Restore the iPad as new.
If none of the above steps resolves the issue, make an appointment at an Apple Retail Store, contact your carrier, or contact AppleCare to troubleshoot further.
I know you may have done one or two of the steps here, so you can skip those.
Take care,
Sterling -
Doubt about report FBL5N of screen field:Open items and Cleared items
hi
i know the report FBL5N is use DDF LDB and the report work flow is BSID->BKFP->BSEG
but i don't know to differentiate Open Items and Cleared items in this report.
Open items and Cleared items stand for a field flag in these table (BSID,BKFP,BSEG )? if true the field is?
or they must be calc in program ? if true what about calc rules?
waiting for help! thank you!Hi,
Here is the difference in Open Items and Cleared Items.
In FI first the document is Open (when it is posted) so the entry is made in table BSID. Once the document is cleared, it will move from BSID to BSAD. And for Cleared item you will see Clearing Document no and Clearing date values updated (these are blank when the item is open).
The only difference in Open and Cleared is via Clearing Document and Clearing Date. If the values are present, it means document is cleared.
Hope this helps.
ashish
Message was edited by:
Ashish Gundawar -
Follow up on an old thread about memory utilization
This thread was active a few months ago, unfortunately its taken me until now
for me to have enough spare time to craft a response.
From: SMTP%"[email protected]" 3-SEP-1996 16:52:00.72
To: [email protected]
CC:
Subj: Re: memory utilization
As a general rule, I would agree that memory utilzation problems tend to be
developer-induced. I believe that is generally true for most development
environments. However, this developer was having a little trouble finding
out how NOT to induce them. After scouring the documentation for any
references to object destructors, or clearing memory, or garbage collection,
or freeing objects, or anything else we could think of, all we found was how
to clear the rows from an Array object. We did find some reference to
setting the object to NIL, but no indication that this was necessary for the
memory to be freed.
I believe the documentation, and probably some Tech-Notes, address the issue of
freeing memory.
Automatic memory management frees a memory object when no references to the
memory
object exist. Since references are the reason that a memory object lives,
removing
the references is the only way that memory objects can be freed. This is why the
manuals and Tech-Notes talk about setting references to NIL (I.E. freeing memory
in an automatic system is done by NILing references and not by calling freeing
routines.) This is not an absolute requirement (as you have probably noticed
that
most things are freed even without setting references to NIL) but it accelerates
the freeing of 'dead' objects and reduces the memory utilization because it
tends
to carry around less 'dead' objects.
It is my understanding that in this environment, the development tool
(Forte') claims to handle memory utilization and garbage collection for you.
If that is the case, then it is my opinion that it shoud be nearly
impossible for the developer to create memory-leakage problems without going
outside the tool and allocating the memory directly. If that is not the
case, then we should have destructor methods available to us so that we can
handle them correctly. I know when I am finished with an object, and I
would have no problem calling a "destroy" or "cleanup" method. In fact, I
would prefer that to just wondering if Forte' will take care of it for me.
It is actually quite easy to create memory leaks. Here are some examples:
Have a heap attribute in a service object. Keep inserting things into
the heap and never take them out (I.E. forgot to take them out). Since
service objects are always live, everything in the heap is also live.
Have an exception handler that catches exceptions and doesn't do
anything
with the error manager stack (I.E. it doesn't call task.ErrMgr.Clear).
If the handler is activated repeatedly in the same task, the stack of
exceptions will grow until you run out of memory or the task terminates
(task termination empties the error manager stack.)
It seems to me that this is a weakness in the tool that should be addressed.
Does anyone else have any opinions on this subject?
Actually, the implementation of the advanced features supported by the Forte
product
results in some complications in areas that can be hard to explain. Memory
management
happens to be one of the areas most effected. A precise explanation to a
non-deterministic process is not possible, but the following attempts to
explain the
source of the non-determinism.
o The ability to call from compiled C++ to interpreted TOOL and back
to compiled C++.
This single ability causes most of the strange effects mentioned in
this thread.
For C++ code the location of all variables local to a method is not
know
(I.E. C++ compilers can't tell you at run-time what is a variable
and what
isn't.) We use the pessimistic assumption that anything that looks
like a
reference to a memory object is a reference to a memory object. For
interpreted
TOOL code the interpreter has exact knowledge of what is a reference
and what
isn't. But the TOOL interpreter is itself a C++ method. This means
that any
any memory objects referenced by the interpreter during the
execution of TOOL
code could be stored in local variables in the interpreter. The TOOL
interpreter
runs until the TOOL code returns or the TOOL code calls into C++.
This means
that many levels of nested TOOL code can be the source of values
assigned to
local variables in the TOOL interpreter.
This is the complicated reason that answers the question: Why doesn't a
variable that is created and only used in a TOOL method that has
returned
get freed? It is likely that the variable is referenced by local
variables
in the TOOL interpreter method. This is also why setting the
variable to NIL
before returning doesn't seem to help. If the variable in question is a
Array than invoke Clear() on the Array seems to help, because even
though the
Array is still live the objects referenced by the Array have less
references.
The other common occurrence of this effect is in a TextData that
contains a
large string. In this case, invoking SetAllocatedSize(0) can be used
to NIL
the reference to the memory object that actually holds the sequence of
characters. Compositions of Arrays and TextData's (I.E. a Array of
TextData's
that all have large TextDatas.) can lead to even more problems.
When the TOOL code is turned into a compiled partition this effect
is not
noticed because the TOOL interpreter doesn't come into play and
things execute
the way most people expect. This is one area that we try to improve
upon, but it is complicated by the 15 different platforms, and thus
C++ compilers,
that we support. Changes that work on some machines behave
differently on other
machines. At this point in time, it occasionally still requires that
a TOOL
programmer actively address problems. Obviously we try to reduce
this need over
time.
o Automatic memory management for C++ with support for multi-processor
threads.
Supporting automatic memory management for C++ is something that is
not a very
common feature. It requires a coding standard that defines what is
acceptable and
what isn't. Additionally, supporting multi-processor threads adds
its own set of
complications. Luckily TOOL users are insulated from this because
the TOOL to C++
code generator knows the coding standard. In the end you are
impacted by the C++
compiler and possibly the differences that occur between different
compilers and/or
different processors (I.E. Intel X86 versus Alpha.) We have seen
applications that
had memory utilization differences of up to 2:1.
There are two primary sources of differences.
The first source is how compilers deal with dead assignments. The
typical TOOL
fragment that is being memory manager friendly might perform the
following:
temp : SomeObject = new;
... // Use someObject
temp = NIL;
return;
When this is translated to C++ it looks very similar in that temp
will be assigned the
value NULL. Most compilers are smart enough to notice that 'temp' is
never used again
because the method is going to return immediately. So they skip
setting 'temp' to NULL.
In this case it should be harmless that the statement was ignored
(see next example for a different variation.) In more
complicated examples that involve loops (especially long
lived event loops) a missed NIL assignment can lead to leaking the
memory object whose
reference didn't get set to NIL (incidentally this is the type of
problem that causes
the TOOL interpreter to leak references.)
The second source is a complicated interaction caused by history of
method invocations.
Consider the following:
Method A() invokes method B() which invokes method C().
Method C() allocates a temporary TextData, invokes
SetAllocatedSize(1000000)
does some more work and then returns.
Method B() returns.
Method A() now invokes method D().
Method D() allocates something that cause the memory manager to look
for memory objects to free.
Now, even though we have returned out of method C() we have starting
invoking
methods. This causes us to use re-use portions of the C++ stack used to
maintain the history of method invocation and space for local variables.
There is some probability that the reference to the 'temporary' TextData
will now be visible to the memory manager because it was not overwritten
by the invocation of D() or anything invoked by method D().
This example answers questions of the form: Why does setting a local
variable to
NIL and returning and then invoking task.Part.Os.RecoverMemory not
cause the
object referenced by the local variable to be freed?
In most cases these effects cause memory utilization to be slightly
higher
than expected (in well behaved cases it's less than 5%.) This is a small
price to pay for the advantages of automatic memory management.
An object-oriented programming style supported by automatic memory
management makes it
easy to extended existing objects or sets of objects by composition.
For example:
Method A() calls method B() to get the next record from the
database. Method B()
is used because we always get records, objects, of a certain
type from
method B() so that we can reuse code.
Method A() enters each row into a hash table so that it can
implement a cache
of the last N records seen.
Method A() returns the record to its caller.
With manual memory management there would have to be some interface
that allows
Method A() and/or the caller of A() to free the record. This
requires
that the programmer have a lot more knowledge about the
various projects
and classes that make up the application. If freeing doesn'
happen you
have a memory leak, if you free something while its still
being used the
results are unpredictable and most often fatal.
With automatic memory management, method A() can 'free' its
reference by removing
the reference from the hash table. The caller can 'free' its
reference by
either setting the reference to NIL or getting another
record and referring
to the new record instead of the old record.
Unfortunately, this convenience and power doesn't come for free. Consider
the following,
which comes from the Forte' run-time system:
A Window-class object is a very complex beast. It is composed of two
primary parts:
the UserWindow object which contains the variables declared by the
user, and the
Window object which contains the object representation of the window
created in
the window workshop. The UserWindow and the Window reference each
other. The Window
references the Menu and each Widget placed on the Window directly. A
compound Window
object, like a Panel, can also have objects place in itself. These
are typically
called the children. Each of the children also has to know the
identity of it's
Mom so they refer to there parent object. It should be reasonably
obvious that
starting from any object that make up the window any other object
can be found.
This means that if the memory manager finds a reference to any
object in the Window
it can also find all other objects in the window. Now if a reference
to any object
in the Window can be found on the program stack, all objects in the
window can
also be found. Since there are so many objects and the work involved
in displaying
a window can be very complicated (I.E. the automatic geometry
management that
layouts the window when it is first opened or resized.) there are
potentially many
different reference that would cause the same problem. This leads to
a higher than
normal probability that a reference exists that can cause the whole
set of Window
objects to not be freed.
We solved this problem in the following fashion:
Added a new Method called RecycleMemory() on UserWindow.
Documented that when a window is not going to be used again
that it is
preferably that RecycleMemory() is invoked instead
of Close().
The RecycleMemory() method basically sets all references
from parent to
child to NIL and sets all references from child to
parent to NIL.
Thus all objects are isolated from other objects
that make up
the window.
Changed a few methods on UserWindow, like Open(), to check
if the caller
is trying to open a recycled window and throw an
exception.
This was feasible because the code to traverse the parent/child
relationship
ready existed and was being used at close time to perform other
bookkeeping
operations on each of the Widgets.
To summarize:
Automatic memory management is less error prone and more productive but
doesn't come totally for free.
There are things that the programmer can do that assists the memory
manager:
o Set object reference to NIL when known to be correct (this
is the
way the memory is deallocated in an automatic system.)
o Use methods like Clear() on Array and SetAllocatedSize()
on TextData to
that allow these objects to set their internal
references to NIL
when known to be correct.
o Use the RecycleMemory() method on windows, especially very
complicated
windows.
o Build similar type of methods into your own objects when
needed.
o If you build highly connected structures that are very
large in the
number of object involved think that how it might be
broken
apart gracefully (it defeats some of the purpose of
automatic
management to go to great lengths to deal with the
problem.)
o Since program stacks are the source of the 'noise'
references, try
and do things with less tasks (this was one of the
reasons that
we implemented event handlers so that a single task
can control
many different windows.)
Even after doing all this its easy to still have a problem.
Internally we have
access to special tools that can help point at the problem so that
it can be
solved. We are attempting to give users UNSUPPORTED access to these
tools for
Release 3. This should allow users to more easily diagnose problems.
It also
tends to enlighten one about how things are structured and/or point out
inconsistencies that are the source of known/unknown bugs.
Derek
Derek Frankforth [email protected]
Forte Software Inc. [email protected]
1800 Harrison St. +510.869.3407
Oakland CA, 94612I beleive he means to reformat it like a floppy disk.
Go into My Computer, Locate the drive letter associated with your iPod(normally says iPod in it, and shows under removable storage).
Right click on it and choose format - make sure to not have the "quick format" option checked. Then let it format.
If that doesnt work, There are steps somewhere in the 5th gen forum( dont have the link off hand) to try to use the usbstor.sys to update the USB drivers for the Nano/5th gen.
Maybe you are looking for
-
APD - Query output on to a Flat file
All We are on BI 7.0 with SP13 and NWS 12. I am trying to create a new APD with source as "Query" built on Info object and target as "Flat File". There is no requirement of transformation so I am trying to map directly from Source to Target with a di
-
I have mini dv tapes that has footage with both 16:9 and 4:3 aspect ratio. Meaning that there are some scenes in 4:3 and others in 16:9 aspect ratio both in one mini dv tape. My question is, when i capture the video (in iMovie11), do i need to captur
-
Computer unable to recognize the printer
hi............. I have a hp photosmart c4188 al in one printer, the problem is that, the printer is not detect by computer. Whenever I try to connect with usb, it says that, the usb is malfuction/not recognised. Even the driver is unable to detect.
-
HT201279 convert Numbers file to Excel format
When I convert my Numbers file to Excel format, each worksheet name is appended with "Table - 1". Each subsequent conversion adds another "Table - 1" to the name of every worksheet as well. How do I stop this from happening?
-
Creating axis names by programming
Hello again. I tried to define the axis names with different units by programming instead of doing in the graph properties. As in my vi, I wired each axis name corresponding to the unit input to the graph property node, but it didn't come out correct