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

Select with default value

Former Member
0 Likes
985

Hi guys,

      I'm trying to do a Select in a ABAP program, this select has values from SAP tables, but I have to put a default value like in SQL.

In SQL:

     Select 'VALUE' , TableField  from TABLE

But in my ABAP program it doesn't works.

does anyone knows a way to do it?

TKs

Eric Fioraso

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
881

Hi eric,

         please explain the question in detail?

7 REPLIES 7
Read only

Former Member
0 Likes
882

Hi eric,

         please explain the question in detail?

Read only

0 Likes
881

Hi prasanna,

          

  SELECT

    LQUA~WERKS

    LGORT

    LQUA~LGNUM

    LQUA~LGTYP

    LQUA~LGPLA

    LAGP~VERIF

    BESTQ

    LQUA~MATNR

    LENUM

    LQUA~CHARG

    MCHA~ZUSTD

    GESME

    MEINS

FROM LQUA INTO MYCUSTOM TABLE

This is my select, so I need to put a static field in this select like below

SELECT

     "DATA"      * Static field but doesn't works in this way

    LQUA~WERKS

    LGORT

    LQUA~LGNUM

    LQUA~LGTYP

    LQUA~LGPLA

    LAGP~VERIF

    BESTQ

    LQUA~MATNR

    LENUM

    LQUA~CHARG

    MCHA~ZUSTD

    GESME

    MEINS

    LQUA~LQNUM

    MEINS

    LQUA~VFDAT

    MCH1~HSDAT

    SOBKZ

    SONUM

FROM LQUA MYCUSTOMTABLE

regards,

Eric

Read only

yuri_ziryukin
Product and Topic Expert
Product and Topic Expert
0 Likes
881

Not sure if this works with SAP Open SQL. Probably not.

What will certainly work is to loop over the result table and set the required field.

loop at mycustomtable assigning <fs_customtable>.

  <fs_customtable>-field1 = 'DATA'.

endloop.

This will be relatively fast.

Read only

0 Likes
881

Thanks Yuri,

   The main question is this program will be a Job and will be executed every 5 minutes, for about 1000 records. I don't if I'll have performance issues with this approach.

Regards

Eric

Read only

0 Likes
881

Tks a Lot Yuri,

  

       The solution was use a Loop...

Regards

Eric

Read only

yuri_ziryukin
Product and Topic Expert
Product and Topic Expert
0 Likes
881

Hello Eric,

don't worry. "Loop assigning" is very fast. For your 1000 records it will take maybe a few milliseconds, not more.

Yuri

Read only

0 Likes
881

Tks Yuri, In fact it's very fast and I don't have performance issues.

Regards

Eric