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

sy-fdpos

Former Member
0 Likes
3,700

hi gurus......

what is the use of sy-fdpos?

good points will be rewarded

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,470

Hi,

Its useful when you use SEARCH keyword

SEARCH dobj FOR pattern

This statement searches the data object dobj according to the search pattern specified in pattern. The additions allow to search subareas, shortened patterns and marking of places of finding.

The search ends at the first hit and sy-fdpos is set to the offset of the found pattern or to the word in the search area. If the pattern is not found, then sy-fdpos is set to value 0.

Reward if helpful.

Hi,

Its useful when you use SEARCH keyword

SEARCH dobj FOR pattern

This statement searches the data object dobj according to the search pattern specified in pattern. The additions allow to search subareas, shortened patterns and marking of places of finding.

The search ends at the first hit and sy-fdpos is set to the offset of the found pattern or to the word in the search area. If the pattern is not found, then sy-fdpos is set to value 0.

Reward if helpful.

9 REPLIES 9
Read only

prasanth_kasturi
Active Contributor
0 Likes
2,470

hi

check the below example

its offset position of the character

if we wnat to change the increment character for example 25 times we use the

data:letter type string value 'A'.

IF sy-abcde CA letter.

sy-fdpos = sy-fdpos + 25 .

letter = sy-abcde+sy-fdpos(1).

ENDIF.

write:/ letter.

regards

prasanth

Read only

Former Member
0 Likes
2,470

Hi,

sy-fdpos details : FDPOS -INT4- 10 -Character strings -Offset incharacter strings.

This will take first two character s of string a.

DATA: f1(5) TYPE c VALUE <f1>,

f2(5) TYPE c VALUE <f2>.

IF f1 <operator> f2.

WRITE: / 'Vergleich wahr, SY-FDPOS=', sy-fdpos.

ELSE.

WRITE: / 'Vergleich falsch, SY-FDPOS=', sy-fdpos.

ENDIF.

Reward If Helpfull,

Naresh.

Read only

Former Member
0 Likes
2,470

HI,

SY-FDPOS will give u the offset position where searching pattern is found in a string.

see this example.


DATA STRING(30) VALUE 'This is a little sentence.'.

WRITE: / 'Searched', 'SY-SUBRC', 'SY-FDPOS'.
ULINE /1(26).

SEARCH STRING FOR 'itt '.
WRITE: / 'itt   ', SY-SUBRC UNDER 'SY-SUBRC',
                   SY-FDPOS UNDER 'SY-FDPOS' .

rgds,

bharat.

Read only

0 Likes
2,470

hi barath what is the output for that program??

good points will be rewarded

Read only

0 Likes
2,470

hi,

it searches for the string 'itt' in the sentence and gives its offset position

O/P

seached sy-subrc sy-fdopos

itt 0 11

regards

prasanth

Read only

0 Likes
2,470

so the output is 11 rite????

Read only

0 Likes
2,470

Hi Diana,

The ouput of that program would be :

Searched Sy-subrc Sy-fdpos

itt 0 11

Sy-subrc is 0 b'coz the string(itt) searched is present in the string(This is a little sentence.)

Sy-Fdpos is 11. It gives ypu the position from where the string "itt" starts in "This is a little sentence".

Counting of position starts from 0.

Hope it helps.

Reward if helpful.

Regards

Hemant Khemani

Read only

0 Likes
2,470

Hi,

output would be

itt 0 11

Reward points if this helps,

Kiran

Read only

Former Member
0 Likes
2,471

Hi,

Its useful when you use SEARCH keyword

SEARCH dobj FOR pattern

This statement searches the data object dobj according to the search pattern specified in pattern. The additions allow to search subareas, shortened patterns and marking of places of finding.

The search ends at the first hit and sy-fdpos is set to the offset of the found pattern or to the word in the search area. If the pattern is not found, then sy-fdpos is set to value 0.

Reward if helpful.