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: 

how to restric length of string

laxman_sankhla3
Participant
0 Kudos

hi

i m getting name of vendor from table i want to restrict upto 15 character

is there any keyword to restrict length up to 15 character .

if any solution than suggest me.

thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

use the offset option for display upto 15 characters .

<b>write:/ name+0(15).</b>

regards,

vijay.

7 REPLIES 7

Former Member
0 Kudos

Offset.

If u want to take 6from matnr.

v_matnr = mara-matnr+0(6).

U can use <b>+0(15)</b>

DATA: string(30) TYPE STRING VALUE 'Test this_program'.

DATA: v_string(10) TYPE STRING.

v_string = string+0(10).

Write:/ v_string.

Output will be:

<b>Test this_</b>

Reward points if this helps.

Former Member
0 Kudos

use the offset option for display upto 15 characters .

<b>write:/ name+0(15).</b>

regards,

vijay.

0 Kudos

hi i written below code

i want empname only upto 15 character please help me

FORM get_emp_name TABLES in_tab60 STRUCTURE itcsy

out_tab60 STRUCTURE itcsy.

READ TABLE in_tab60 WITH KEY 'BSEG-PERNR'.

IF sy-subrc = 0.

PA0001-PERNR = in_tab60-value.

  • CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

  • EXPORTING

  • input = in_tab60-value

  • IMPORTING

  • output = PA0001-PERNR.

    • XBELNR = IN_TAB2-VALUE.

ENDIF.

CALL FUNCTION 'HR_TMW_GET_EMPLOYEE_NAME'

EXPORTING

person_no = pa0001-PERNR

IMPORTING

EDIT_NAME = PA0001-ENAME

  • NAME_WITH_NO =

.

IF sy-subrc = 0.

READ TABLE out_tab60 INDEX 1.

out_tab60-value = PA0001-ENAME.

MODIFY out_tab60 INDEX 1.

ENDIF.

ENDFORM.

thanks .

0 Kudos

//READ TABLE out_tab60 INDEX 1.

out_tab60-value = PA0001-ENAME.

MODIFY out_tab60 INDEX 1.

okay in the script or sF o/p just give the offset as

<b>&out_tab60-value+0(15)&</b>

this will do .

chk this .

need not adjust anything in this code but just display it to 15 in the o/p as shown

regards,

vijay

0 Kudos
READ TABLE out_tab60 INDEX 1.
out_tab60-value =

<b>PA0001-ENAME+0(15).</b>

MODIFY out_tab60 INDEX 1.

Hope this solves.

0 Kudos

all of u many many thanks.

Former Member
0 Kudos

JUST DECLARE THE VAR

DATA : NAME(15).

NOW TAKE THE DATA IN NAME IT WILL TAKE ONLY FIRST 15 CHAR AND REST WILL BE TRUNCATED.

IN DISPALY IF YOU WANT TO SHOW.

WRITE : /(15) ITAB-NAME1.

REGARDS

SHIBA DUTTA