Quantcast
Viewing all articles
Browse latest Browse all 9076

How to check the two logic at a single statement for a particular filed in a table using 'WHERE' ?

Hi Friends,

                 there is a table to hold for cab processing details, Cab request has different status like

S = Employee created the Request

C =  Employee Cancelled the request.

A = Manager Approved.

T = Travel Desk approved.

R = Request Rejected.

P = Vendor approved ( Cab booked ) .

 

here i want to fetch only approved request that is vendor approval . but after request is confirmed by vendor Employee need to cancel the trip, so  he cancelling the approved request. Now i want fetch only request status = P and status <> C . How to write select query for this ? i tried with the following style but it doesn't  work.

 

Could you please explain about how to check two logic for same filed ?

 

Please review my code and output.

 

 

REPORT ZKARTHI_CAB_TESTING.

TABLES: zfi_cab_process.

 

DATA: wa_zfi_cab_process type zfi_cab_process,

       it_zfi_cab_process TYPE STANDARD TABLE OF zfi_cab_process.

WRITE:/ 'All the data from cab table'.

skip 2.

SELECT * FROM zfi_cab_process INTO CORRESPONDING FIELDS OF TABLE it_zfi_cab_process.

SORT it_zfi_cab_process BY CBRNM.

PERFORM print_itab.

 

skip 2.

CLEAR: it_zfi_cab_process[], wa_zfi_cab_process.

WRITE: / 'Cab Request used by Employee'.

SKIP 2.

SELECT  * FROM zfi_cab_process INTO CORRESPONDING FIELDS OF TABLE it_zfi_cab_process

*  WHERE stats  in ('P') and stats not in ('C').

*  WHERE STATS NE 'C' AND STATS EQ 'P'.

*  WHERE STATS EQ 'P' AND STATS NE 'C'.

*  WHERE STATS EQ 'P' AND STATS not LIKE 'C'.

   WHERE  stats NOT IN ('A', 'S', 'D', 'S', 'T', 'C').

 

PERFORM print_itab.

 

FORM print_itab.

 

 

   WRITE:/5 'Request Number', 25 'Approver id', 40 'Status of the Request'.

   LOOP at it_zfi_cab_process INTO wa_zfi_cab_process.

 

     WRITE:/5  wa_zfi_cab_process-cbrnm,

           25 wa_zfi_cab_process-prcsr,

           40 wa_zfi_cab_process-stats.

   ENDLOOP.

 

ENDFORM.

 

 

In result it shows both the vendor approved and employee cancelled request.

 

Thank you Guys.


Viewing all articles
Browse latest Browse all 9076

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>