Skip to Content
0
Former Member
May 03, 2007 at 09:43 AM

why isnt this query working ?

18 Views

Hello,

I have an table of line type

TYPES:
    BEGIN OF t_repdata,
      belnr   TYPE  belnr_d,        " Document No.
      lifnr   TYPE  wt_acno,        " Vendor No.
      lfnam   TYPE  lfa1-name1,     " Vendor Name
      lifntn  TYPE  stcd1,          " NTN
      lifnic  TYPE  stcd2,          " CNIC
      lifreg  TYPE  stcd1,          " Reg No.
      nature  TYPE  text40,         " Nature of Payment
      section TYPE  txt40,          " Section under whicn Tax deducted/collected
      bldat   TYPE  bldat,          " Date of Payment
      bsamt   TYPE  wt_bs1,         " WHT Base Amount
      reason  TYPE  text30,         " Reason for exemption
    END OF t_repdata.

am joining 3 tables and retrieving data,

SELECT bk~belnr wt~wt_acco lf~name1 lf~stcd1 lf~stcd2 lf~stcd1 bk~bldat wt~wt_qsshb
    INTO CORRESPONDING FIELDS OF TABLE gt_repdata FROM bkpf AS bk
      JOIN with_item AS wt ON ( wt~bukrs = bk~bukrs AND
                                wt~belnr = bk~belnr AND
                                wt~gjahr = bk~gjahr )

      JOIN lfa1 AS lf ON ( lf~lifnr = wt~wt_acco )

      WHERE bk~bukrs EQ p_bukrs AND
            bk~gjahr EQ p_gjahr AND
          ( bk~blart EQ 'KZ' OR bk~blart EQ 'ZP' ) AND
            bk~bldat IN s_bldat AND
            wt~wt_qbshb EQ 0 AND
            wt~wt_acco IN s_lifnr.

This query is only getting the belnr and bldat from bkpf , showing no data from WITH_ITEM or LFA1 in the table... wat is wrong with this query ?

Thanks and appreciated.

Shehryar Dahar