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: 

problem in displaying long text

Former Member
0 Kudos

Hi,

I am working on a sap script in which i have to maintain the long text(decription) of MIC(Master Inspection Charaterstic) has to be displayed in a proper way i.e. if there is a word long ,it is not able to fit in to that column as it getz divided and displayed the rest of the word in next line.

I am new to the sap scripts and i want to know is dere any other possible way to solve this problem.

Plzzz provide me guidlines for it.

9 REPLIES 9

Former Member
0 Kudos

hi ,

i didn't get your problem clearly. If you are displaying it in a table or template it will display in the next line itself.

If i didn't get your problem, please explain clearly.

Thanks,

Vamshi

0 Kudos

hi,

actually i am displaying the value in a itab which is declared in the program and it is basically the description for example description of the material it is displaying the text not in a proper format. if it is written long if the row completes or coloumn ends the word is displayed as lo in the first line and ng in the 2 dn line. i want to display it as long as full word.

i hope it had clarified ur doubts.

0 Kudos

hi ,

I think i got your problem. Recently i have also faced a similar issue. in that case use the below code.

1. find the strlen of that field value in itab.

2.Notice how many characters you are able to display in the output properly (max)

then use the below logic

1.here l is the strlen of the field in itab

2. n is the no of characters you are able to display in a line

3. split the field value where the string is displaying properly.

go on like this by estimating how many lines you have maximum

while l ne '0'.

if ls_str+n(1) eq ' '.

ls_str1 = ls_str+0(n).

l = l - n.

ls_str2 = ls_str+n(l).

move '0' to l.

else.

n = n - 1.

endif.

endwhile.

Let me know if you have any problems.

Thanks,

Vamshi.

0 Kudos

hi,

Is dere a possibility of making changes in SPRO so that the text can be displayed. the logic mentioned by you will be bit complex as i have to appy it for 3 conditions.

plzz proivde me guidelines to solve this problem .

Edited by: ricx .s on May 5, 2009 8:02 AM

0 Kudos

Hi,

You can't make any settings to the text in SPRO.

Provide your current code so that i can modify that for displaying the string.

Thanks,

Vamshi

0 Kudos

hi,

this is the code which i am using right now:-



/E	 	FINAL
C1	 	&i_final-count_c(3Z)& &i_final-text_c(24)& &i_final-result_c(8)&
	 	&i_final-count_m(3)& &i_final-text_m(22)& &i_final-result_m(8)&
	 	&i_final-nonconfirm_m(10)&  &i_final-count_mi(3)& &i_final-text_mi(25)&
