Skip to Content
0

while uploading data from excel sheet to database table(se11) table no updation is there

Jul 11, 2017 at 09:43 AM

61

avatar image
Former Member

structure is correct. while debugging data is showing in internal table.
when i execute the code data is not displaying in my database table.

REPORT zupload_excel.
TYPE-POOLS: truxs.
TABLES zpersonal.

PARAMETERS: p_file TYPE rlgrap-filename.


TYPES: BEGIN OF t_datatab,
name TYPE zpersonal-name,
password TYPE zpersonal-password,
dob TYPE zpersonal-dob,
gender TYPE zpersonal-gender,
contact TYPE zpersonal-contact,
adress TYPE zpersonal-adress,
END OF t_datatab.

DATA: it_datatab TYPE TABLE OF t_datatab,
wa_datatab LIKE zpersonal.
DATA: it_raw TYPE truxs_t_text_data.

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.

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_line_header = 'X'
i_tab_raw_data = it_raw " WORK TABLE
i_filename = p_file
TABLES
i_tab_converted_data = it_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.

LOOP AT it_datatab INTO wa_datatab.
WRITE : / wa_datatab.
INSERT INTO zpersonal VALUES wa_datatab.
ENDLOOP.

* LOOP AT it_datatab.
* MODIFY zpersonal FROM it_datatab.
* ENDLOOP.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

avatar image
Former Member Jul 11, 2017 at 01:20 PM
0

Hi Manish,

you need to create a structure of t_datatab such as wa_datatab type of t_datatab and wa_personal like zpersonal. Replace the following code where u r processing the loop and insert row into zpersonal table.

loop at LOOP AT it_datatab INTO wa_datatab.

" assigned the record in correct field so that there is not data mismatch

wa_personal-field1 = wa_datatab-field1 "

wa_personal-field2 = wa_datatab-field2

" modify or insert record in database table.

insert into zpersonal value wa_personal.

" or

modify zpersonal from wa_personal.

endloop.

I think when u are trying to modify or insert in zpersonal database table there value of wa_datatab mismatch or type conflict.

So you need to pass correct value in correct field then modify zpersonal database table.

It will work.

Share
10 |10000 characters needed characters left characters exceeded
Volker Binder Jul 11, 2017 at 12:30 PM
0

MODIFY zpersonal FROM TABLE it_datatab.

Share
10 |10000 characters needed characters left characters exceeded
Jelena Perfiljeva
Oct 10, 2017 at 09:28 PM
0

Might want to check SY-SUBRC after a DB operation. Read documentation.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Nov 23, 2017 at 10:04 AM
0

Hi Manish,

If you got answer of your question then please close the thread. Give the point as per the right answer or helpful answer.

Regards,

Sunny

Share
10 |10000 characters needed characters left characters exceeded