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: 

Please tell me why use the "~" in the select steatment??

Former Member
0 Kudos

Hi, all

I have a poor question about abap report programing.

Please tell me why use the "~" in the select steatment??

AND which case we should use the "~" in the select steatment??

>>           AND countryto = dv_flights~countryfr.


report name:Y_33_BC405_SSCS_1AE01

SELECT * FROM dv_flights INTO wa_flight
         WHERE carrid IN so_car
           AND connid IN so_con
           AND fldate IN so_fdt
           AND countryto = dv_flights~countryfr.

======================================

*&---------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*&   Event INITIALIZATION
*&---------------------------------------------------------------------*
INITIALIZATION.
* Initialize select-options for CARRID" OPTIONAL
   MOVE: 'AA' TO so_car-low,
         'QF' TO so_car-high,
         'BT' TO so_car-option,
         'I' TO so_car-sign.
   APPEND so_car.
   CLEAR so_car.

   MOVE: 'AZ' TO so_car-low,
         'EQ' TO so_car-option,
         'E' TO so_car-sign.
   APPEND so_car.


*&---------------------------------------------------------------------*
*&   Event START-OF-SELECTION
*&---------------------------------------------------------------------*
START-OF-SELECTION.

* Checking the output parameters
   CASE mark.
     WHEN pa_all.
* Radiobutton ALL is marked
       SELECT * FROM dv_flights INTO wa_flight
         WHERE carrid IN so_car
           AND connid IN so_con
           AND fldate IN so_fdt.

         WRITE: / wa_flight-carrid,
                  wa_flight-connid,
                  wa_flight-fldate,
                  wa_flight-countryfr,
                  wa_flight-cityfrom,
                  wa_flight-airpfrom,
                  wa_flight-countryto,
                  wa_flight-cityto,
                  wa_flight-airpto,
                  wa_flight-seatsmax,
                  wa_flight-seatsocc.
       ENDSELECT.

     WHEN pa_nat.
* Radiobutton NATIONAL is marked
       SELECT * FROM dv_flights INTO wa_flight
         WHERE carrid IN so_car
           AND connid IN so_con
           AND fldate IN so_fdt
           AND countryto = dv_flights~countryfr.

         WRITE: / wa_flight-carrid,
                  wa_flight-connid,
                  wa_flight-fldate,
                  wa_flight-countryfr,
                  wa_flight-cityfrom,
                  wa_flight-airpfrom,
                  wa_flight-countryto,
                  wa_flight-cityto,
                  wa_flight-airpto,
                  wa_flight-seatsmax,
                  wa_flight-seatsocc.
       ENDSELECT.


     WHEN pa_int.
* Radiobutton INTERNATIONAL is marked
       SELECT * FROM dv_flights INTO wa_flight
         WHERE carrid IN so_car
           AND connid IN so_con
           AND fldate IN so_fdt
           AND countryto <> dv_flights~countryfr.
*         AND countryto <> countryfr.

         WRITE: / wa_flight-carrid,
                  wa_flight-connid,
                  wa_flight-fldate,
                  wa_flight-countryfr,
                  wa_flight-cityfrom,
                  wa_flight-airpfrom,
                  wa_flight-countryto,
                  wa_flight-cityto,
                  wa_flight-airpto,
                  wa_flight-seatsmax,
                  wa_flight-seatsocc.
       ENDSELECT.


   ENDCASE.

Thanks a lot in advance

and Best regards.

Akihiro.

Moderator message: please read ABAP documentation before posting.



Message was edited by: Thomas Zloch

2 REPLIES 2

Former Member
0 Kudos

Dear Akihiro,

DV_FLIGHTS- Is a database view. not table. so when we read from database view we have to use '~'.

The same concept which is used in INNER JOIN.

The database view is nothing but Inner join.

Regards,

Ramya R

Former Member
0 Kudos

Hi,

'~' is used to specify the table name from which the field has to be taken. If the same field is present in two or tables in a select query (in JOIN or selction from a view), '~' is used to specify the table name from which the field has to be taken.

Cheers

~Niranjan