Application Development 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: 

Dynamical Modify or Insert

Former Member
0 Kudos

Hi All,

how can we modify and insert dynamically the Records into DDIC Table using

WHERE Conditions?

Thanks for your Replies.

Best Regards

Beserithan Malabakan

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Here is sample program from SAP documentation which uses dynamic WHERE clause within a SELECT statement.


DATA: COND(72) TYPE C,
      ITAB LIKE TABLE OF COND.

PARAMETERS: CITY1(10) TYPE C, CITY2(10) TYPE C.

DATA WA TYPE SPFLI-CITYFROM.

CONCATENATE 'CITYFROM = ''' CITY1 '''' INTO COND.
APPEND COND TO ITAB.
CONCATENATE 'OR CITYFROM = ''' CITY2 '''' INTO COND.
APPEND COND TO ITAB.
CONCATENATE 'OR CITYFROM = ''' 'BERLIN' '''' INTO COND.
APPEND COND TO ITAB.

LOOP AT ITAB INTO COND.
  WRITE COND.
ENDLOOP.

SKIP.

SELECT CITYFROM
INTO   WA
FROM   SPFLI
WHERE  (ITAB).

  WRITE / WA.

ENDSELECT.

You can also refer to this link for more details:

<a href="http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3a1f358411d1829f0000e829fbfe/frameset.htm">http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3a1f358411d1829f0000e829fbfe/frameset.htm</a>

Regards,

Sumant.

4 REPLIES 4

Former Member
0 Kudos

what do you mean by dynamically? can you please elaborate your requirement?

0 Kudos

I mean like this;

modify (ZTABLE) from wa where (lt_where_conditions).

But it doesnt work in this Form. The Same ought to be for Insert Command

Beserithan

Former Member
0 Kudos

Hi,

Here is sample program from SAP documentation which uses dynamic WHERE clause within a SELECT statement.


DATA: COND(72) TYPE C,
      ITAB LIKE TABLE OF COND.

PARAMETERS: CITY1(10) TYPE C, CITY2(10) TYPE C.

DATA WA TYPE SPFLI-CITYFROM.

CONCATENATE 'CITYFROM = ''' CITY1 '''' INTO COND.
APPEND COND TO ITAB.
CONCATENATE 'OR CITYFROM = ''' CITY2 '''' INTO COND.
APPEND COND TO ITAB.
CONCATENATE 'OR CITYFROM = ''' 'BERLIN' '''' INTO COND.
APPEND COND TO ITAB.

LOOP AT ITAB INTO COND.
  WRITE COND.
ENDLOOP.

SKIP.

SELECT CITYFROM
INTO   WA
FROM   SPFLI
WHERE  (ITAB).

  WRITE / WA.

ENDSELECT.

You can also refer to this link for more details:

<a href="http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3a1f358411d1829f0000e829fbfe/frameset.htm">http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3a1f358411d1829f0000e829fbfe/frameset.htm</a>

Regards,

Sumant.

Former Member
0 Kudos

Is there No Chance to this Topic?