08-07-2007 12:34 PM
hi,
i need to get the last 4 chars of the string with that i have to compare.
or..
in bdc i have to upload the data from flat file that may be .txt / .xls.. which FM we have to use for to upload.
any suggestions .. pl..
08-07-2007 12:47 PM
Hi,
try this:
DATA: STR TYPE STRING VALUE 'testfrom2007'.
DATA: CSTR(4).
DATA: STRL TYPE I.
*
STRL = STRLEN( STR ).
IF STRL > 4.
STRL = STRL - 4.
CSTR = STR+STRL(4).
ELSE.
CSTR = STR.
ENDIF.
*
WRITE: CSTR.
regards, Dieter
08-07-2007 12:41 PM
get the string length first using strlen function
then use offset method
08-07-2007 12:42 PM
use
<b>gui_upload</b> to upload data from .txt/.xls files.
regards,
srinivas
<b>*reward for useful answers*</b>
08-07-2007 12:44 PM
Hi,
length = strlen( my_char ).
position = length - 4.
result = mychar+position.
Regards,
Mathieu
08-07-2007 12:44 PM
Hi,
1.
int_var = strlen( tbl-fld ).
int_var1 = int_var - 4.
result_txt = tbl-fld+int_var1(int_var).
2.
use FM GUI_UPLOAD.
Jogdand M B
08-07-2007 12:45 PM
Welcome to SDN.
to get last four character.
st1 = strlen( str2 ).
str1 = str1 - 4.
str3 = str2+str1(4).
Regards,
Amit
Reward all helpful replies
08-07-2007 12:47 PM
Hi,
try this:
DATA: STR TYPE STRING VALUE 'testfrom2007'.
DATA: CSTR(4).
DATA: STRL TYPE I.
*
STRL = STRLEN( STR ).
IF STRL > 4.
STRL = STRL - 4.
CSTR = STR+STRL(4).
ELSE.
CSTR = STR.
ENDIF.
*
WRITE: CSTR.
regards, Dieter
08-07-2007 12:49 PM
Hi Satish,
To find the last 4 digits, try this code.
DATA: len TYPE i,
str(10) TYPE c VALUE 'abcdefghij',
substr TYPE string.
len = STRLEN( str ) - 4.
substr = str+len(4).
WRITE: / substr.
And regarding the file uploading, if you want to upload file fro the GUI Server, you can use the function module
GUI_UPLOAD
.
And if you want to upload from Application server, you can use
OPEN DATASET, READ DATASET
...
Plz reward points if useful...
Regards,
Bijesh
08-07-2007 12:49 PM
Hi Satish,
DATA: V_STRING TYPE STRING,
V_LASTFOUR TYPE STRING,
V_LENGTH TYPE N.
V_LENGTH = STRLEN (V_STRING) - 4.
V_LASTFOUR = V_STRING + V_LENGTH(4)
You can use the FM 'GUI_UPLOAD' if you have the file (.txt) from the presentation server.
Please award points if helpful.
Regards,
Suhas