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

SQL Statement at Runtime

Former Member
0 Likes
467

I need to update infotype table paXXXX but i only know the infotype number at runtime.

Is there any way i can write an UPDATE statement at runtime??

4 REPLIES 4
Read only

suresh_datti
Active Contributor
0 Likes
442

How are you doing the UPDATE ? direct db or function call.. either way, you can adopt the logic used for dynamic internal tables.. ( Pl search the forum with key phrase ' dynamic internal tables' )..

~Suresh

Read only

0 Likes
442

I'm doing the update directy.

Is there a standard function call that also implements update database operation???

i'm doing

UPDATE PAXXXX WHERE condition

The table name can change.

Read only

Former Member
0 Likes
442

Read my weblog <a href="/people/alvaro.tejadagalindo/blog/2006/03/03/tasting-the-mix-of-php-and-sap--volume-2 the mix of PHP and SAP - Volume 2</a> my custom FM <b>ZRFC_TABLE_OPERATIONS_LINE</b> might help you -:)

Greetings,

Blag.

Read only

Former Member
0 Likes
442

Use the following standard SAP program as a reference to generate dynamic conditions in SQL.

REPORT demo_select_dynamic_conditions .

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.

I hope that this will help you.

Regards,

Amey