Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Truncate Command Not working

Folks, I have a SAP Table that I want to delete all the data from but still want to keep the table definition.. I dont want to fetch the records and then delete as this is a huge table so want to use a truncate command. The issue is that program has no syntax errors but it would not delete the data at all. Here is the code I have used and I am on a DB2 system, can someone help what I am doing wrong?

DATA: exc_ref TYPE REF TO cx_sy_native_sql_error,

error_text TYPE string.

TRY.

EXEC SQL.

TRUNCATE TABLE S194

ENDEXEC.

CATCH cx_sy_native_sql_error INTO exc_ref.

error_text = exc_ref->get_text( ).

ENDTRY.

IF SY-SUBRC = 0.

commit work.

ELSE.

write : / error_text .

ENDIF.

Message was edited by:

Ram Gowda

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question