‎2009 Sep 22 10:55 AM
Hi ,
i got stuck up with one problem.
i am fetching data from BSIK table where AUGBL equals to space ( means open items)
AUGDT <= 30.06.2009
My select staement is as shown below
SELECT SINGLE LIFNR INTO OP_ITEM-LIFNR
FROM BSIK
WHERE BELNR = OP_ITEM-BELNR
AND BUKRS = P_RBUKRS
AND GJAHR = OP_ITEM-GJAHR
AND HKONT = OP_ITEM-RACCT
AND BUZEI = OP_ITEM-BUZEI
AND AUGBL = ' '.
at the same time i want to fetch Cleared items between date 30.06.2009 to 30.07.2009 ( means AUGBL <> ' '.)
Now how can i include this condition in above select statement
Thanks.
‎2009 Sep 22 11:01 AM
Hi
BSIK table contains the open items only: so the field AUGBL is always empty.
The cleared items are in BSAK table, so u need to use two different conditions for two dofferent selection: one for BSIK and one for BSAK
Max
‎2009 Sep 22 10:58 AM
Hi,
Remove AUGBL from the SELECT statement and get the data for all conditions into a single internal table.You can then separate your data to other internal tables according to the scenarios
‎2009 Sep 22 10:58 AM
Fetch all the data into one internal table (dont use AUGBL conditin..)
And loop over this internal table twice for different conditions you specified.
‎2009 Sep 22 10:58 AM
Hi Sekhar,
I will suggest you for cleared line items use table BSAK.
then try for the solution.
Regards,
Vijay
‎2009 Sep 22 10:59 AM
Hi,
Use the OR condition
SELECT SINGLE LIFNR INTO OP_ITEM-LIFNR
FROM BSIK
WHERE BELNR = OP_ITEM-BELNR
AND BUKRS = P_RBUKRS
AND GJAHR = OP_ITEM-GJAHR
AND HKONT = OP_ITEM-RACCT
AND BUZEI = OP_ITEM-BUZEI
AND AUGBL = ' '
OR AUGBL BETWEEN '20090630' AND '20090730'.
Regards,
Vikranth
‎2009 Sep 22 11:01 AM
Hi
BSIK table contains the open items only: so the field AUGBL is always empty.
The cleared items are in BSAK table, so u need to use two different conditions for two dofferent selection: one for BSIK and one for BSAK
Max
‎2009 Sep 22 11:13 AM
Hai...
see this code for example
SELECT BUKRS
LIFNR
augdt
ZUONR
BELNR
BLDAT
XBLNR
BLART
SHKZG
WRBTR
INTO CORRESPONDING FIELDS OF IT_BSIK
FROM BSIK
WHERE LIFNR IN S_LIFNR
AND BUKRS IN S_BUKRS
and SHKZG = 'H'
and bLdat <= S_DATE.
APPEND IT_BSIK.
CLEAR IT_BSIK.
ENDSELECT.
SELECT BUKRS
LIFNR
augdt
ZUONR
BELNR
BLDAT
XBLNR
BLART
SHKZG
WRBTR
INTO CORRESPONDING FIELDS OF IT_BSIK1
FROM BSIK
WHERE LIFNR IN S_LIFNR
AND BUKRS IN S_BUKRS
and SHKZG = 'S'
and bLdat <= S_DATE.
APPEND IT_BSIK1.
CLEAR IT_BSIK1.
ENDSELECT.
‎2009 Sep 22 11:10 AM
remove "AUGBL = ' '" from select statement.
and after getting the lines into a internal table is a loop filter the documents.