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

String to type P/DEC

Former Member
0 Likes
375

Hi,

I have imported an Excel-file and now I want use one value as number. The value is "1,50" in excel, how can I move it to a type p-field??

Is there any function module?

Thanks a lot!

2 REPLIES 2
Read only

Former Member
0 Likes
354

can you please make it clear.

you have a value in other format and that should be download as packed decimal. right

Read only

former_member156446
Active Contributor
0 Likes
354

I would directly move the fields as below..

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
    EXPORTING
      filename                = p_fname
      i_begin_col             = begcol
      i_begin_row             = begrow
      i_end_col               = endcol
      i_end_row               = endrow
    TABLES
      intern                  = lt_data
    EXCEPTIONS
      inconsistent_parameters = 1
      upload_ole              = 2
      OTHERS                  = 3.
  IF sy-subrc <> 0.
    MESSAGE e101(zz).
  ENDIF.
  LOOP AT lt_data.
    CASE lt_data-col.
      WHEN 1.
        MOVE lt_data-value TO wa_main-kostl.
      WHEN 2.
        MOVE lt_data-value TO wa_main-name1.
      WHEN 3.
        MOVE lt_data-value TO wa_main-stras.
      WHEN 4.
        MOVE lt_data-value TO wa_main-ort01.
      WHEN 5.
        MOVE lt_data-value TO wa_main-ort02.
      WHEN 6.
        MOVE lt_data-value TO wa_main-land1.
      WHEN 7.
        MOVE lt_data-value TO wa_main-pstlz.
      WHEN 8.
        MOVE lt_data-value TO wa_main-regio.
        IF wa_main-kostl IS INITIAL OR wa_main-name1 IS INITIAL
        OR wa_main-pstlz IS INITIAL.
          SKIP.
        ELSE.
          APPEND wa_main TO gt_main.
          CLEAR: wa_main.
        ENDIF.
    ENDCASE.
  ENDLOOP.
  DESCRIBE TABLE gt_main LINES gv_total.