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: 

Replacing GET by a SELECT query

Former Member
0 Kudos

hi all.

i have a get+check options syntax in a report.

i want to replace the code with a select query..

i want to replace GET + CHECKby SELECT+WHERE...

but when does this GET statement end? like if i replace it with select, then i would have to put ENDSELECT somewhere.. i guess there is no ENDGET in the report..

the code is like as follows...

START-OF-SELECTION.

GET ekko FIELDS bstyp ebeln ekorg ekgrp bedat ernam lifnr.

CHECK select-options.

CHECK ekko-bstyp = 'F'.

PERFORM some_subroutine

IF sy-subrc EQ 0.

"LOTS OF CODE PROCESSING"

ENDIF.

TOP-OF-PAGE.

"some code"

END-OF-SELECTION.

so, how do i replace it with the select query?

does the GET statement is executed for entire START-OF-SELECTION event?

also, whenever this GET is executed, does it fetch a single entry from the database table to work-area?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

data : begin of it_tab,
         bstyp like ekko-bstyp,
        ebeln like ekko-ebeln,
         ekorg like ekko-ekorg,
          ekgrp like ekko-ekgrp,
          bedat like ekko-bedat,
         ernam  like ekko-ernam,
           lifnr like ekko-lifnr,
   end of it_tab.

START-OF-SELECTION.
select bstyp ebeln ekorg ekgrp bedat ernam lifnr 
from    ekko
into table it_tab
where ekko-bstyp = 'F'.

PERFORM some_subroutine

IF sy-subrc EQ 0.

"LOTS OF CODE PROCESSING"

ENDIF.

TOP-OF-PAGE.
"some code"

END-OF-SELECTION.

Thnaks

Vikranth

3 REPLIES 3

Former Member
0 Kudos

Hi Chinmay,

Since GET and CHECK together works like SELECT and WHERE, you dont need to either put ENDGET or ENDSELECT.

I think GET will end once it is executed. So it will select records and CHECK will filter them.

You can easily replace it by selecting data in internal table with where clause in place and then can process data from internal table.

thanks,

ags.

Former Member
0 Kudos

something like this:

parameters:EBELN like ekko-EBELN.

data: begin of it_ekko occurs 0,

bstyp like ekko-bstyp,

EBELN like ekko-EBELN,

ekorg like ekko-ekorg,

ekgrp like ekko-ekgrp,

bedat like ekko-bedat,

ernam like ekko-ernam,

lifnr like ekko-lifnr,

end of it_ekko.

start-of selection

select bstyp ebeln ekorg ekgrp bedat ernam lifnr

into corresponding fields of table it_ekko from

ekko where ebeln = ebeln.

END-OF-SELECTION.

loop at it_ekko.

endloop.

Former Member
0 Kudos

Hi,

data : begin of it_tab,
         bstyp like ekko-bstyp,
        ebeln like ekko-ebeln,
         ekorg like ekko-ekorg,
          ekgrp like ekko-ekgrp,
          bedat like ekko-bedat,
         ernam  like ekko-ernam,
           lifnr like ekko-lifnr,
   end of it_tab.

START-OF-SELECTION.
select bstyp ebeln ekorg ekgrp bedat ernam lifnr 
from    ekko
into table it_tab
where ekko-bstyp = 'F'.

PERFORM some_subroutine

IF sy-subrc EQ 0.

"LOTS OF CODE PROCESSING"

ENDIF.

TOP-OF-PAGE.
"some code"

END-OF-SELECTION.

Thnaks

Vikranth