‎2007 Jul 11 6:02 PM
Hi..
I am doing a select statement on a database table based on a material number from a legacy file.
The MATNR in SAP is char 18. If the legacy file material number has complete 18 chars like '000000000000100010' , then the select works fine.
but if the legacy file has just '100010' for material number without leading zero's then the select fails.
any idea how to approach this issue .
Thanks and will reward helpful answers.
‎2007 Jul 11 6:04 PM
Hi,
Please use this FM CONVERSION_EXIT_MATN1_INPUT to convert legacy material number prior to use in select statement.
Regards,
Ferry Lianto
‎2007 Jul 11 6:06 PM
‎2007 Jul 12 4:29 AM
first add leading zeros to the value and pass it in the select atatement.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
EXPORTING
input = it_mseg_cst-kostl
IMPORTING
OUTPUT = it_mseg_cst-kostl
.
it_alv-kostl = it_mseg_cst-kostl.
modify it_alv.
this function module adds leading zeros to the value.
the zeros will be added to the maximum size of that data type.
reward if useful
‎2007 Jul 12 4:32 AM
hi Kanti,
Before your select statement use CONVERSION_EXIT_MATN1_INPUT FM
DATA : lv_matnr LIKE mard-matnr,
CALL FUNCTION 'CONVERSION_EXIT_MATN1_INPUT'
EXPORTING
input = itab-matnr
IMPORTING
output = lv_matnr.
‎2007 Jul 12 8:04 AM
DATA: mat(18).
DATA: matr(18) TYPE n.
mat = '1222140011'.
matr = mat.
DATA: BEGIN OF itab OCCURS 1,
matnr LIKE mara-matnr,
END OF itab.
SELECT matnr FROM mara INTO TABLE itab WHERE matnr = matr.
WRITE:/ mat.
WRITE:/ matr.
LOOP AT itab.
WRITE:/ itab-matnr.
ENDLOOP.
and the result is :
1222140011
000000001222140011
1222140011
if useful reward points.
anju
‎2007 Jul 12 8:10 AM
use conversion exit alpha input function module.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = itab-matnr
IMPORTING
output = itab_matnr.
Hope this answers your curiosity,
Award points if useful else getbk,
Aleem.