2009 Jun 16 4:37 AM
Hi,
Please help hows the coding if i want to filter a character within a table?
e.g ABC123ED - i want to get 23ED
Thanks,
PAUL
Hi,
Please help hows the coding if i want to filter a character within a table?
e.g ABC123ED - i want to get 23ED
Thanks,
PAUL
2009 Jun 16 4:45 AM
Hi, Pwaren
Please Test the following Sample Code i think you need some thing like this.
TYPES: BEGIN OF ty,
char(20),
END OF ty.
DATA: it TYPE STANDARD TABLE OF ty WITH HEADER LINE.
it-char = '123ABC'. APPEND it. it-char = '123ABCD'. APPEND it. it-char = 'ABCD123'. APPEND it.
LOOP AT it.
IF it-char CS '3ABC'.
WRITE: / it-char.
ENDIF.
ENDLOOP.Please Reply if else Requirement,
Best Regards,
Faisal
2009 Jun 16 4:46 AM
>
> e.g ABC123ED - i want to get 23ED
Whats the logic behind this, you always what to get the last 4 characters or what?
Tell the requirement clearly.
Regards
Karthik D
2009 Jun 16 8:46 AM
Hi,
Yeah, i want to get the last 4 characters from the string from a certain tables.
PAUL
2009 Jun 16 9:07 AM
Here is more clear details.
e.g
Table: KNNK-KUNNR
KUNNR field got this values:
-ADW12GE
-NHG56TG
-NH67HG5
-U6T7F65
i only want to get the last for charaters.
Thanks in advance
PAUL
2009 Jun 16 9:16 AM
calculate the length of ur strings every time
len = strlen(kunnr).
offset = len - 4.
kunnr = kunnr+offset(4).
2009 Jun 16 9:38 AM
Hi PwarrenP,
To get the last 4 chars always you can try like this...
first pass your value to get a leading zero and fill all the chars & try to take last 4 with the offset.
DATA : BEGIN OF ITAB OCCURS 0,
CHAR(20),
END OF ITAB.
DATA : LEN(2) TYPE C.
DATA : CNT(2) TYPE C.
ITAB-CHAR = 'ASFH'.
APPEND ITAB.
ITAB-CHAR = '12C4SSFA'.
APPEND ITAB.
ITAB-CHAR = '12CSFD4SA'.
APPEND ITAB.
ITAB-CHAR = '1SDFA2C4SA'.
APPEND ITAB.
ITAB-CHAR = '12C4SAA'.
APPEND ITAB.
ITAB-CHAR = '12C4SAFSD'.
APPEND ITAB.
LOOP AT ITAB.
CLEAR : LEN.
LEN = STRLEN( ITAB-CHAR ).
CNT = LEN - 4.
WRITE : / ITAB-CHAR+CNT(4).
ENDLOOP.
Thanks & regards,
Dileep .C
That was a bit late PAUL....
By the way what was your solution...!
Edited by: Dileep Kumar Chinnaiah on Jun 16, 2009 4:39 PM
2009 Jun 16 4:46 AM
2009 Jun 16 4:50 AM
2009 Jun 16 9:25 AM
hi
you can used this code for it
data : text(8),
text2(4).
text = ' ABC123ED'.
text2 = text+3(4).
regard
nawa
2009 Jun 16 9:34 AM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |