cancel
Showing results for 
Search instead for 
Did you mean: 

Move Internal table data into database table which is created in SE11..

Former Member
0 Kudos

Hi Experts,,

I have data in Internal table ..Now i want move that data into my database table which is created in SE11..Both tables fields are same..How to map...?

here is my code:

Layout:

<%@page language="abap"%>

<%@extension name="htmlb" prefix="htmlb"%>

<htmlb:content design="design2003">

<htmlb:page title = "Upload" >

<htmlb:form method="post" encodingType="multipart/form-data">

                     <htmlb:fileUpload id       = "excel_uploader"

                        size     = "20"

                        onUpload = "OnInputProcessing()" />

  </htmlb:form>

   </htmlb:page>

</htmlb:content>

Input processing:

Types: begin of tab_type,

       city type string,

       city_id type string,

       state_id type string,

       end of tab_type.

DATA: fileupload    TYPE REF TO cl_htmlb_fileupload,

      file_content  TYPE xstring,

      content       TYPE string,

      conv          TYPE REF TO cl_abap_conv_in_ce,

      len           TYPE i,

      data_table type table of tab_type,

      aux_data      TYPE tab_type,

     

      tab_upload    TYPE STANDARD TABLE OF string.

fileupload ?= cl_htmlb_manager=>get_data(

                       request = request

                       id      = 'excel_uploader'

                       name    = 'fileUpload' ).

file_content   = fileupload->file_content.

conv = cl_abap_conv_in_ce=>create( input = file_content ).

conv->read( IMPORTING data = content len = len ).

SPLIT content AT cl_abap_char_utilities=>cr_lf INTO TABLE tab_upload.

CLEAR content.

LOOP AT tab_upload INTO content.

  SPLIT content AT ',' INTO aux_data-city aux_data-city_id aux_data-state_id.

  Append aux_data TO data_table.

  CLEAR aux_data.

ENDLOOP.

Here in data_table i can see my excel content..But now i want to move that content into my database table zstate..It contains same fields of data_table.

Can any one help me...

Thanks and regards

santhosh.

             

                

                

            


Accepted Solutions (1)

Accepted Solutions (1)

BGarcia
Active Contributor
0 Kudos

Hi Santhosh,

You can try to use statements like this, to insert the data you uploaded:

INSERT zstate FROM TABLE data_table. "insert only
MODIFY zstate FROM TABLE data_table. "insert or modify records

Kind regards,
Garcia

Former Member
0 Kudos

Hi Garcia,

Thanks for your quick reply.

I am beginner of BSP.

Already I am tried that insert statement   but its not working..

my Database table "zstate"  contain Fields are like city,city_id,and state_id. I  have csv file that file fields are City, city_id,state_id.

Now i want to upload that file into my database table zstate.

This is my requirement..

Please give me solution...

Thanks and regards

santhosh..

matt
Active Contributor
0 Kudos

Insert data into a db table is very basic ABAP programming. Thread locked.

Answers (0)