=	 	 &i_final-result_mi(8)& &i_final-nonconfirm_mi&
/*	 	************************************************************
/*	 	**** CHANGE THE NAME OF VARIABLE C, M AND MI RESPECTIVELY
/*	 	************************************************************
/*	 	FOR CRITICAL PROPERTIES
/:	 	IF &I_FINAL-TEXT_C+24(16)& NE '                '
C1	 	    &i_final-text_c+24(16)&,,,,&i_final-result_c+8(8)&,,
	 	   &i_final-text_m+22(18)&,,   &i_final-result_m+8(8)&,,,,,,,,
	 	&i_final-text_mi+25(15)&,,,, &i_final-result_mi+8(8)&
/:	 	ELSEIF &I_FINAL-RESULT_C+8(8)& NE '        '.
	 	&temp(40)&   &i_final-result_c+8(8)&,,  &i_final-text_m+22(18)&
=	 	,,  &i_final-result_m+8(8)&,,,,,,,, &i_final-text_mi+25(15)&,,
=	 	&i_final-result_mi+8(8)&
/*	 	FOR MAJOR
/:	 	ELSEIF &I_FINAL-TEXT_M+22(18)& NE '                  '
C1	 	    &i_final-text_c+24(16)&,,,,&i_final-result_c+8(8)&,,
	 	   &i_final-text_m+22(18)&,,  &i_final-result_m+8(8)&,,,,,,,,
	 	&i_final-text_mi+25(15)&,,,,  &i_final-result_mi+8(8)&
/:	 	ELSEIF &I_FINAL-RESULT_M+8(8)& NE '        '
C1	 	    &i_final-text_c+24(16)&,,,,&i_final-result_c+8(8)&,,
	 	   &i_final-text_m+22(18)&,,  &i_final-result_m+8(8)&,,,,,,,,
	 	&i_final-text_mi+25(15)&,,,,  &i_final-result_mi+8(8)&
/:	 	ELSEIF &I_FINAL-RESULT_M+8(8)& NE '        '
C1	 	    &i_final-text_c+24(16)&,,,,&i_final-result_c+8(8)&,,
	 	   &i_final-text_m+22(18)&,,  &i_final-result_m+8(8)&,,,,,,,,
	 	&i_final-text_mi+25(15)&,,,,  &i_final-result_mi+8(8)&
/:	 	ELSEIF &I_FINAL-TEXT_MI+25(15)& NE '               '
C1	 	    &i_final-text_c+24(16)&,,,,&i_final-result_c+8(8)&,,
	 	   &i_final-text_m+22(18)&,,  &i_final-result_m+8(8)&,,,,,,,,
	 	&i_final-text_mi+25(15)&,,,,  &i_final-result_mi+8(8)&
/:	 	ELSEIF &I_FINAL-RESULT_MI+8(8)& NE '        '
C1	 	    &i_final-text_c+24(16)&,,,,&i_final-result_c+8(8)&,,
	 	   &i_final-text_m+22(18)&,,  &i_final-result_m+8(8)&,,,,,,,,
	 	&i_final-text_mi+25(15)&,,,,  &i_final-result_mi+8(8)&
/:	 	ENDIF.
/E	 	BREAK

here the fields which named as i_final_text_c,m,mi are the long text for the MIC values .

Edited by: ricx .s on May 5, 2009 9:15 AM

Edited by: ricx .s on May 5, 2009 10:38 AM

0 Kudos

hi ,

1. use the subroutine PERFORM .....ENDPERFORM in the script

PERFORM WORDS IN PROGRAM ZKFI001

USING &i_final_text_C&

CHANGING &STR1&

&STR2&

&STR3&

ENDPERFORM.

The code in the program ZKFI001.

this code splits the i_final_text_C into 3 words without splitting the word in the middle.

The lengths are spcified in the program.

You can also use the same for i_final_text_m, i_final_text_mm .

you need to add these values in the USING after i_final_text.

and you can concatenate the results into your required manner and simply display in the form.

If you are doing a customized program you can do these directly in the program.

FORM WORDS TABLES in_tab STRUCTURE itcsy

out_tab STRUCTURE itcsy.

DATA : ls_str(40) TYPE c,

ls_str1(8) TYPE c,

ls_str2(16) TYPE c,

ls_str3(30) TYPE c.

DATA: n TYPE i,

m TYPE i,

l TYPE i.

READ TABLE in_tab INDEX 1.

ls_str = in_tab-value.

n = 8. " set the maximum charcters to be split in the first word

m = 40. " set the string length of the original word

PERFORM split_word USING ls_str

m

n

l

CHanGING LS_STR1

LS_STR2

LS_str3.

READ TABLE OUT_TAB INDEX 1.

OUT_TAB-VALUE = LS_STR1.

MODIFY OUT_TAB INDEX 1.

READ TABLE OUT_TAB INDEX 2.

OUT_TAB-VALUE = LS_STR2.

MODIFY OUT_TAB INDEX 2.

READ TABLE OUT_TAB INDEX 3.

OUT_TAB-VALUE = LS_STR3.

MODIFY OUT_TAB INDEX 3.

endform. "amount

form SPLIT_WORD using p_ls_str

p_m

p_n

p_l

changing p_ls_str1

p_ls_str2

p_ls_str3.

**To avoid splitting the word in the middle

WHILE p_m NE '0'.

IF p_ls_str+p_n(1) EQ ' '.

p_ls_str1 = p_ls_str+0(p_n).

p_m = p_m - p_n.

p_ls_str = p_ls_str+p_n(p_m).

SHIFT p_ls_str LEFT DELETING LEADING space.

P_m = 16. " set the maximum characters for next word

WHILE P_n NE '0'.

IF p_ls_str+P_m(1) EQ ' '.

break-point.

p_l = STRLEN( p_ls_str ).

p_ls_str2 = p_ls_str+0(P_m).

p_l = p_l - P_m.

p_ls_str3 = p_ls_str+P_m(p_l).

SHIFT p_ls_str3 LEFT DELETING LEADING space.

MOVE '0' TO P_m.

MOVE '0' TO P_n.

ELSE.

P_m = P_m - 1.

ENDIF.

ENDWHILE.

ELSE.

P_n = P_n - 1.

ENDIF.

ENDWHILE.

endform. " SPLIT_WORD

The code is bit complex , but it will used to split any words into 3 strings . you just need to specify the lengths.

Let me know if you have any further problems.

Thanks,

Vamshi

0 Kudos

hi,

I tried to use it but it is quite confusing as the program was developed by someone else not by me. although i had tried to define the length of it in the script but it is not working. is dere any other way by which this formatting problem can be solved .

plzzz provide me guidelines for solving this problem .

Edited by: ricx .s on May 5, 2009 12:21 PM

Former Member
0 Kudos

not got the desiered result so closing the thread