Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How add '0' dynamically? Help.

I set input box for the user to input the customer number, such as '1171'.

1171 is stored in <i>seh_custom</i> ,which is like <i>kna1-kunnr</i>.

  SELECT  SINGLE kunnr  name1 adrnr FROM kna1
            INTO CORRESPONDING FIELDS OF wa_custom
            WHERE kna1~kunnr = seh_custom .
  IF sy-subrc <> 0.
    ... "Error
  ENDIF.

But the codes don't work, as in database the <i>kunnr</i> is stored in '0000001171'.

Any suggestion ? Thanks very much!

Tags:
Former Member
Former Member replied

u need to use conversion routines,

generally SAP uses conversion routines internally to convert from user format to sap format and vice versa.

but some times if it does not use /work, we need to use explicitly conversion routines which convert data from user given format (ex:1) to sap format (ex: for kunnr as it is of char 10 internally stored as 0000000001).

there are many conversion exits.

u can use the following fn module for ur purpose.

generally their format will be

CONVERSION_EXIT_XXXXX_INPUT,

CONVERSION_EXIT_XXXXX_OUTPUT.

XXXXX-> IT IS OF 5 LETTERS .

AND THERE ARE MANY FN MODULES , U CAN CHECK IN SE37.

ex:

REPORT ZTESTH messAGE-ID ZV.

parameter : p_kunnr type kunnr.

data v_kunnr(10).

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

INPUT = p_kunnr

IMPORTING

OUTPUT = v_kunnr

.

write: p_kunnr, v_kunnr.

Message was edited by: Hymavathi Oruganti

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question