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

Data uploading

Former Member
0 Likes
625

Hello all,

Can we upload the data from .Xls (or) .Dat to z_table with out using BDC??

If yes, Pls describe me the process.

Thnx in advance.

sreenivas

5 REPLIES 5
Read only

dani_mn
Active Contributor
0 Likes
592

Hi,

ya you can.

first use 'GUI_UPLOAD' function module to upload data from excel or dat file into internal table.

then use this internal table to update z_table directly using. 'MODIFY' or 'INSERT' command.

TABLES: z_table.

LOOP AT itab.

MOVE-CORRESPONDING itab TO z_table.

INSERT z_table.

ENDLOOP.

Regards,

Wasim Ahmed

Read only

aris_hidalgo
Contributor
0 Likes
592

Hi,

You can use the function module GUI_UPLOAD. By using this, you can upload your file into an internal table.

Regards!

P.S. Please award points if helpful

Read only

naimesh_patel
Active Contributor
0 Likes
592

Hello,

You can use INSERT or MODIFY statment to insert / change data into your ztable. But don't forget to populate your MANDT (client) in the database table.

Regards,

Naimesh

Read only

Former Member
0 Likes
592

Hi Sreenivasalu,

Yes its possible to update DB table directly.

Consider I am updating DB table MARA.


REPORT zztest.



DATA : it_mara TYPE STANDARD TABLE OF mara WITH HEADER LINE,
       ftemp TYPE string.

PARAMETERS : p_file TYPE rlgrap-filename DEFAULT 'C:UPLOADdata'.

START-OF-SELECTION.

  <b>CONCATENATE p_file '.xls' INTO p_file.  "(or .dat file as required)</b>
  ftemp = p_file.
  CONDENSE ftemp NO-GAPS.


  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename                = ftemp
      filetype                = 'ASC'
      has_field_separator     = '#'
    TABLES
      data_tab                = it_mara[]
    EXCEPTIONS
      file_open_error         = 1
      file_read_error         = 2
      no_batch                = 3
      gui_refuse_filetransfer = 4
      invalid_type            = 5
      no_authority            = 6
      unknown_error           = 7
      bad_data_format         = 8
      header_not_allowed      = 9
      separator_not_allowed   = 10
      header_too_long         = 11
      unknown_dp_error        = 12
      access_denied           = 13
      dp_out_of_memory        = 14
      disk_full               = 15
      dp_timeout              = 16
      OTHERS                  = 17.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.


<b>  MODIFY  mara     FROM TABLE it_mara.</b>

Note : <b>Standard table like MARA, MARC</b> etc, <b>shouldnt be updated directly</b>, either use FM's or BAPI in any case. Its fine if you are updating a custom table.

Regards,

Arun Sambargi.

Read only

Former Member
0 Likes
592

Hi sreenivasulu

You can use the function <b>'ALSM_EXCEL_TO_INTERNAL_TABLE'</b> tu upload your ecel file in the internal table. then you can use the <b>insert</b> statement to update the data in the table without using BDC. But remind that intarnal table must conatin the field <b>MANDT</b> and its value must be equal to your client in which you want to upload the data.

Regards,

Varun Sanghi