Application Development 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: 

Conversion from char to quote

Former Member
0 Kudos

Hi!!

I read data from an excel to an internal table using function 'ALSM_EXCEL_TO_INTERNAL_TABLE'.

I read a field (from excel) and I need to store it in a field ( within the internal table) whose data element is quote.

I have used function ISM_CONVERT_CHAR_TO_DEC but I get a blank before the data I read from excel.

Thanks in advance.

5 REPLIES 5

raymond_giuseppi
Active Contributor
0 Kudos

ISM_CONVERT_CHAR_TO_DEC return a "packed" numeric field, where do you see this blank character. Once you move the result to your field don't forget that QUOTE is signed, and reserves a character for the sign.

Regards,

Raymond

Former Member
0 Kudos

I have got this code:

DATA:li_intern TYPE TABLE OF alsmex_tabline WITH HEADER LINE,

lv_start_col TYPE i VALUE 1,

lv_start_row TYPE i VALUE 2,

lv_end_col TYPE i VALUE 256,

lv_end_row TYPE i VALUE 65536,

lw_linea TYPE REF TO data,

pi_lineas_cab TYPE i VALUE 1.

DATA: BEGIN OF itab OCCURS 0,

row(4),

matnr LIKE equk-matnr,

werks LIKE equk-werks,

bdatu LIKE equk-bdatu, " valido hasta

lifnr LIKE equp-lifnr,

quote LIKE equp-quote,

borrar(1),

END OF itab.

After reading data from excel into internal table li_intern

In li_intern I have read value "60"

DATA: c_input(10) TYPE c.

DATA: p_output TYPE p DECIMALS 0.

c_input = li_intern-value.

CALL FUNCTION 'ISM_CONVERT_CHAR_TO_DEC'

EXPORTING

i_char = c_input

IMPORTING

e_dec = p_output.

itab-quote = p_output.

iAfter this operation in itab-quote I get " 60".

What should I do?

Thanks.

0 Kudos

With a similar test program i get the following values for fied output (type quote)

- internally x'060C' - value 060 sign +

- externally (WRITE output) ' 60'

For me those values are correct

DATA: input TYPE c LENGTH 5,
      packed TYPE p DECIMALS 0,
      output TYPE quote,
      text TYPE c LENGTH 4,
      numc TYPE n LENGTH 4.
input = '60'.
CALL FUNCTION 'ISM_CONVERT_CHAR_TO_DEC'
  EXPORTING
    i_char = input
  IMPORTING
    e_dec  = packed
  EXCEPTIONS
    OTHERS = 0.
output = packed.
numc = output.
WRITE output TO text.
BREAK-POINT. " check value of output here

Regards,

Raymond

0 Kudos

Hi!!!

I am trying to read datat from an excel and make a batch input in meq1 transaction. The value I have problems with is the quote in this transaccion. I am not able to store values with a blank (" 60" for example) in EQUP-QUOTE field.

How could I convert data read from an excel into quote withoudt any blank?

In the way you told me I still get a blank and tehrefore an error when trying the batch-input.

Thanks in advance.

0 Kudos

Thanks for all.

I have just changed the field definition from

itab-quote like equp-quote to itab-quote type int3 and now it´s working.

Thanks.