Application Development and Automation 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: 
Read only

select statment

Former Member
0 Likes
798

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.

6 REPLIES 6
Read only

ferry_lianto
Active Contributor
0 Likes
764

Hi,

Please use this FM CONVERSION_EXIT_MATN1_INPUT to convert legacy material number prior to use in select statement.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
764

Hi,

Use Conversion_exit_alpha_input.

reward points if helpful.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
764

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

Read only

Former Member
0 Likes
764

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.

Read only

Former Member
0 Likes
764

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

Read only

Former Member
0 Likes
764

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.