Skip to Content
avatar image
Former Member

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

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

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

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • Jul 11, 2017 at 12:30 PM

    MODIFY zpersonal FROM TABLE it_datatab.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 10, 2017 at 09:28 PM

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

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 23, 2017 at 10:04 AM

    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

    Add comment
    10|10000 characters needed characters exceeded