on 06-13-2008 1:15 AM
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.