How to store 10,000 in a currency field of length 15.
Hi Experts
wa_char of type char length 255. Now by some program i am getting 10,000.00 in wa_char.
I had to pass it to a vairable wa_curr of currency type of length 15.
I tried to firs pass to numc type variabl or P type variable then to pass it to wa_curr but ...everytime dump is coming for mismatch....
I think problem is with the comma and dot(10,000.00)..but cant abel to remove it.
Please help.
i will award points to every helpful answer.
thanks.
Comma separator or decimals are user specific settings.
Please use :
Get the user settings
SELECT SINGLE DCPFM
FROM USR01
INTO L_F_DCPFM WHERE BNAME = SY-UNAME.
IF NOT <YOUR_CURRENCY_FIELD> IS INITIAL.
CASE L_F_DCPFM.
WHEN 'Y' OR ' '.
REPLACE '.' WITH ',' INTO <YOUR_CURRENCY_FIELD>.
ENDCASE.
ENDIF.
Please revert if any further help.
Enjoy.
Regards,
A.Singh
Similar Messages
-
How to enter negative value in a currency field
Hi Experts,
Please help me how to allow to enter negative value in a field on report selection.
I created a currency field on a report selection using PARAMETERS.
I can enter positive value in the field. But, I cannot enter negative value.
SAP shows an error message 00 126 "Specify positive values only".
I know I can place check ON at "with sign" option of the field in case I create the screen by myself.
However, I cannot do it on screen 1000 created by report program.
Thanks,
GeorgeHi ,
I know I can place check ON at "with sign" option of the field in case I create the screen by myself.
Prabhu--> Just Create a new Domain( select "WITH SIGN") and date elemet,And Use Data Element in your report.
regards
Prabhu -
How to store running sum of group header fields
HI All,
I am bit confused how to do this so writing the post here. I have a group header which gets the amount spent by cost centre by account number
the group contains the following fields
[Account Number] [SDESCR] [sum of coscentre1] [sum of costcentre2] and so on.
The end result i get as follows
Account number Description Coscentrenumber1 CostCentrenumber2 and so on
100 cash at bank 6000 7000
200
and so on
now i want
Total Sumof(Costcentrenumber1) Sumof(Concentrenumber2)
how can I achieve this ? am confused how to store the value of [sum of costcentre1] into a shared variable and use this shared variable in page footer to display the total ?Let me be more clear I need the out out something like
Account number Description Costcentrenumber1 Costcentrenumber2 Costcentrenumber3
100 6000 7000 800
200 4000 5000 300
Toal 10000 12000 1100
the account numbers are placed in Group header so that we group all the transactions by account number. Say for example when i said account number 100 above in the backend
it is as follows
Account number Costcentrenumber1
100 2000
100 2000
100 2000
In the crystal the above logic is placed in Group header by creating Group Name fields
so that end result in the report it is shown as
Account number Coscentrenumber1
100 6000
Now in the report at the end i want the sum by Costcentrenumber.
as 10000 shown above.
Hope am clear. -
How to store bit data in VARCHAR(4000) field?
Hi.
Please help!
We are porting some C/C++ software with embedded SQLs from NT/DB2 to Linux/Oracle.
On NT/DB2 we have some table to store file data in a VARCHAR(4000) blocks.
Table looks like this
CREATE TABLE FileData (filetime as timestamp not null, idx int not null, datablock varchar(4000) FOR BIT DATA not null, primary key (filetime, idx) );
As you can see DB2 has appropriate field modifier - "FOR BIT DATA" which makes DB2 storing data as-is, not converting characters.
I need to know - if it is possible to do the same in Oracle like in DB2?
If Oracle has some kind of field modifier like "FOR BIT DATA" in DB2?
If not, how can I do the same in Oracle?
The current problems are:
1) when application imports the file with some national chars the Oracle stores "?" in a database in place of national chars.
2) another piece of a problem - if file is more than 4000 bytes length, it reports the ORA-01461 error (see it is trying to expand some chars to UTF8 char which is not fit a single char, so finally - not fit the field size).
So, it seems that it cannot proceed national chars at all. :-\
For details please see enclosed [C code|http://dmitry-bond.spaces.live.com/blog/cns!D4095215C101CECE!1606.entry] , there is example how data written to a table.
In other places we also need to read data from FIELDATA table and store back to file (other filename, other location).
Here is summary on a field-datatype variants I have tried for the "datablock" field:
1) VARCHAR2, RAW, LONG RAW, BLOB - does not work! All reports the same error - ORA-01461.
2) CLOB, LONG - both working fine but(!) both still returns "?" instead of national chars on data reading.
Hint: how I did try these field types - I just drop the "FileData" table, created it using different type for "datablock" field and run the same application to test it.
I think I need to explain what the problem - we do not provide direct access to Oracle database, we use a some middle-ware. Middle-ware is a C/C++ software which also has a interface for dynamic SQLs execution. So, exactly this middle-ware (which is typically running on the same server with Oracle) receives the "?" instead of national chars! But we need it to return all data AS-IS(!) without any changes!!! That is wjhy I did ask - if Oracle has any options to store byte-data as-is?
The BIG QUESTION - HOW CAN WE DO THIS?!
Another thing I need to explain - it is ok to use Oracle-specific SQL ONLY IF THERE IS REALLY NO WAY TO ACHIEVE THIS WITH STANDARD SQL! Please.
So, please look on a C code (by link I have posted above) and tell - if it is possible to make working in Oracle the VARCHAR approach we using at the moment?
If not - please describe what options do we have for Oracle?
Regards,
Dmitry.
PS. it is Oracle 11gR2 on CentOS 5.4, all stuff installed with default settings, so Oracle db encoding is "AL32UTF8".
C/C++ application is built as ANSI/ASCII application (non-unicode), so sizeof(char)=1.
The target Oracle db (I mean - the one which will be used on customer site) is Oracle 10g. So, solution need to be working on Oracle 10g.P. Forstmann wrote:
There is some contradiction in your requirements:
- if you want to store data as is without any translation use RAW or BLOB
- if you want to store national character data try to use NVARCHAR2 or NCLOB.Seems you did not understand the problem. Ok, I'll try to explain. Please look on the code sample I provided in original question
(I just added expanded data structures there, sorry I forgot to publish them when post original question):
EXEC SQL BEGIN DECLARE SECTION;
struct {
char timestamp[27];
char station[17];
char filename[33];
char task[17];
char orderno[17];
long filelen;
gFilehead;
struct {
char timestamp[27];
long idx;
struct {
short len;
char arr[4001];
} datablock;
gFiledata;
EXEC SQL END DECLARE SECTION;
#define DATABLOCKSIZE 4000
#ifdef __ORACLE
#define VARCHAR_VAL(vch) vch.arr
#elif __DB2
#endif
short dbWriteFile( char *databytes, long datalen )
short nRc;
long movecount;
long offset = 0;
gFilehead.filelen = gFilehead.filelen + datalen;
while ((datalen + gFiledata.datablock.len) >= DATABLOCKSIZE)
movecount = DATABLOCKSIZE - gFiledata.datablock.len;
memcpy(&VARCHAR_VAL(gFiledata.datablock)[gFiledata.datablock.len], databytes, movecount);
gFiledata.datablock.len = (short)(gFiledata.datablock.len + movecount);
exec sql insert into filedata (recvtime, idx, datablock)
values(
:gFiledata.recvtime type as timestamp,
:gFiledata.idx,
:gFiledata.datablock /* <--- ORA-01461 appears here */
nRc = sqlcode;
switch (nRc)
case SQLERR_OK: break;
default:
LogError(ERR_INSERT, "filedata", IntToStr(nRc), LOG_END);
exit(EXIT_FAILURE);
offset = offset + movecount;
datalen = datalen - movecount;
gFiledata.idx = gFiledata.idx + 1;
memset(&gFiledata.datablock, 0, sizeof(gFiledata.datablock));
databytes = databytes + movecount;
gFiledata.datablock.len = 0;
if (datalen + gFiledata.datablock.len)
memcpy(&VARCHAR_VAL(gFiledata.datablock)[gFiledata.datablock.len], databytes, datalen);
gFiledata.datablock.len = (short)(gFiledata.datablock.len + datalen);
return 0;
}So, the thing we need is - to put some data into the "datablock" field of following structure:
struct {
char timestamp[27];
long idx;
struct {
short len;
char arr[4001];
} datablock;
gFiledata;Then insert it into a database table using static SQL like this:
exec sql insert into filedata (recvtime, idx, datablock)
values(
:gFiledata.recvtime type as timestamp,
:gFiledata.idx,
:gFiledata.datablock /* <--- ORA-01461 appears here */
); And then expect to read exactly the same data back!
The problems are:
1) Oracle make decision to convert the data we are inserting (why? and how to disable converting?!)
2) even if it inserts the data (CLOB and LONG field datatypes are working fine when inserting data with such static SQL + such host variable) then it became not readable! (why?! how to make it readable?!)
P. Forstmann wrote:
ORA-01461 could mean that you have a wrong data type for bind variable variable in your client code:Not me decided that host variable is the "LONG datatype value" - the Oracle make that decision instead of me. And that is the problem!
Looks like Oracle react on any char code >= 0x80.
So, assume if I run the code:
// if Tab1 was created as "CREATE TABLE Tab1 (value VARCHAR(5))" then
char szData[10] = "\x41\x81\x82\x83\x84";
EXEC SQL INSERT INTO Tab1 (value) VALUES (:szData);
Oracle will report the ORA-01461 error!
EXACTLY THIS IS THE PROBLEM I HAVE DESCRIBED IN MY ORIGINAL QUESTION.
So, problem - why Oracle make such decision instead of me?! How we can make Oracle insert data into a table AS-IS?
What other type of host variable we should use to make Oracle think that data is a binary?
void*? unsigned char? Could you please provide any examples?
Ok, you did recommend - "use the RAW datatype". But RAW datatype is limited to size 2000 bytes only - we need 4000! So, it is not match our needs at all.
Also you have mentioned "use BLOB" - but testing shows that Oracle reports the same ORA-01461 error on inserting data into a BLOB field from such host variable! (see the code I posted)
What also we can do?
Change type of host variables? BUT HOW?! -
How to stor special characters in a VARCHAR2 field?
I am trying to store a encrypted string into a 'varchar2' field. But, the encrypted string is not stored properly. Some characters are stored incorrectly.
Can anybody help me in storing an encrypted string into a varchar2 field??HTH
Laurent Schneider
OCM DBA
SQL> select * from z;
S
Mama?Mia
a b c
123
SQL> select * from z where translate(s,'~ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz1234567890','~') is not null;
S
Mama?Mia
SQL> select * from z where regexp_like(s, '[^[:alnum:][:space:]]');
S
Mama?Mia -
How to store/manipulate Date and long text fields with Dictionary project
I am able to save string values into my backend (SQL Server) database in my web dynpro project but I am getting errors dealing with my date string and my long text (comments) field.
I want to figure out both how I need to define the fields in the dictionary project, how to define the context variables in web dynpro, and how to code the statements to pull the values out of the context and into fields I can use in my SQL insert.
Currently I have the date defined in the dictionary project as "date" and the comments as a 256-character string.
In the web dynpro context I have the date field defined as "date" and the comments field defined as "string". Should I define a 256-character string type and use that as field type??
In the code I am using the following to get the values:
String s9 = (String) wdContext.nodeReceipt().getElementAt(wdContext.nodeReceipt().getLeadSelection()).getAttributeValue("Comments");
String s5 = (String) wdContext.nodeReceipt().getElementAt(wdContext.nodeReceipt().getLeadSelection()).getAttributeValue("DateReceived");
SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yyyy");
try {
Date dt = sdf.parse(s5);
} catch (Exception e) {
e.printStackTrace();
I then try to insert all of my values with the following code:
InitialContext ctx = new InitialContext();
javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup("jdbc/SAP/BC_JMS");
java.sql.Connection con = ds.getConnection();
java.sql.Statement stmt = con.createStatement();
stmt.executeUpdate("insert into AVD_GEN_REC(VENDOR,DATE_RECEIVED,TOTAL_PIECES,LOGGED_BY," +
"ADDRESSED_TO,BLDG_NO,CARRIER,TRACKING_NO, COMMENTS) values('s1','s5','s2','s6','s3','s7','s4','s8','s9')");
} catch (Exception e) {
wdThis.wdGetAPI().getComponent().getMessageManager().reportSuccess("Exception "+e.getMessage());
Any help/ideas would be appreciated...The comment error seems to have resolved itself but I still get an error with the date field:
Exception The SQL statement "INSERT INTO "AVD_GEN_REC" ("VENDOR","DATE_RECEIVED","TOTAL_PIECES","LOGGED_BY","ADDRESSED_TO","BLDG_NO","CARRIER","TRACKING_NO","COMMENTS") VALUES ('s1','d5','s2','s6','s3','s7','s4','s8','s9')" contains the semantics error[s]: type check error: new value (element number 2) is not assignable to column "DATE_RECEIVED"
The DATE_RECEIVED is defined in the data dictionary as "date", the context variable "DateReceived" is also a "date", and the statement to pull d5 is being stored to a "Date". Is there a difference between the "Date" and "date"?
Date d5 = wdContext.currentReceiptElement().getDateReceived(); -
Is the iPod touch 64gb suppose to store 14,000 songs
Is the iPod touch 64gb suppose to store 14,000 songs
Yes but that assumes standard length and 128k kbps compression. To get this compression go to the Summary pane for the iPod in iTunes and check the box that says Convert higher bitrate songs to XX kbps ACC. Select 12k or a higher one for less compression/less songs or lower one for more songs and some loss in quality.
The specs for the 3G iPod (the number of songs is not given in the 4G and 5G specs)
32GB or 64GB flash drive2
Holds up to 7,000 or 14,000 songs in 128-Kbps AAC format3 -
Having problems when adding new Curency value field + currency field.
I need to add a new Currency field (CURR, length 15, 2 decimal places) plus the Currency field itself to a view.
I'm really struggerling. I have looked at the existing SAP fields in the Component workbench and I have to admit I can not see how a field is linked/related to the currency itself. Is this link established purlely at the disctionary level?.
Has anyone added their own Z field value and Z currency field before. I can create both fields and display them, but what I can not work out is how I related them within the component workbench, or is this done from the dictionary?.
Any help would be greatly appreciated.
I should have been able to look at an existing SAP example and work out how it's done, but so far I can not see/determine how this is achieved, even though someone has mentioned that it's controlled via the GET_I_field method. Looking at this method I was expecting to see some mention of both the Currency value field and the Currency field. But as I don't see these confusion reigns.
JasonThat's correct, but am I right in thinking that you can't actually create the currency key field itself?.
I am aware that currency value fields can be created which reference a currency key field, but can see nothing that allows me to create a currency key field to be referenced.
I hope that makes sense.
Also, I have amended the structure, changing my value fields from Decimal 15,2 to Currency 15,2 and have created a new currency key field in the structure and referenced this from the Currency value field.
Witin the Component/view/context node I can see this new currency key field, but it appears as STRUCT.fieldlabel whereas my currency value field appears in the context node as EXT.fieldlabel, because it was created in the AET.
My problem is that when attempting to add the currency key field onto the screen I don't have it to select from within the list of structures/attributes. All the others attributes in the context node seem to be there, except the new currency key field/attribute.
The attribute has a SET_fieldlabel, GET_fieldlabel, GET_M_Fieldlabel and a GET_I_Fieldlabel, which I believe is all that should be required.
Does anyone know what my problem could be?.
Jason -
Hi,
How we can do mapping for the Currency fields in bdc recording. is there any special approach or like normal fields only. Can any body clear it.
Thanks......Hi Anil,
<b>For example, while recording you met with fields --> MSEG-DMBTR (Currency field)
Go to SE11 --> MSEG --> Search for DMBTR --> Double click on the Data Element i.e. DMBTR --> Double Click on the domain WERTZ --> You can see under the block Output Characteristics : Output Length = 16.
While declaring the TYPES Structure, make it CHAR(16).</b>
<b>The same way u search for u r currency field and declare the length of the field equal to output length of type char</b>
Same u have to follow for quantity fields . -
HT1918 My apple store is on US dollar currency how can I change it to euro currency pls tks
MY apple store of my ipad is on dollar currency how can I change it to euro currency pls tks
In your iPad go here:
Settings > iTunes & App Stores > tap your Apple ID: > View Apple ID > Country/Region
and select your country as appropriate.
Regards. -
How to store information in icloud
Hi all we have just set up the icloud account. is there any easy to use instructions on how to store information from our computer ie music into icloud.
Welcome to the Apple Community.
Your iCloud account is not for storing music, that is done through your iTunes account. Any previous purchases can be redownloaded using iTunes in the cloud (use the purchased section in the iTunes store), or if you subscribe to iTunes match you can store all your library (up to 25,000 tunes) in the cloud. -
How can I find the currency field of table KOMU
I need to select data from table KOMU, including field wrbtr. in 'Currency/Quantity Fields' tab, it's defined to use bkpf-waers.
but how can i find the corresponding record in bkpf? could anyone tell me the relation between these two table?
or is there another way to get the currency field?
thank you!Hi,
In that case, please retrieve the currency & store it in variable. Pass the variables to the Function Module.
CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
EXPORTING
date = syst-datum
foreign_amount = for_amount
foreign_currency = L_cur1
local_currency = l_cur2
IMPORTING
local_amount = loc_ammount
EXCEPTIONS
no_rate_found = 1
overflow = 2
no_factors_found = 3
no_spread_found = 4
derived_2_times = 5.
[Code]
Best regards,
Prashant
[code] -
How to store numbers in a stack....
hello guys...i ve got the following assignment:
Write a Java program that reads and evaluates a fully parenthesised arithmetic expression. The
purpose of this program is to illustrate a fundamental use of stacks. Implement the stack using
Linked Lists as explained in your notes.
For e.g if a user enters the expression: (((6 + 9) / 3) * (6 � 4))
The result should be 10.
Your program should be properly documented and well structured. Specifications should be
clearly written in your logbook for all the methods, constructors, and classes that you implement
in the following format:
Class / Method/ Constructor name explaining what it does
Parameters
Preconditions
Postconditions
Throws
Now, i ve come up with the following code:
import java.util.EmptyStackException;
class StackNode {
private static Object data;
private StackNode link;
private static StackNode head;
private int totalnodes;
// the constructors
public StackNode(Object obj, StackNode lk)
data = obj;
link = lk;
public StackNode()
head = null;
totalnodes = 0;
// the push method
public void push(Object obj)
head = new StackNode(obj, head);
totalnodes++;
// the pop method
public Object pop()
Object answer;
if(head == null)
throw new EmptyStackException();
answer = head.getData();
head = head.getLink();
totalnodes--;
return answer;
// the isEmpty method
public boolean isEmpty()
return (head == null);
// get data
public Object getData()
return data;
// get link
public StackNode getLink()
return link;
// size or length method
public int size()
return totalnodes;
public static void main (String args [])
int i;
StackNode number = new StackNode();
StackNode operator = new StackNode();
head = new StackNode(data, head);
number.push(new Integer(9));
number.push(new Integer(6));
operator.push(new Character('+'));
and i dont know how to store numbers into the stack and how to use the operations such as addition substraction division and multiply...
any ideas how to do that??
cheers....This doesn't use a stack but the concept is the same:
import java.util.*;
public class formula {
public int aValue = 1;
public int bValue = 2;
public int cValue = 3;
public formula() {
//StringTokenizer st = new StringTokenizer("a + b/c", " abc()+-*/", true);
//while (st.hasMoreTokens()) { System.out.println(st.nextToken()); }
StringTokenizer st2 = new StringTokenizer("a + (c - b) + (b * c)", " abc()+-*/", true);
int operand1 = 0;
int operand2 = 0;
int operator = 0;
//flag: first operand has a value
boolean firstOperandFull = false;
//flag: second operand has a value
boolean secondOperandFull = false;
//flag: tokens are between parens
boolean inParens = false;
Vector inParensVector = null;
MAINLOOP:
while (st2.hasMoreTokens()) {
String x = st2.nextToken();
//if token is a blank skip it.
if (x.equals(" ")) { continue MAINLOOP; }
System.out.println(x);
//if token is open parens set flag and skip to next token
if (x.equals("(")) { inParens = true; inParensVector = new Vector(); continue MAINLOOP; }
//if tokn is close parens, retrieve the value from between the parens and reset flag.
if (x.equals(")")) { if (! firstOperandFull) { operand1 = doInParens(inParensVector); firstOperandFull = true; }
else { operand2 = doInParens(inParensVector); secondOperandFull = true; }
inParensVector = null; inParens = false; }
//if token is open parens store all tokens until close else process the token
if (inParens) { inParensVector.add(x); }
else {
//if token is a variable put correct value in operand
if (x.equals("a")) { if (! firstOperandFull) { operand1 = aValue; firstOperandFull = true; }
else { operand2 = aValue; secondOperandFull = true; } }
if (x.equals("b")) { if (! firstOperandFull) { operand1 = bValue; firstOperandFull = true; }
else { operand2 = bValue; secondOperandFull = true; } }
if (x.equals("c")) { if (! firstOperandFull) { operand1 = cValue; firstOperandFull = true; }
else { operand2 = cValue; secondOperandFull = true; } }
//if token is a operator store the operation
if (x.equals("+")) { if (firstOperandFull) { operator = 1; } }
if (x.equals("-")) { if (firstOperandFull) { operator = 2; } }
if (x.equals("*")) { if (firstOperandFull) { operator = 3; } }
if (x.equals("/")) { if (firstOperandFull) { operator = 4; } }
System.out.println("operand1 = " + operand1 + " operand2 = " + operand2 + " operator = " + operator);
//if second operand has a value perform the operation.
if (secondOperandFull) {
switch (operator) {
case 1 : operand1 = add(operand1, operand2); secondOperandFull = false; break;
case 2 : operand1 = subtract(operand1, operand2); secondOperandFull = false; break;
case 3 : operand1 = multiply(operand1, operand2); secondOperandFull = false; break;
case 4 : operand1 = divide(operand1, operand2); secondOperandFull = false; break;
}//end switch
} //end if
} //End inParens else
} //End while
System.out.println("answer = " + operand1);
public static void main(String[] args) { //formula f = new formula();
Vector v = new Vector();
StringTokenizer st = new StringTokenizer(",Greg,,Paul,,", ",", true);
String token = null;
String lastToken = " ";
boolean firstToken = true;
while (st.hasMoreTokens()) {
token = st.nextToken();
if (firstToken) { if (token.equals(",")) { v.add("X"); }
firstToken = false; }
if (! token.equals(",")) { v.add(token); }
else { if (lastToken.equals(",")) { v.add("X"); } }
lastToken = token;
} //End While
if (token.equals(",")) { v.add("X"); }
Enumeration tokens = v.elements();
while (tokens.hasMoreElements()) {
System.out.println((String)tokens.nextElement()); }
} //End Main
public int add(int operand1, int operand2) { return operand1 + operand2; }
public int subtract(int operand1, int operand2) { return operand1 - operand2; }
public int divide(int operand1, int operand2) { return operand1 / operand2; }
public int multiply(int operand1, int operand2) { return operand1 * operand2; }
public int doInParens(Vector inParensVector) {
int operand1 = 0;
int operand2 = 0;
int operator = 0;
boolean firstOperandFull = false;
boolean secondOperandFull = false;
Enumeration tokens = inParensVector.elements();
INPARENSLOOP:
while (tokens.hasMoreElements()) {
String x = (String)tokens.nextElement();
//if token is a blank skip it.
if (x.equals(" ")) { continue INPARENSLOOP; }
System.out.println("inparens : " + x);
//if token is a variable put correct value in operand
if (x.equals("a")) { if (! firstOperandFull) { operand1 = aValue; firstOperandFull = true; }
else { operand2 = aValue; secondOperandFull = true; } }
if (x.equals("b")) { if (! firstOperandFull) { operand1 = bValue; firstOperandFull = true; }
else { operand2 = bValue; secondOperandFull = true; } }
if (x.equals("c")) { if (! firstOperandFull) { operand1 = cValue; firstOperandFull = true; }
else { operand2 = cValue; secondOperandFull = true; } }
//if token is a operator store the operation
if (x.equals("+")) { if (firstOperandFull) { operator = 1; } }
if (x.equals("-")) { if (firstOperandFull) { operator = 2; } }
if (x.equals("*")) { if (firstOperandFull) { operator = 3; } }
if (x.equals("/")) { if (firstOperandFull) { operator = 4; } }
System.out.println("Inparens : operand1 = " + operand1 + " operand2 = " + operand2 + " operator = " + operator);
if (secondOperandFull) {
switch (operator) {
case 1 : operand1 = add(operand1, operand2); secondOperandFull = false; break;
case 2 : operand1 = subtract(operand1, operand2); secondOperandFull = false; break;
case 3 : operand1 = multiply(operand1, operand2); secondOperandFull = false; break;
case 4 : operand1 = divide(operand1, operand2); secondOperandFull = false; break;
}//end switch
} //end if
} //End while
System.out.println("Inparens return = " + operand1);
return operand1;
}//End doInParens
}//End Class -
How to store multiple files from SAp in to Application server?
Hi Guys,
Can anybody tell me how to store multiple files from SAP into Application server.in my application i have to get the data from SAP tables BSEG , BKPF , BSAK and BSIK that to daily i have to do.
Any Logic or Code for how to do is welcomed.
plz help me urgently.
Thanks,
GopiHi,
directories creates basis. If you have task to store data in application server you already should have information into which folder you have to do it. If you don't have this information because it is just for example training for next task then you can use your personal folder into which you have access. To get list of all available folders please look at attached code and form get_directories (you get the list of folders you see in transaction AL11). But don't forget: If you are using open dataset you have to have rights to access application folder!
Here you are code which I use to upload text files from local disc into application folder
Regards,
Karol
*& Report FILE_PC_TO_SAP
REPORT FILE_PC_TO_SAP.
DATA: BEGIN OF searchpoints OCCURS 100,
DIRNAME(200) TYPE c, " name of directory.
sp_name(100) TYPE c," name of entry. (may end with *)
END OF searchpoints.
DATA: BEGIN OF isearchpoints OCCURS 10,
dirname(75) TYPE c, " name of directory.
aliass(75) TYPE c, " alias for directory.
svrname(75) TYPE c, " svr where directory is availabl
sp_name(75) TYPE c, " name of entry. (may end with *)
sp_cs(10) TYPE c, " ContainsString pattern for name
END OF isearchpoints.
data: l_file type filetable.
data: l_rc type i.
data: itab type TABLE OF string.
data: g_tmp_file_path type rlgrap-filename.
data: wa_itab type string.
data: h_destin(100) type c.
data: dat type string.
INITIALIZATION.
perform get_directories.
START-OF-SELECTION.
parameters: in_file type string OBLIGATORY LOWER CASE.
parameters: destin(100) type c OBLIGATORY LOWER CASE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = in_file
"FILETYPE = 'BIN'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
TABLES
DATA_TAB = itab
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17.
IF sy-SUBRC <> 0.
write: / 'Error during loading input file!'.
ENDIF.
if h_destin is INITIAL.
h_destin = in_file.
endif.
CONCATENATE destin h_destin into dat SEPARATED BY '/'.
*TRANSLATE dat TO UPPER CASE.
OPEN DATASET dat FOR OUTPUT IN TEXT MODE ENCODING DEFAULT.
IF sy-SUBRC = 0.
loop at itab into wa_itab.
TRANSFER: wa_itab TO dat.
endloop.
CLOSE DATASET dat.
write: / 'File uploaded!'.
ELSE.
write: / 'Not possible to open dataset'.
ENDIF.
at selection-screen on value-request for in_file.
perform select_input_file_name.
loop at l_file into g_tmp_file_path.
move g_tmp_file_path to in_file.
h_destin = ''.
SPLIT g_tmp_file_path at '\' into table itab.
loop at itab into g_tmp_file_path.
h_destin = g_tmp_file_path.
endloop.
endloop.
at selection-screen on value-request for destin.
DATA: lt_dfies TYPE TABLE OF dfies.
DATA: lwa_dfies TYPE dfies.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = '/BI0/PCO_AREA'
lfieldname = 'CO_AREA'
IMPORTING
dfies_wa = lwa_dfies.
lwa_dfies-tabname = 'searchpoints'.
lwa_dfies-REPTEXT = 'Destination directory'.
lwa_dfies-LENG = 100.
lwa_dfies-INTLEN = 100.
lwa_dfies-OUTPUTLEN = 100.
lwa_dfies-fieldname = 'SP_NAME'.
APPEND lwa_dfies TO lt_dfies.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
RETFIELD = 'SP_NAME'
DYNPPROG = SY-REPID
DYNPNR = SY-DYNNR
DYNPROFIELD = 'destin'
VALUE_ORG = 'S'
TABLES
VALUE_TAB = searchpoints
FIELD_TAB = lt_dfies
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3.
*& Form select_input_file_name
* text
form select_input_file_name.
* call function 'F4_FILENAME'
* exporting
* program_name = sy-repid
* dynpro_number = sy-dynnr
* field_name = 'PATH'
* importing
* file_name = g_tmp_file_path.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = 'Please choose a file'
"default_extension = '*.TXT'
"default_filename = 'C:\*.txt'
initial_directory = 'C:\'
file_filter = '*.*'
CHANGING
FILE_TABLE = l_file
RC = l_RC
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 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.
endform. "select_input_file_name
*& Form WRITE_DB_HOME
* Write DB home directory
* no parameters
FORM write_db_home.
CASE sy-dbsys(3).
WHEN 'ORA'.
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_ORAHOME'
ID 'VALUE' FIELD searchpoints-dirname.
*--- C5056155 Start of ALV -------------------------------*
* PERFORM flip_flop(rsora000) USING cflag.
* WRITE: / 'DIR_ORAHOME', 30 searchpoints-dirname.
MOVE: 'DIR_ORAHOME' TO searchpoints-sp_name.
APPEND searchpoints.
*--- C5056155 End of ALV -------------------------------*
WHEN 'ADA'.
CALL 'C_GETENV' ID 'NAME' FIELD 'DBROOT'
ID 'VALUE' FIELD searchpoints-dirname.
*--- C5056155 Start of ALV -------------------------------*
* PERFORM flip_flop(rsora000) USING cflag.
* WRITE: / 'DIR_ADA_DBROOT', 30 searchpoints-dirname.
MOVE: 'DIR_ADA_DBROOT' TO searchpoints-sp_name.
APPEND searchpoints.
*--- C5056155 End of ALV -------------------------------*
WHEN 'INF'.
CALL 'C_GETENV' ID 'NAME' FIELD 'INFORMIXDIR'
ID 'VALUE' FIELD searchpoints-dirname.
*--- C5056155 Start of ALV -------------------------------*
* PERFORM flip_flop(rsora000) USING cflag.
* WRITE: / 'DIR_INF_INFORMIXDIR', 30 searchpoints-dirname.
MOVE: 'DIR_INF_INFORMIXDIR' TO searchpoints-sp_name.
APPEND searchpoints..
*--- C5056155 End of ALV -------------------------------*
WHEN 'DB6'.
CALL 'C_GETENV' ID 'NAME' FIELD 'INSTHOME'
ID 'VALUE' FIELD searchpoints-dirname.
IF sy-subrc = 0.
*--- C5056155 Start of ALV -------------------------------*
* PERFORM flip_flop(rsora000) USING cflag.
* WRITE: / 'DIR_DB2_HOME', 30 searchpoints-dirname.
MOVE: 'DIR_DB2_HOME' TO searchpoints-sp_name.
APPEND searchpoints.
*--- C5056155 End of ALV -------------------------------*
ELSE.
EXIT.
ENDIF.
WHEN OTHERS.
EXIT.
ENDCASE.
ENDFORM. " WRITE_DB_HOME
FORM get_directories.
* get the name and aliases of ALL userdefined directories
SELECT * FROM user_dir INTO isearchpoints
WHERE svrname = sy-uname.
MOVE isearchpoints-dirname to searchpoints-dirname.
MOVE isearchpoints-aliass to searchpoints-sp_name.
APPEND searchpoints.
ENDSELECT.
SELECT * FROM user_dir INTO isearchpoints
WHERE svrname = 'all'.
MOVE isearchpoints-dirname to searchpoints-dirname.
MOVE isearchpoints-aliass to searchpoints-sp_name.
APPEND searchpoints.
ENDSELECT.
* Get DB home
IF sy-dbsys(3) = 'ADA'.
PERFORM write_db_home.
ENDIF.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_ATRA'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_ATRA' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_BINARY'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_BINARY' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory $DIR_CCMS
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_CCMS'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_CCMS' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_CT_LOGGING'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_CT_LOGGING' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_CT_RUN'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_CT_RUN' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_DATA'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_DATA' TO searchpoints-sp_name.
APPEND searchpoints.
* Get DB home
IF sy-dbsys(3) = 'DB6'.
PERFORM write_db_home.
ENDIF.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_DBMS'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_DBMS' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_EXECUTABLE'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_EXECUTABLE' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_EXE_ROOT'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_EXE_ROOT' TO searchpoints-sp_name.
APPEND searchpoints.
*get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_GEN'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_GEN' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_GEN_ROOT'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_GEN_ROOT' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_GLOBAL'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_GLOBAL' TO searchpoints-sp_name.
APPEND searchpoints.
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_GRAPH_EXE'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_GRAPH_EXE' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_GRAPH_LIB'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_GRAPH_LIB' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_HOME'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_HOME' TO searchpoints-sp_name.
APPEND searchpoints.
* Get DB home
IF sy-dbsys(3) = 'INF'.
PERFORM write_db_home.
ENDIF.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_INSTALL'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_INSTALL' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_INSTANCE'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_INSTANCE' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_LIBRARY'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_LIBRARY' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_LOGGING'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_LOGGING' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the files written by the memory inspector
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_MEMORY_INSPECTOR'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_MEMORY_INSPECTOR' TO searchpoints-sp_name.
APPEND searchpoints.
* Get DB home
IF sy-dbsys(3) = 'ORA'.
PERFORM write_db_home.
ENDIF.
*get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_PAGING'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_PAGING' TO searchpoints-sp_name.
APPEND searchpoints.
*get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_PUT'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_PUT' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_PERF'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_PERF' TO searchpoints-sp_name.
APPEND searchpoints.
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_PROFILE'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_PROFILE' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_PROTOKOLLS'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_PROTOKOLLS' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_REORG'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_REORG' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_ROLL'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_ROLL' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_RSYN'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_RSYN' TO searchpoints-sp_name.
APPEND searchpoints.
* calculate directory for saphostagent (no sapparam available...)
IF ( sy-opsys(3) = 'WIN' ) OR ( sy-opsys(3) = 'Win' ).
DATA: windir_path(64), programfiles_path(64).
* hoping that ProgramFiles is set in service user environment
CALL 'C_GETENV' ID 'NAME' FIELD 'ProgramFiles'
ID 'VALUE' FIELD programfiles_path.
IF programfiles_path IS INITIAL.
* %ProgramFiles% not available. guess from windir
CALL 'C_GETENV' ID 'NAME' FIELD 'windir'
ID 'VALUE' FIELD windir_path.
* e.g. S:\WINDOWS ==> S:\Program Files
CONCATENATE windir_path(3) 'Program Files' INTO programfiles_path.
ENDIF.
CONCATENATE programfiles_path '\SAP\hostctrl'
INTO searchpoints-dirname.
ELSE.
* on UNIX, the path is hard coded
searchpoints-dirname = '/usr/sap/hostctrl'.
ENDIF.
MOVE: 'DIR_SAPHOSTAGENT' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_SAPUSERS'
ID 'VALUE' FIELD searchpoints-dirname.
IF searchpoints-dirname = '.'.
IF sy-opsys = 'Windows NT'.
searchpoints-dirname = '.\'.
ELSE.
searchpoints-dirname = './'.
ENDIF.
ENDIF.
MOVE: 'DIR_SAPUSERS' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_SETUPS'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_SETUPS' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_SORTTMP'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_SORTTMP' TO searchpoints-sp_name.
APPEND searchpoints.
*get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_SOURCE'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_SOURCE' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_TEMP'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_TEMP' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_TRANS'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_TRANS' TO searchpoints-sp_name.
APPEND searchpoints.
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_TRFILES'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_TRFILES' TO searchpoints-sp_name.
APPEND searchpoints.
* get name of directory with the error files
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'DIR_TRSUB'
ID 'VALUE' FIELD searchpoints-dirname.
MOVE: 'DIR_TRSUB' TO searchpoints-sp_name.
APPEND searchpoints.
* get the name of the current server.
CALL 'C_SAPGPARAM' ID 'NAME' FIELD 'rdisp/myname'
ID 'VALUE' FIELD searchpoints-dirname.
data: h_ind type i.
LOOP AT searchpoints.
h_ind = sy-tabix.
IF searchpoints-sp_name IS INITIAL.
DELETE searchpoints INDEX h_ind.
ENDIF.
ENDLOOP.
ENDFORM. -
How to store text field data from web dynpro application in pcd ?
Hi Forum,
I am new to web Dynpro.
I want to store user specific data (a text field value) from a wd application in PCD and access it every time the user runs the application.How can I achieve this?
Thanks,
Mickey.Hi
I created the "read" and "update" methods in my application service. How can I call them? I created and implemented the methods just like here: https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/340fc0ea-0c01-0010-74bf-965b11031e77
Operations:
- readMyEntityService:
- updateMyEntityService
Implementation:
retValue = getMyEntityService().read(key);
getMyEntityService().update(dS0);
In Web Dynpro there is this update method with the code above (in my original post).
How can I call the update-method????????
Kind regards
Bettina
Maybe you are looking for
-
Clear from Vendor open line item (FBL1N).
Dear, I have Posted the Invoice and cancelled the same invoice which was in the Blocked status without Release.So its showing in Vendor open line item (FBL1N). Now we can not release these two docs in MRBR bcz the invoice was cancelled and also it ca
-
Flat file as a source in a mapping
Dear all i noticed that when you create a mapping with a Flat File Operator as a source, the OWB generates SQL* Loader code instead of PL/SQL package. Is there any parameter you have to change in order to generate PL/SQL code or, if not how can you c
-
Some time back I clicked on a video on FaceBook. It kept repeating. I got tired of it and clicked on something on FB that stopped it. Since then Firefox does not play vids. For example http://senateconservatives.com/site/post/1160/video-new-scf-ad-pr
-
Reformat internal w/o install disc?
Is there any possible way to reformat/erase an internal hard drive on a Macbook without the install CD?
-
Lightroom freezing at splash screen
Power Mac G5 Number Of CPUs:2 2 GHz L2 Cache (per CPU):512 KB Memory:3 GB Bus Speed:1 GHz OS X10.4.9 Hi all, I have been running LR as a beta for a year - installed full program since it was available. Really happy - running great. Installed Indesign