Skip to Content
author's profile photo Former Member
Former Member

CX_SY_CONVERSION_NO_NUMBER dump.

Hi all,

I have an issue while i move a string field to WRBTR field.

I have a form in which an int table is passed. It has a field of Char255 length.

This is moved to string field. All the commas and periods are replaced with spaces.

Later this is moved to WRBTR field. It gives dump here as

Unable to interpret "000 " as a number.

It seems there is an extra space at the end of the number in the string field.

I have tried CONDENSE WITH NO GAPS the string field and the same with the char255 field too with no success.

Eg code :

DATA : tt_inp TYPE STANDARD TABLE OF itcsy,

ls_intab TYPE itcsy,

lv_wrbtr TYPE wrbtr,

lv_wrbtr_char TYPE string.

FORM zztest TABLES itab TYPE tt_inp.

READ TABLE in_tab INTO ls_intab WITH KEY name = 'BSIK-WRBTR'.

IF sy-subrc EQ 0.

lv_wrbtr_char = ls_intab-value.

ENDIF.

CONDENSE lv_wrbtr_char.

REPLACE ALL OCCURRENCES OF '.' IN lv_wrbtr_char WITH ''.

REPLACE ALL OCCURRENCES OF ',' IN lv_wrbtr_char WITH ''.

lv_wrbtr = lv_wrbtr_char. (giving dump in this statement)

ENDFORM.

Please find above the code which is resulting in error. when passing the data from ls_intab-value to lv_wrbtr_Char an extra blank is getting appended at the end. Tried all options as CONDENSE WITH NO GAPS, SHIFT, PACK etc.

Please help me in this regard.

Thanks,

Prasad

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Posted on Apr 20, 2011 at 03:24 AM

    Hi,

    Instead of trasnferring the data directly to WRBTR field try to use Write statement.

    Write lv_wrbtr_char to lv_wrbtr.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 20, 2011 at 04:37 AM

    Hello Prasad,

    DATA: gv_dcpfm      TYPE xudcpfm,
          gv_wrbtr_char TYPE string,
          gv_wrbtr      TYPE wrbtr.
    
    * Get the Decimal notation
    SELECT SINGLE dcpfm FROM usr01 INTO gv_dcpfm WHERE bname = sy-uname.
    
    CASE gv_dcpfm.
      WHEN 'X'.
    *   Replace 1000's separator
        REPLACE ALL OCCURRENCES OF ',' IN gv_wrbtr_char WITH space.
      WHEN 'Y'.
        CONDENSE gv_wrbtr_char NO-GAPS.
        REPLACE ',' IN gv_wrbtr_char WITH '.'. "Replace decimal separator
      WHEN OTHERS.
    *   Replace 1000's separator
        REPLACE ALL OCCURRENCES OF '.' IN gv_wrbtr_char WITH space.
    *   Replace decimal separator
        REPLACE ',' IN gv_wrbtr_char WITH '.'.
    ENDCASE.
    
    MOVE gv_wrbtr_char TO gv_wrbtr.

    Hope this helps.

    BR,

    Suhas

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Apr 20, 2011 at 11:13 AM

    Hi,

    The problem is not with the move statement but with thr replace logic you are using.

    REPLACE ALL OCCURRENCES OF '.' IN lv_wrbtr_char WITH ','.

    REPLACE ALL OCCURRENCES OF ',' IN lv_wrbtr_char WITH '.'.

    First you replace . with ,. This time the string has values with comma.

    next you replace comma with dots . this time the string may contain two or more dots converting the comma as changed recently also.

    commas in inappropriate palces will cause the dump.

    Try modfying the logic for proper separation.Make sure that the number you get after all replacement is a valid SAP number.

    Like, 12,345.50 is your input.

    your output to be put in wrbtr field should be 12.345,50.

    With the current logic it becomes: 12,345,50

    and then 12.345.50 which is not a valid number. that is why it gives dump.

    change your logic like this.

    DATA : tt_inp TYPE STANDARD TABLE OF itcsy,

    ls_intab TYPE itcsy,

    lv_wrbtr TYPE wrbtr,

    lv_offset type i,

    lv_numc type n length 16,

    lv_wrbtr_char TYPE string,

    itab like tt_inp,

    result type MATCH_RESULT_TAB with header line.

    lv_wrbtr_char = ' 12,456.00'.

    CONDENSE lv_wrbtr_char no-gaps.

    find '.' in lv_wrbtr_char match offset lv_offset.

    REPLACE ALL OCCURRENCES OF ',' IN lv_wrbtr_char WITH '.'.

    if lv_offset is not initial.

    replace section offset lv_offset length 1 of lv_wrbtr_char with ',' .

    endif.

    lv_numc = lv_wrbtr_char.

    lv_wrbtr = lv_numc.

    write lv_wrbtr.

    Here i have assumed that the user data in sAP system has decimal format as 1.234.456,00

    Regards,

    Kamini Rawat

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.