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: 

Which FM?

Former Member
0 Kudos

What is the Fn mod 2 upload data in to internal table from an EXCEL file?

10 REPLIES 10

Former Member
0 Kudos

please see these function modules

RH_START_EXCEL_WITH_DATA

GUI_DOWNLOAD

EXCEL_OLE_STANDARD_DAT

Thanks,

Max

Former Member
0 Kudos

Hi,

CALL FUNCTION <b><i>'TEXT_CONVERT_XLS_TO_SAP'</i></b>

convert the data in file in excel format to internal table

<b>Reward points</b>

Regards

0 Kudos

HI,

check

HR_PK_EXCEL_TO_INTERNAL_TABLE.

ALSM_EXCEL_TO_INTERNAL_TABLE

Regards,

Sesh

Message was edited by:

Seshatalpasai Madala

Former Member
0 Kudos

Hi,

You may use FM GUI_UPLOAD / WS_UPLOAD.

I hope this helps,

Regards

Raju Chitale

Former Member
0 Kudos

hi John,

Here is a sample code for the same

REPORT  zupload_excel_to_itab.

TYPE-POOLS: truxs.

PARAMETERS: p_file TYPE  rlgrap-filename.

TYPES: BEGIN OF t_datatab,
      col1(30)    TYPE c,
      col2(30)    TYPE c,
      col3(30)    TYPE c,
      END OF t_datatab.
DATA: it_datatab type standard table of t_datatab,
      wa_datatab type t_datatab.

DATA: it_raw TYPE truxs_t_text_data.

* At selection screen
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      field_name = 'P_FILE'
    IMPORTING
      file_name  = p_file.


***********************************************************************
*START-OF-SELECTION.
START-OF-SELECTION.

  CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
    EXPORTING
*     I_FIELD_SEPERATOR        =
      i_line_header            =  'X'
      i_tab_raw_data           =  it_raw       " WORK TABLE
      i_filename               =  p_file
    TABLES
      i_tab_converted_data     = it_datatab[]    "ACTUAL DATA
   EXCEPTIONS
      conversion_failed        = 1
      OTHERS                   = 2.

  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.


***********************************************************************
* END-OF-SELECTION.
END-OF-SELECTION.
  LOOP AT it_datatab INTO wa_datatab.
    WRITE:/ wa_datatab-col1,
            wa_datatab-col2,
            wa_datatab-col3.
  ENDLOOP.

Former Member
0 Kudos

Try this...

ALSM_EXCEL_INTERNAL_TO_TABLE

Former Member
0 Kudos

Hi,

sorry for previous reply

it the function module "<b>GUI_DOWNLOAD</b>" downloads the data from

an internal table into a file (can be xl, dat ,doc etc) .

Plz follow the usage below ;

Parameters : pa_pfile LIKE rlgrap-filename OBLIGATORY.

Data : lv_filename TYPE STRING.

lv_filename = pa_pfile.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

  • BIN_FILESIZE =

FILENAME = lv_filename

FILETYPE = 'ASC'

  • APPEND = ' '

WRITE_FIELD_SEPARATOR = 'X'

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = tb_download " table data to b downlaoded

EXCEPTIONS

FILE_WRITE_ERROR = 1

NO_BATCH = 2

GUI_REFUSE_FILETRANSFER = 3

INVALID_TYPE = 4

NO_AUTHORITY = 5

UNKNOWN_ERROR = 6

HEADER_NOT_ALLOWED = 7

SEPARATOR_NOT_ALLOWED = 8

FILESIZE_NOT_ALLOWED = 9

HEADER_TOO_LONG = 10

DP_ERROR_CREATE = 11

DP_ERROR_SEND = 12

DP_ERROR_WRITE = 13

UNKNOWN_DP_ERROR = 14

ACCESS_DENIED = 15

DP_OUT_OF_MEMORY = 16

DISK_FULL = 17

DP_TIMEOUT = 18

FILE_NOT_FOUND = 19

DATAPROVIDER_EXCEPTION = 20

CONTROL_FLUSH_ERROR = 21

OTHERS = 22

.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

Reward points

Regards

Former Member
0 Kudos

You can use ALSM_EXCEL_TO_INTERNAL_TABLE for uploading data from excel to your internal table. You can use GUI_UPLOAD to upload but in your case, you should use ALSM_EXCEL_TO_INTERNAL_TABLE.

Regards,

Sangeeta.

Former Member
0 Kudos

Hi John,

please use this function module ALSM_EXCEL_TO_INTERNAL_TABLE

rewards points

regards

Reena

Former Member
0 Kudos

ALSM_EXCEL_TO_INTERNAL_TABLE