cancel
Showing results for 
Search instead for 
Did you mean: 

Material with Padding Zeros in SMARTFORM Output issue

Former Member
0 Kudos

Hi Friends,

i want ouput material number lenth 8 and padding zeros in smartforms.

i have written the following code to make , but its not outputting with zeros.

i put hard brakpoint in smartform program line its showing with zeros but not showing in output.

data:lv_mat(8).

IF WA_MARA-MATNR CO '0123456789 '.

MOVE WA_MARA-MATNR+10(8) TO lv_mat.

SHIFT lv_mat RIGHT DELETING TRAILING ' '.

OVERLAY lv_mat WITH '00000000'.

MOVE lv_mat TO L_MATNR.

ENDIF.

ex:if matno is :2345 o/p then should be: 00002345

please help.

thanks

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Create a variable with char 10.

unpack your MATNR field to that varible and print it

Check the below example

DATA: it_vbrk TYPE TABLE OF vbrk WITH HEADER LINE,

wrk_vbeln(10) TYPE c.

SELECT * UP TO 10 ROWS FROM vbrk INTO TABLE it_vbrk.

LOOP AT it_vbrk.

UNPACK it_vbrk-vbeln TO wrk_vbeln .

WRITE: / wrk_vbeln .

ENDLOOP.

former_member195383
Active Contributor
0 Kudos

Hi,

data : wf_str type string.

constants co_con type '00000000'.

wf_str = WA_MARA-MATNR.

concatenate co_con wf_str into wf_str.

WA_MARA-MATNR = wf_str.

now your WA_MARA-MATNR will contain the value with leading zeros..

Use it...it will work....

Reward if useful....

regards

Rudra

Former Member
0 Kudos

Hi,

Why dont you use the concatenate statement.

Like for example take...

Data : Var(5) type C default '00000',

var_string type string.

Concatenate var lv_mat into var_str.

This will help your problem.

Thanks.

Swati.