Skip to Content
avatar image
Former Member

REGARDING THIS CODE

HI,

THIS IS THE REQUIREMENT

THERE IS A NUMERIC VALUE "1"

SO I NEED TO ADD 17 ZEROS TO THIS VALUE OF "1"

OUT PUT WILL BE LIKE THIS 000000000000000001.

COULD U PLZ TELL ME THE LOGIC OF THIS

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

6 Answers

  • avatar image
    Former Member
    Oct 11, 2007 at 07:30 AM

    probably u r talking about conversions of user to sap format.

    use this function module

    <b>conversion_exit_alpha_input.</b>

    example:

    REPORT z_test NO STANDARD PAGE HEADING.

    data: val(1), val1(18).

    val = 1.

    val1 = val.

    *write val1.

    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

    EXPORTING

    INPUT = val

    IMPORTING

    OUTPUT = val1

    .

    write val1.

    .

    Message was edited by:

    Hymavathi Oruganti

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 11, 2007 at 07:31 AM

    Hi

    use OVERLAY command.

    Look at the code below:

    CONSTANTS initial_time TYPE t VALUE IS INITIAL.

    DATA: time TYPE t,

    text TYPE c LENGTH 4.

    text = '12'.

    time = text.

    OVERLAY time WITH initial_time.

    After the text field has been assigned to the time field, it contains the invalid tome "12 00" according to the conversion rules. As a result of the overlay with the initial_time constants, the two blank characters are replaced by "00" and the result is the valid time "120000".

    Cheers

    Shakir

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 11, 2007 at 07:31 AM

    Hi Rajesh

    Use FM:

    <b>conversion_exit_alpha_Input.</b>

    Regards,

    Sree

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 11, 2007 at 07:32 AM

    Hi,

    declare the variable of type c

    data : v_var(20) type c.

    v_num = 1.

    move : v_num to v_var.

    Now call the FM "coversion_exit_alpha_input".

    now pass v_var to it..

    it will give u 00000000000000001 as output .

    Regards,

    Nagaraj

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 11, 2007 at 07:33 AM

    Most likely this is a material number. Be sure to reference your variable or field to MATNR. Then use unpack to add the leading zeroes.

    ex.

    itab-field = 1.
    unpack itab-field to itab-field.
    

    or

    lv_matnr = 1.
    unpack lv_matnr to lv_matnr.
    

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 11, 2007 at 07:38 AM

    data zch1 type c value '1'.

    data i type i value 1.

    data zch(18).

    WHILE i le 17.

    CONCATENATE '0' zch into zch.

    i = i + 1.

    ENDWHILE.

    CONCATENATE zch zch1 into zch.

    WRITE / zch.

    plz reward if dis helps

    Add comment
    10|10000 characters needed characters exceeded