12-19-2006 2:28 PM
Hallow I build a table in se11 that I can put on her data from my itab how can I clean the table before I put a new data. I try with delete but its not working and refresh given me an error that I have not a header line . what can I do. Thankes
DELETE yhr_ex_mushlach.
LOOP AT itab1.
SPLIT itab1 AT ',' INTO:
itab-id_number
itab-rama
itab-hagbla1
itab-date_start_hagbl
itab-date_stop_hagbla.
IF itab-id_number > 0 .
w_length = STRLEN( itab-id_number ).
w_length = w_length - 1.
itab-pernr = itab-id_number+0(w_length).
ELSE.
itab-pernr = 0.
ENDIF.
APPEND itab.
ENDLOOP.
loop at itab.
modify yhr_table_muslah from itab.
end loop.
12-19-2006 2:35 PM
hi i think u want to clear the Z TABLE and again enter new data into it...
Just follow this sample code....
DELETE FROM ZTABLE WHERE ACCNO <> 1.
<b>just identify a key field which will never be equal to a value, in the above statement ACCNO will never be equal to the value '1', so it will be cleared</b>
award points if found helpful, this worked fine in my case
12-19-2006 2:35 PM
hi i think u want to clear the Z TABLE and again enter new data into it...
Just follow this sample code....
DELETE FROM ZTABLE WHERE ACCNO <> 1.
<b>just identify a key field which will never be equal to a value, in the above statement ACCNO will never be equal to the value '1', so it will be cleared</b>
award points if found helpful, this worked fine in my case
12-19-2006 2:37 PM
I am assuming ITAB is of the same structure of YHR_TABLE_MUSLAH.
If that is the case, do this
<b>modify yhr_table_muslah from table itab.</b>
Regards,
Ravi
12-19-2006 2:41 PM
12-19-2006 2:41 PM
12-19-2006 2:45 PM
Do you have a COMMIT after the MODIFY statement?
Is it throwing a error?
Regards,
Ravi
12-19-2006 2:53 PM
hi ravi no i dont have commit and it dont bring err but when i get a new file that i wont to put in yhr_table_muslh the table is full with old data
12-19-2006 2:48 PM
<b>DELETE yhr_ex_mushlach where PRIMARYKEY <> SPACE.</b>
this will erase the whole Z TABLE.
This should work if u want to just clear the Z TABLE.
If u want to insert data into the same table yhr_ex_mushlach then u can use this statement
<b>modify yhr_table_muslah from itab.</b>
12-19-2006 3:33 PM
try this code.
DELETE from yhr_ex_mushlach.
LOOP AT itab1.
SPLIT itab1 AT ',' INTO:
itab-id_number
itab-rama
itab-hagbla1
itab-date_start_hagbl
itab-date_stop_hagbla.
IF itab-id_number > 0 .
w_length = STRLEN( itab-id_number ).
w_length = w_length - 1.
itab-pernr = itab-id_number+0(w_length).
ELSE.
itab-pernr = 0.
ENDIF.
APPEND itab.
ENDLOOP.
before doing this sort the itab by the primary keys in your database table and delete itab by comparing the primary keys,
DELETE ADJACENT DUPLICATES FROM itab comparing <fields>
INSERT yhr_table_muslah FROM TABLE itab.
or you can use ths also
update yhr_table_muslah FROM TABLE itab.
Hope this will solve u r problem.
Thanks n regards