Skip to Content
0
Former Member
Dec 13, 2006 at 08:10 PM

SELECT QUESTION.

40 Views

HI!

OK, I need help here. In the specification I need to take out data for contracts and sales orders from the table VBAK but for contracts I need to use the VALID FROM and VALID TO parameters but for the sales orders I need for the date only the field of the document date to make the search. I don't want to use two SELECTS for the same table. Exist a way to make this with one SELECT only?

Thanks!

The validation that I need to use for the search are:

AUART - Document Type

GUEBG - Valid From

GUEEN - Valid To

AUDAT - Document Date

-


For contracts:

Document Type: 'ZCBH and ZCBTR'

The Valid From : = 11/30/2006

The Valid To: >= 11/30/2006

For sales orders:

Document Type: 'ZHCD and ZBRC'.

Document Date: only the month of december.

-


For the moment I have this: but I want one select not two.

*FOR CONTRACT
SELECT VBLEN KUNNR 
  FROM VBAK INTO TABLE T_VBAK1
  WHERE AUART = ZCBH
    AND AUART = ZCBR
    AND GUEBG = 20061130
    OR  GUEEN > 20061130.

*FOR SALES ORDERS.    
SELECT VBLEN KUNNR
  FROM VBAK INTO TABLE T_VBAK2
  WHERE AUART = ZHCS
    AND AUART = ZBRC
    AND AUDAT+4(2) = '12'.