Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

help me pls.

Former Member
0 Likes
1,431

i wanted to compare a character in a field and then if it is true, string is remove and remaining character is diplayed

ex.

table: DATA.

data in the fields are:

INVOICE 123

INV 758

INVOICE NO golath

now i wanted to display only:

123

758

golath

hows that? good points for all whos willing to help

1 ACCEPTED SOLUTION
Read only

Nawanandana
Active Contributor
0 Likes
1,399

hai

u can do it like this

DATA : V_CHAR1(15) VALUE ' INVOICE 123 ' ,

V_CHAR2(15) VALUE ' INV 758 ' ,

V_CHAR3(25) VALUE ' INVOICE NO golath ' .

SHIFT V_CHAR1 BY 8 PLACES.

SHIFT V_CHAR2 BY 4 PLACES.

SHIFT V_CHAR3 BY 11 PLACES.

write : V_CHAR1 , V_CHAR2 , V_CHAR3.

regard

nawa

13 REPLIES 13
Read only

Former Member
0 Likes
1,399

try to use SPLIT command

Read only

0 Likes
1,399

not really good in ABAP prog can you be more specific

take not in doing this in query infoset SQ02

Read only

Former Member
0 Likes
1,399

Hi,

Please clarify whether you wanted to have the last word of the field content - please be specific; so that I can help you to build the logic.

Regards,

KKG

Read only

0 Likes
1,399

example 3 datas in field A:

INVOICE 999

INV G L A S S

INVOICE NO FC-9900

ouput data should be:

<b>999

G L A S S

FC-9900</b>

there might be other combination so i posted some..

please do ask if you still cant understand.

thanks!

Read only

0 Likes
1,399

search INVOICE for field name

if sy-subrc <> 0.

search INV for field name.

if sy-subrc = 0.

find strlen.. and then use offset concept..

Read only

Nawanandana
Active Contributor
0 Likes
1,400

hai

u can do it like this

DATA : V_CHAR1(15) VALUE ' INVOICE 123 ' ,

V_CHAR2(15) VALUE ' INV 758 ' ,

V_CHAR3(25) VALUE ' INVOICE NO golath ' .

SHIFT V_CHAR1 BY 8 PLACES.

SHIFT V_CHAR2 BY 4 PLACES.

SHIFT V_CHAR3 BY 11 PLACES.

write : V_CHAR1 , V_CHAR2 , V_CHAR3.

regard

nawa

Read only

0 Likes
1,399

hello nawanandana,

all data will be extracted from a field

another example: INVOICE 123

INVOICE 123 (this data is from a field not going to declare)

how to remove the "INVOICE" and then ouput 123 only?

Read only

0 Likes
1,399

if we move a character field to a numeric field, character values are ignored and only numeric values are considered.

try this

data:

w_char(15) value 'INVOICE 123',

w_num(15) type n.

w_num = w_char.

write:

w_num.

Read only

0 Likes
1,399

hello Rajesh,

thanks for the reply!

wat i mean is how can i remove a character in a field and then display its remaining characters regardless if its numeric or character

Read only

0 Likes
1,399

Check this code

data:

w_char(30) value 'INVOIcE 123 INVOICE 4312',

w_num(30) type n,

w_value(30),

w_index TYPE sy-index.

w_num = strlen( w_char ).

do w_num times.

w_index = sy-index - 1.

TRANSLATE w_char+w_index(1) TO UPPER CASE.

if w_char+w_index(1) NA sy-abcde.

concatenate w_value w_char+w_index(1)

into w_value.

endif.

enddo.

write:

w_value.

Read only

Former Member
0 Likes
1,399

data in the FIELD_A: INVOICE 123, INVOICE 143, 456

if FIELD_A has "INVOICE" then delete and display remaining

output should be:

123

143

456

how to do this in code?

Read only

0 Likes
1,399

Hi,

Try this,

PARAMETER : FIELD_A(20) TYPE C.

IF FIELD_A CA 'INVOICE'.

TRANSLATE FIELD_A USING 'I N V O I C E '.

CONDENSE FIELD_A NO-GAPS.

ENDIF.

WRITE : FIELD_A.

Regards,

Padmam.

Read only

Former Member
0 Likes
1,399

I already knew the answer.

Thank you for all your ideas!:)