Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Data Deletion from Database table

Former Member
0 Likes
366

Hi Experts,

My requirement is,

1. From the selection screen, I want to get the table name and fieldname.

2. BAsed on that, I have delete the data from the mentioned database table.

I have written the below code , in that runtime I am getting the db table name and I am deleting the data... but I want to mention the fieldname also in runtime...

Kindly help me..


REPORT ZSBN_TESTDELETE .
 
TABLES : DD02L.
 
DATA : WF_TABNAME  LIKE DD02L-TABNAME.
 
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-000.
SELECT-OPTIONS   : S_TABLE FOR DD02L-TABNAME OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK B1.
 
 
DELETE FROM (S_TABLE-LOW)
       WHERE
             J_1IBUKRS EQ '6600'.

With Rgds,

S.Barani

2 REPLIES 2
Read only

pavel_parshenkov2
Participant
0 Likes
335

Hi

You can use code like this:



DATA lt_tab_where TYPE TABLE OF string.

REFRESH  lt_tab_where[].

CLEAR lt_tab_where.

APPEND l_field_name     TO lt_tab_where.
APPEND '  EQ '              TO lt_tab_where.
APPEND ' '''                    TO lt_tab_where.
APPEND l_field_value      TO lt_tab_where.
APPEND ''' '                    TO lt_tab_where.

DELETE FROM (S_TABLE-LOW)
       WHERE (lt_tab_where).

or


DATA l_where(100).

CONCATENATE l_filed_name ' EQ ' '''' l_filed_value '''' INTO l_where.

DELETE FROM (S_TABLE-LOW)
       WHERE (l_where).

Edited by: Pavel Parshenkov on May 30, 2008 11:16 AM

Read only

Former Member
0 Likes
335

creata a <field-symbol>

data: <field-symbol> type any.

DELETE FROM <field-symbol>WHERE <field-symbol> = 'LH' AND

<field-symbol> = '0400' AND

<field-symbol> = '20010228'

ask user to enter the field name........

i think this wiiill help u.........

if it is useful Plz Reward

Regards

Anbu