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

data selection

Former Member
0 Likes
817

hi,

I have to select data from tables bkpf , bkdf , bseg and anla and club them into a final internal table and the selection criteria is

1) company code - select-option - Mandatory .

2) cost center -select-option - if not entered should work for all cost

centers ( taken from csks table)

3) vendor number - select-option - if not entered should work for all vendors

( taken from lfa1 table)

Kindly suggest how should i select data.

4 REPLIES 4
Read only

former_member386202
Active Contributor
0 Likes
730

Hi,

Select data bkpf then using FOR ALL ENTRIES slect data from remaing tables based on selection screen then using read statement collect all data into one internal table and display it.

Regards,

Prashant

Read only

Former Member
0 Likes
730

Hi

use FOR ALL ENTRIES for joining these tables

Read only

Former Member
0 Likes
730

hi riches,

I wrote select query using for all entries.See if it is usful.

i have declared one inetrnal table ,wa and temp table for all given tables and also one final table.

SELECT BUKRS

BELNR

GJAHR

BLART

FROM BKPF

INTO TABLE I_BKPF

WHERE BUKRS IN S_BUKRS

AND BELNR IN S_BELNR.

IF SY-SUBRC EQ 0.

SORT I_BKPF BY BELNR.

ENDIF.

IF NOT I_BKPF[] IS INITIAL.

TEMP_BKPF[] = I_BKPF[].

DELETE ADJACENT DUPLICATES FROM TEMP_BKPF[].

ENDIF.

SELECT BUKRS

BELNR

GJAHR

FROM BKDF

INTO TABLE I_BKDF

FOR ALL ENTRIES IN TEMP_BKPF

WHERE BELNR = TEMP_BKPF-BELNR

AND BUKRS = TEMP_BKPF-BUKRS.

IF SY-SUBRC EQ 0.

SORT I_BKDF BY BELNR.

ENDIF.

IF NOT I_BKDF[] IS INITIAL.

TEMP_BKDF[] = I_BKDF[].

DELETE ADJACENT DUPLICATES FROM TEMP_BKDF[].

ENDIF.

SELECT BUKRS

BELNR

GJAHR

BUZEI

KOART

AUGDT

FROM BSEG

INTO TABLE I_BSEG

FOR ALL ENTRIES IN TEMP_BKDF

WHERE BUKRS = TEMP_BKDF-BUKRS.

IF SY-SUBRC EQ 0.

SORT I_BSEG BY BELNR.

ENDIF.

IF NOT I_BSEG[] IS INITIAL.

TEMP_BSEG[] = I_BSEG[].

DELETE ADJACENT DUPLICATES FROM TEMP_BSEG[].

ENDIF.

SELECT BUKRS

ANLN1

ANLN2

FROM ANLA

INTO TABLE I_ANLA

FOR ALL ENTRIES IN TEMP_BSEG

WHERE BUKRS = TEMP_BSEG-BUKRS.

IF SY-SUBRC = 0.

IF NOT I_ANLA[] IS INITIAL.

TEMP_ANLA[] = I_ANLA[].

DELETE ADJACENT DUPLICATES FROM TEMP_ANLA[].

ENDIF.

ENDIF.

after that we need to start process.

Reward if it usful.

Thanks ,

Srikanth.

Read only

0 Likes
730

Srikanth.

thanks a lot