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

BAPI - DATA TRANSFER FROM .XLS FILE TO DB TABLE

Former Member
0 Likes
712

I am upload data from xls file to database table.

first i have load xls file data to internal table (it_data) that is working.

then from internal table to database table (zskv_rate) by function module (ZBAPI_RATE_SAVEDATA) which is not working.

ex.

LOOP AT IT_DATA.

  • Header

ZSKV_RATE-DIVN = IT_DATA-DIVN.

ZSKV_RATE-REGN = IT_DATA-REGN.

ZSKV_RATE-PLANT = IT_DATA-PLANT.

ZSKV_RATE-RATE = IT_DATA-RATE.

  • APPEND IT_DATA.

CALL FUNCTION 'ZBAPI_RATE_SAVEDATA'

EXPORTING

HEADDATA = ZSKV_RATE

IMPORTING

RETURN = BAPI_RETURN

TABLES

DATA = IT_DATA

.

IF BAPI_RETURN-TYPE = 'E'.

WRITE:/ 'Error:' ,BAPI_RETURN-MESSAGE ,'for material:' ,IT_DATA-DIVN.

ELSEIF BAPI_RETURN-TYPE = 'S'.

WRITE: 'Successfully created material' ,IT_DATA-DIVN.

ELSE.

WRITE:/ 'NONE' ,IT_DATA-DIVN.

ENDIF.

ENDLOOP.

how to transfer data from internal table to database table.

I am upload data from xls file to database table.

first i have load xls file data to internal table (it_data) that is working.

then from internal table to database table (zskv_rate) by function module (ZBAPI_RATE_SAVEDATA) which is not working.

ex.

LOOP AT IT_DATA.

  • Header

ZSKV_RATE-DIVN = IT_DATA-DIVN.

ZSKV_RATE-REGN = IT_DATA-REGN.

ZSKV_RATE-PLANT = IT_DATA-PLANT.

ZSKV_RATE-RATE = IT_DATA-RATE.

  • APPEND IT_DATA.

CALL FUNCTION 'ZBAPI_RATE_SAVEDATA'

EXPORTING

HEADDATA = ZSKV_RATE

IMPORTING

RETURN = BAPI_RETURN

TABLES

DATA = IT_DATA

.

IF BAPI_RETURN-TYPE = 'E'.

WRITE:/ 'Error:' ,BAPI_RETURN-MESSAGE ,'for material:' ,IT_DATA-DIVN.

ELSEIF BAPI_RETURN-TYPE = 'S'.

WRITE: 'Successfully created material' ,IT_DATA-DIVN.

ELSE.

WRITE:/ 'NONE' ,IT_DATA-DIVN.

ENDIF.

ENDLOOP.

how to transfer data from internal table to database table.

3 REPLIES 3
Read only

Former Member
0 Likes
631

HI,

Updating to the database put the commit statement.

Read only

Former Member
0 Likes
631

Hi Sanjeev,

as u hv uploaded the excel file into the internal table,

u can update the ztable from internal table..


modify <dbtab>from itab.

regards.

Mdi.Deeba

Read only

Former Member
0 Likes
631

hi,

Check out using the INSERT statement.

Insert zskv_rate from table it_data.

This shall solve your purpose.

Regards

Sharath