2007 Sep 21 11:30 AM
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?
in my excel sheet have a mandt but
insert ztab from table itab ccepting duplicate keys.
it doesnt work but ı dont know why?
2007 Sep 21 11:33 AM
Hi,
insert ztable from table t_datatab accepting duplicate keys.
reward if solved problem**
2007 Sep 21 11:33 AM
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.
2007 Sep 21 11:52 AM
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.
2007 Sep 21 12:08 PM
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
2007 Sep 21 12:01 PM
2007 Sep 21 12:05 PM
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
2007 Sep 21 12:26 PM
in my excel sheet have a mandt but
insert ztab from table itab ccepting duplicate keys.
it doesnt work but ı dont know why?
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |