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

error ! insert dbtab into from table itab

Former Member
0 Likes
849

report zdeneme_54.

TYPE-POOLS: truxs.

tables : ztable.

PARAMETERS: p_file TYPE rlgrap-filename.

data : t_datatab like table of ztable with header line.

data : w_datatab like line of 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.

break zsirin.

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 = t_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.

insert ztable from table t_datatab.

pls solve this problem?

7 REPLIES 7
Read only

Former Member
0 Likes
808

Hi,

insert ztable from table t_datatab accepting duplicate keys.

    • reward if solved problem**

Read only

Former Member
0 Likes
808

report zdeneme_54.

TYPE-POOLS: truxs.

tables : ztable.

PARAMETERS: p_file TYPE rlgrap-filename.

data : t_datatab like table of ztable with header line.

data : w_datatab like line of 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.

break zsirin.

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 = t_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.

if not t_datatab[] is initial.

insert ztable from table t_datatab.

COMMIT WORK.

Message 'Data stored successfully !' type 'I'.

else.

Message 'File uploaded is blank!' type 'I'.

endif.

Read only

Former Member
0 Likes
808

if t_datatab[] is initial.

insert ztable from table t_datatab accepting duplicate keys.

COMMIT WORK.

Message 'Data stored successfully !' type 'I'.

else.

Message 'File uploaded is blank!' type 'I'.

endif.

but it isnt import data my zdbtable correctly.

Read only

0 Likes
808

Hi,

try to use modify statement and chek..

if t_datatab[] is not initial.

Modify ztable from table t_datatab accepting duplicate keys.

COMMIT WORK.

Message 'Data stored successfully !' type 'I'.

else.

Message 'File uploaded is blank!' type 'I'.

endif.

Regards,

Nagaraj

Read only

Former Member
0 Likes
808

Correction

if t_itab is NOT initial.

<insert.>

endif.

Read only

Former Member
0 Likes
808

i am not sure what are the data you are passing by excel. But you have declared

data : t_datatab like table of ztable with header line.

so your itab contains the MANDT field also . Are you passing that in excel? If not just insert a column in the first and fill the data for MANDT column. Just check in debug mode your itab contains the data in correct way or not..

regards

shiba dutta

Read only

0 Likes
808

in my excel sheet have a mandt but

insert ztab from table itab ccepting duplicate keys.

it doesnt work but &#305; dont know why?