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

EXEC SQL STATEMENT

Former Member
0 Likes
501

Is there something wrong with this EXEC SQL Statement...

        EXEC SQL PERFORMING sr_STORE_data.
          select *
                 into :<FS_wt> @:c_db
                 from (lwt_source-PS_STRUCT)
                 where sb_effdt = :p_date
        ENDEXEC.

3 REPLIES 3
Read only

Former Member
0 Likes
457

Try this way...

EXEC SQL.

OPEN C1 FOR

SELECT A,B,C,D

FROM SAPTEST.XX1

ENDEXEC.

Read only

Former Member
0 Likes
457

hi,

Check whether the table name can be passed dynamically by specifying it in parantheses.

check this sample code, it might help you,


**** A field-symbol to access that work area 
  assign NEW_LINE->*  to <wa_it>. 
*PERFORMING loop using <wa_it> changing itab_test 

  EXEC SQL. 
   open c for 
   SELECT 
   HOB_KH_IK as Ik, count(*) as ANZAHL, 
   AVG(ENTL_DATUM - HOB_AUFN_DAT) AS VWD, 
   SUM(KOSTEN_GESAMT/100)  as KOSTEN 
  FROM BUSI.BW02_K_FALL 
  GROUP BY HOB_KH_IK 

  ENDEXEC. 


 DO. 
      EXEC SQL. 
        fetch next c into :<wa_it> 
      ENDEXEC. 
      IF sy-subrc <> 0. 
        EXIT. 
      ENDIF. 
      append <wa_it> to itab_test. 
    ENDDO. 

    EXEC SQL. 
      close c 
    ENDEXEC. 

    write: / 'OK ?'. 

Regards,

Sailaja.

Message was edited by:

Sailaja Nalam

Read only

sridhar_k1
Active Contributor
0 Likes
457

@: not allowed after INTO, use : before a variable.

Dynamic table assignment not allowd, use table name after FROM instead of a variable.

Regards

Sridhar