Application Development and Automation 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: 
Read only

Problem with Selecting data from BSIK Table

Former Member
0 Likes
1,227

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,007

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

7 REPLIES 7
Read only

Former Member
0 Likes
1,007

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

Read only

Former Member
0 Likes
1,007

Fetch all the data into one internal table (dont use AUGBL conditin..)

And loop over this internal table twice for different conditions you specified.

Read only

Former Member
0 Likes
1,007

Hi Sekhar,

I will suggest you for cleared line items use table BSAK.

then try for the solution.

Regards,

Vijay

Read only

Former Member
0 Likes
1,007

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

Read only

Former Member
0 Likes
1,008

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

Read only

0 Likes
1,007

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.

Read only

Former Member
0 Likes
1,007

remove "AUGBL = ' '" from select statement.

and after getting the lines into a internal table is a loop filter the documents.