Application Development 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: 

Offset

Former Member
0 Kudos

Hello,

I am getting the value like w183-145-001 in select option.

But i need to display only the w183 in output,

how can i do that.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi John,

Suppose ur field VAR contains = w183-145-001.

1) Use Split Command. split VAR at '-' into var1 var2

var3. Var1 will contain w183

2) Use offset var1 = VAR+0(3).

Hope this solves ur problem.

Manish

Message was edited by: Manish Kumar

8 REPLIES 8

Former Member
0 Kudos

Hi John,

Suppose ur field VAR contains = w183-145-001.

1) Use Split Command. split VAR at '-' into var1 var2

var3. Var1 will contain w183

2) Use offset var1 = VAR+0(3).

Hope this solves ur problem.

Manish

Message was edited by: Manish Kumar

0 Kudos

Hai manish,

I am having a valu like IEQw183.

I want to show only w183 in output.How to split this to final display.

0 Kudos

Hi Johnn

I don't know what you need to do exactly, but you should consider if you change the value for the output you should restore the original value for the select.

Max

0 Kudos

Hi John,

While splitting use p_var-low

s

plit p_var-low at '-' into var1 var2.

The first 3 letters IEQ are for selection options

Former Member
0 Kudos

Hi

U should create a convertion routine for output, for example the field BKPF-BELNR is linked to domanain BELNR uses the routine ALPHA (fm CONVERSION_EXIT_ALPHA_INPUT,

CONVERSION_EXIT_ALPHA_OUTPUT).

Max

Former Member
0 Kudos

U can use SPLIT lvalue AT '-' into v1 v2 v3.

v1 has the value.

Second way is to

SEARCH lvalue for '-'.

If sy-subrc = 0.

write lvalue(sy-fdpos) into v1.

endif.

v1 has the value.

<b>Adding to the above you can use

len = strlen(v1).

lfinal = v1+3(len).</b>

Message was edited by: Anurag Bankley

0 Kudos

Hai anurag,

I am getting error field strlen is unknown.

how to declare this.

Former Member
0 Kudos

Hi Johnn,

is VAR = IEQw183. or QW183 (I think IE is comming because of numeric field).

Anyway if VAR = IEQw183-145-001

var1 = VAR+3(3).

Code below will clarify your doubt.

data: VAR type char10 value '0123456789',

var1 type char3,

var2 type char3.

var1 = var+0(3). " result = 012

var2 = var+3(3). " result = 345

write:/ var1, var2.

Reward points if it helps.

Manish