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: 

appending non leading zeroes

Former Member
0 Kudos
107

Hi,

I have a material number which is of 5 characters . I want to append non-leading zeroes .

This is because i need to concatenate the MATNR and VKORG.

As MATNR is 18 characters long, after concatenation the final output shud look like:

"ABCDE_____________XWYZ"

WHERE ABCD = MATNR

XWYZ = VKORG

I have drawn a line to depict the spaces.

i tried using conversion_exit_alpha_input but its not working.

Please suggest

regards

Nishant

Message was edited by: Nishant Gupta

Message was edited by: Nishant Gupta

6 REPLIES 6

Former Member
0 Kudos
64

Hi nishant,

1. offset

2. u will have to use offset concept.

3. variable+18(10) = VKORG.

regards,

amit m.

Former Member
0 Kudos
64

Hi Nishant ,

Try folllowing code:

data: lv_mat like mara-matnr value 'ABCDE'.

constants c_mat like mara-matnr value '__________________'.

overlay lv_mat with c_mat.

write: / lv_mat.

Regards,

Akshay

Note: Pls mark helpful answers.

Former Member
0 Kudos
64

Hi again,

1. just copy paste in new program.

2. it will give the output

<b>12345__________________WXYZ </b>

3.

report abc.

*----


parameters : matnr like mara-matnr default '12345'.

*----


data : str(28) type c.

*----


start-of-selection.

write matnr to str.

str+18(10) = 'WXYZ'.

write str.

break-point.

regards,

amit m.

0 Kudos
64

Hi,

Try this..

REPORT ZTEST.

data : str1(18),
       str2(10),
       str(28).

str1 = 'MATNR'.
str2 = 'VKORG'.


str+0(18) = str1.
str+18(10) = str2.

write : str.

Regards

Vijay

Former Member
0 Kudos
64

Hi Nishant,

Try this .

lv_matnr.

lv_matnr_nonchar.

lv_matnr_length.

lv_VKORG.

lv_final_string.

1) lv_matnr_length = strlen ( lv_matnr ).

lv_matnr_length = 18 - lv_matnr_length.

  • This is because u want initiall values

2) conversion_exit_alpha_input

input = lv_matnr.

output = lv_matnr_nonchar.

3) REPLACE ALL OCCURRENCES OF '0' IN lv_matnr_nonchar WITH 'new_char_u_want.

4)then concatenate

concatenate lv_matnr lv_matnr_nonchar+0(lv_matnr_length) lv_VKORG

into lv_final_string.

u can use this logic in a perform

using matnr

VKORG

changing final string.

code is dynamic for variable length of matnr

This will really solve ur problem.

Message was edited by: Manoj Gupta

Former Member
0 Kudos
64

Dear Nishant,

Try the following code:

*************

DATA: L_MATNR TYPE MARA-MATNR VALUE '12345',

L_VKORG TYPE TVKO-VKORG VALUE '4000',

L_STR(22) TYPE C.

DATA: L_LEN TYPE I.

L_LEN = STRLEN( L_MATNR ).

L_LEN = 18 - L_LEN.

WRITE L_MATNR TO L_STR LEFT-JUSTIFIED.

DO L_LEN TIMES.

CONCATENATE L_STR '0' INTO L_STR.

ENDDO.

CONCATENATE L_STR L_VKORG INTO L_STR.

write: l_str.

***********************

I am sure this will solve your problem.

Prabhas