Check a convertion from CHAR TO NUMC
Hi,
I import a flatfile into a structure that contains only CHAR-fields. Then I make a TRY-CATCH construct for every field in P,I,F,N..-datatypes to check if the data is correct.
P,I,F raise a CONVERT-Exception that i can handle.
A move to N-field raise no exception but put a wrong values to the N-field.
Example:
Charfield contains ' 1 1 0000', N-field is '110000'.
A compare in the program like
IF C-Field <> N-Field raise a exception that can't be catched by TRY-Catch.
How can i check if the field is correct?
Anybody understand me and have an idea?
Regards,
Stefan
Hi Christian and Rich,
thank you for your fast reply.
I've written one TRY method that has a import-parameter with TYPE ANY and a import-parameter for the target field.
The target field can be everything like P,I,F,N,C,D.
The method checks if the value can be converted into the target field and avoid a shortdump, when the flatfile contains bad data.
So I have to get the type by
cl_abap_typedescr=>describe_by_data
and then make your suggested Conatins-only-check if it is a
cl_abap_typedescr=>typekind_num
Thanks,
Stefan
Similar Messages
-
Convert from char* to unsigned char*
Hi, I try compile example from: http://download-uk.oracle.com/docs/cd/B19306_01/appdev.102/b14294/relational.htm#i1000940
in Visual C++ and I have problem with:
const string userName = "SCOTT";
because string is defined as unsigned char* and "SCOTT" is char*, is any function to convert from type char* to type unsigned char* ?I'm apologize for this stupid question, answer is very easy:
const string userName = (const unsigned char*) "SCOTT"; -
Hi Experts,
I have a requirement to convert char type to Hex type.
I have two structures. one is Character type and other is hex type like below.
data: v_hex(300) type h,
v_char(300) type c.
When we move v_char(300) to v_char(300), it is working fine in 4.6 system.
But it is giving unicode error in ECC 6.0. So i have changed the statement to v_hex = v_char.
There is no syntax error but it is not converting the same.
Please post your replies. Thanks in advance.REPORT ZSRK_039 .
DATA: V_HEX(300) TYPE X,
V_CHAR(300) TYPE C.
V_CHAR = 'Test'.
PERFORM CHAR_TO_HEX_CONV USING V_CHAR
CHANGING V_HEX.
WRITE : / V_HEX.
*& Form CHAR_TO_HEX_CONV
text
-->P_V_CHAR text
<--P_V_HEX text
FORM CHAR_TO_HEX_CONV USING CH TYPE C
CHANGING CH1 TYPE X.
FIELD-SYMBOLS : <FS_TR> TYPE X.
ASSIGN CH TO <FS_TR> CASTING TYPE X .
CH1 = <FS_TR>.
ENDFORM. " CHAR_TO_HEX_CONV -
Hi Experts ,
i am working in Upgradation project. In one of the program i came across Moving Char value to Hexa value. More over , the char( CHAR(1) ) value is passing dynamically to Hex.
Is there any function module to solve this issue. i got CHAR_HEX_CONVERSION but it is not working.
Thank you.
Regards,
Kiran.Hello,
Does the method CONVERT of class CL_ABAP_CONV_IN_CE help ?
A few links which might interest you :
[Conversion xstring to string|Conversion xstring to string]
[http://help.sap.com/saphelp_nw70/helpdata/en/ba/78d3c747b24546ab1c1499a054d8a5/content.htm|http://help.sap.com/saphelp_nw70/helpdata/en/ba/78d3c747b24546ab1c1499a054d8a5/content.htm]
BR,
Suhas
Edited by: Suhas Saha on Jan 21, 2010 5:41 PM -
hey
I've an input string ("1234")
What i need to do is to fill a matrix 2*2 with the input string.
I thought about running over the string, and by str.charAt(ind) to get a needed charters, but the question is ho do i convert charAt result to int?
tanxigalep132 wrote:
hey
I've an input string ("1234")
What i need to do is to fill a matrix 2*2 with the input string.
I thought about running over the string, and by str.charAt(ind) to get a needed charters, but the question is ho do i convert charAt result to int?
tanxThat's kinda vague. Do you mean convert '1' into the integer value 1 or convert '1' into the ASCII integer value of 49?
Here's how to do the first:
String one = "8";
String two = "3";
String numbers = "0123456789";
int oneInt = numbers.indexOf(one);
int twoInt = numbers.indexOf(two);
System.out.println("oneInt = " + oneInt);
System.out.println("twoInt = " + twoInt);If you meant the latter then ...
char c = 'c';
int cInt = (int)c; -
Need you help !!! -- Convertion from Char to Date
Dear experts:
I am new to abap and here is one thing need your help:
Currently I have a char type field defined in the source table, after I retrive this field into my work area, I need to convert it to Date type and then calculate the last day of this date.
for example: WA_TEST-CHAR = '20100801'. This value in orignal ECC table is char type.
Then How can I convert this value to a date type, and calculate its last day?
My expected result is "20100731".
BTW, does anybody know how to convert a date type field to a number type field like To_number() or something?. If I need to get the period between 2 different date, how can I get this?
Any post will be appreciate and thank you all in advance!
Best Regards
Tim
Moderator message: sorry, date conversion and date calculation are very basic and FAQs, please search for available answers, also read ABAP online documentation.
locked by: Thomas Zloch on Aug 23, 2010 9:56 AMHi,
For your question:
BTW, does anybody know how to convert a date type field to a number type field like To_number() or something?. If I need to get the period between 2 different date, how can I get this?
use this FM FIMA_DAYS_AND_MONTHS_AND_YEARS.
regards, -
Hello,
Please tell me how we can change a character to ASCII foormat.
Points will definitltely be given to the useful answers.
thanks.Hi,
Check following link:
[http://www.sap-img.com/abap/how-can-i-get-ascii-value-of-any-letter.htm]
or
Check function module:
SCP_TRANSLATE_CHARS
Regards,
Harsh. -
HI all,
I have to convert a char255 to raw255. Is there any methods/function module that can do this.
Regards
RavishHi,
try this FM
Unicode - Konvertierung SOLI in SOLIX
CALL FUNCTION 'SO_SOLITAB_TO_SOLIXTAB'
EXPORTING
ip_solitab = gt_compressed_list[]
IMPORTING
ep_solixtab = gt_pdf_hex[].
Regards -
Convert from char to ASCII code
anyone can advice me on this program why the conversion cannot be done? Thank in advance.
String charInput = JOptionPane.showInputDialog (null, "Enter a character", "Finding ASCII code", JOptionPane.QUESTION_MESSAGE) ;
answer = Integer.parseInt (charInput) ;Try this code out:
import javax.swing.JOptionPane;
public class Crap {
public static void main (String[] args) {
String charInput =
JOptionPane.showInputDialog (null,
"Enter a character", "Finding ASCII code",
JOptionPane.QUESTION_MESSAGE) ;
JOptionPane.showMessageDialog (null, charInput, "Collected Data",
JOptionPane.INFORMATION_MESSAGE );
// answer = Integer.parseInt (charInput) ; //<-- What datatype?
String answer = "You never declare the data type for you answer.\n" +
"JOptionPane returns a string of what the user enters.\n" +
"The first? The last? Some other position?\n" +
"A String != a character.\n" +
"Which character of the string do you want to convert?\n" +
"You need to do a lot more work on this problem.";
JOptionPane.showMessageDialog (null, answer,
"The Java Compiler hates your code because...",
JOptionPane.OK_OPTION, null);
}http://leepoint.net/notes-java/GUI/containers/20dialogs/10joptionpane.html
Cheers !
JJ -
Infoobj is changed frm Char to NUMC
Hi Gurus,
I have an infoobject which is giving data to another infoobject.
We had a requirement to change the former info object from CHAR to NUMC and removing the ALPHA conversion routine.
Everything went on well in DEV system, I transported it to Q system.
There I faced a problem. The info object is not being activated in Q system. When i saw the problem the SID table CHAR and the info object was NUMC.
I tried to delete the master data which is already there in the info object it was not being deleted. I thought that if i delete the entries of this info object in the infoobject which is getting data from this infoobject, then i tried to delete the entries in the Info object again it is not getting deleted.
Can anyone please help in this situation what I need to do???
Thanks in advance,
Regards,
RajniCheck if the IO is used in some other areas using 'Where Used List' button..
Delete Data from other location if already loaded..and remove the IO.
delete data from IO.. -
I need to knw how to convert a char var to integer or numerical variable. If possible ,dats format.
Reply immhi
if you take a numc data type then you can move the char value to the numc stright.
if it is dats u can do a move char_variable to dats_variable.
regards.
Lakshmikanth. -
Does any one know how to convert from jchar to char?
Thank you,does it have to be a jchar or can you get a jstring? is it possible to convert your jchar into a jstring before you pick it up in jni? if you can get a jstring you can use the function
const char* GetStringUTFChars(jstring str, jboolean *isCopy)
you would get back a character pointer that points to a single char plus the null terminator -
Hi,
How can I convert from an int to char?The challange is to convert from int to String without using any API or automatic conversionWoah, what a challenge ! Why ?
Anyway, what about a recursive call and switch statement. Something likepublic String intToString(int n) {
if(n<0) {
return "-"+intToString(-n);
if(n<10) {
return getStringDigit(n);
else {
return intToString(n/10) + getStringDigit(n%10);
private String getStringDigit(int n) {
switch(n) {
case 0:
return "0";
// etc.
} -
Load failed due to Overflow converting from 853156+16
Hi All,
Load is getting failed from one DSO to another DSO with following error message. and its AP AR load
Runtime error while executing rule -> see long text
Message no. RSTRAN301
Diagnosis
An error occurred while executing a transformation rule:
The exact error message is:
Overflow converting from '8.85315e+16'
The error was triggered at the following point in the program:
Z_BFOD_A_AR_LOOKUP_ITEM_E 278
System Response
Processing the data record has been terminated.
Procedure
The following additional information is included in the higher-level node of
the monitor:
Transformation ID
Data record number of the source record
Number and name of the rule which produced the error
Thanks,
AsimHey,
Ask the developer that wrote the end routine to check the code where the error occurs. First check if too much data is transferred and if it can be reduced. Then also check if the object needs to be extended 460652 - Extending key figures in BW.
Regards,
Michael -
Unable to install iTunes after converting from Windows Vista to Windows 7. Am told installation was successful, then "iTunes was not installed correctly", followed by "Error 7 (Windows error 193). I have my iPod plugged into my computer via USB port. What am I doing wrong?
i have the only account on my laptop so have checked and am the account administrator
i run windows 7 home premium
I have the same problem and
have followed the link uninstalling in the correct order,
then restarted as per instructions,
went to Apple to download itunes,
hit download now,
Visit the iTunes download page. Click Download Now to download the iTunes installer. When prompted, click Save (instead of Run).
did not get a save instead of run prompt
Right click on iTunesSetup or iTunes64Setup (the installer you downloaded in step 3).
If you have Windows Vista, Windows 7, and Windows 8: Choose "Run as administrator."
i can only click run as administrator from right clicking the shortcut on my desktop screen
If iTunes fails to install or repair, it might be necessary to remove components left from a previous installation of iTunes and then reinstall.
sick of doing this
at least 7 or 8 times i have re installed itunes to no avail
troubleshooting no better
please help. pulling my hair out at this stage
it was working fine until 2 days ago when i opened itunes it offered to update to 12.1
not working since i clicked yes
also i have gone to restore previous point and ffs there are no restore points before my multiple reinstalls
really dont want to have to restore factory settings
Maybe you are looking for
-
Touch screen on Iphone slowly, over a few days stopped responding. Went to Genius Bar and was given a new 3GS because they didn't know how to fix the issue. Cool. Went home synced with Macbook Pro (new-12/2010), two days later same issue. This time w
-
Show CSS comments in CSS Style list?
Hi, I've been using Dreamweaver for a numbef of years, but one small feature is forcing me to move away to newer CSS editors. "I need the CSS Style list to show comments from my style sheet". Is this possible? Put simply, some of my CSS stylesheets a
-
I'm pretty new to the Mac and was interested in recording tv shows to the mac and burning them to DVD? I heard about this eyetv - is it simple? What all is entailed for me to do the above? I have the intel-mac and get my tv through antenna. i see the
-
I need to disconnect from business catalyst
A while ago I began working on a website but had to stop because my computer went bad. Bought a new computer and just now installed CS6. Started to work on my website again and find a "Welcome back to Business Catalyst" login that says, "Please log i
-
Setting automatically message type MAHN in POs.
Hi, how can I set automatically the message type in POs so that clicking on "Messages" button will show message type MAHN ? Yours faithfully