‎2010 Jul 05 7:41 AM
Hi Experts,
I am facing some problem while appending entries from internal table to database table.
data is coming to internal table but while appending , data base has no entries.
i am attaching my code below.
DATA : t_table TYPE TABLE OF zind_del.
DATA : wa_table LIKE zind_del.
LOOP AT t_infile INTO w_infile.
wa_table-mandt = sy-mandt.
wa_table-sys_date = syst-datum.
wa_table-release_number = w_infile-release_number.
wa_table-airbill_nbr = w_infile-airbill_nbr .
wa_table-est_del_date = w_infile-est_del_date .
wa_table-gross_weight = w_infile-gross_weight .
wa_table-transportation_c = w_infile-transportation_code .
wa_table-quantity_shipped = w_infile-quantity_shipped .
APPEND wa_table TO t_table.
MODIFY zind_del FROM TABLE t_table.
IF sy-subrc <> 0.
INSERT zind_del FROM TABLE t_table.
ENDIF.
CLEAR wa_table.
ENDLOOP.
Regards,
Lokeswari.
‎2010 Jul 05 10:31 AM
Hi,
Why are you modifying the table from internal table in a loop statement.You can build the internal
table in a loop which will modify the entries in the database table and then outside loop you can give the
modify command and also you after successfully modifying the ztable why are you again inserting the
entries of internal table into your ztable.
You can try giving COMMIT WORK ND WAIT after the modify statement to commit the changes to the database and
please lock the table before updating and release the lock afte rupdating your ztable.
DATA : t_table TYPE TABLE OF zind_del.
DATA : wa_table LIKE zind_del.
LOOP AT t_infile INTO w_infile.
wa_table-mandt = sy-mandt.
wa_table-sys_date = syst-datum.
wa_table-release_number = w_infile-release_number.
wa_table-airbill_nbr = w_infile-airbill_nbr .
wa_table-est_del_date = w_infile-est_del_date .
wa_table-gross_weight = w_infile-gross_weight .
wa_table-transportation_c = w_infile-transportation_code .
wa_table-quantity_shipped = w_infile-quantity_shipped .
APPEND wa_table TO t_table.
CLEAR wa_table.
ENDLOOP.
now you can lock the database table using FM ENQUEUE_E_TABLE and write
MODIFY zind_del FROM TABLE t_table.
commit work and wait.
now release the lock by using FM DEQUEUE_E_TABLE.
Thanks.