Skip to Content
0
Former Member
Oct 30, 2007 at 01:22 PM

BDC

15 Views

Hi,

----


FORM fetch_condition_records .

REFRESH : t_final , t_vbak1 , t_konv .

SELECT vbeln

auart

vkorg

vtweg

spart

vkbur

knumv

FROM vbak

INTO TABLE t_vbak1

WHERE vbeln EQ w_vbeln.

r_kschl-sign = c_i.

r_kschl-option = c_eq.

r_kschl-low = 'ZGRT'.

APPEND r_kschl.

r_kschl-sign = c_i.

r_kschl-option = c_eq.

r_kschl-low = 'ZGLD'.

APPEND r_kschl.

r_kschl-sign = c_i.

r_kschl-option = c_eq.

r_kschl-low = 'ZGRR'.

APPEND r_kschl.

r_kschl-sign = c_i.

r_kschl-option = c_eq.

r_kschl-low = 'ZGT1'.

APPEND r_kschl.

r_kschl-sign = c_i.

r_kschl-option = c_eq.

r_kschl-low = 'ZGT2'.

APPEND r_kschl.

SELECT knumv

stunr

zaehk

kschl

kvarc

kbetr

krech

varcond

FROM konv

INTO TABLE t_konv

FOR ALL ENTRIES IN t_vbak1

WHERE knumv EQ t_vbak1-knumv AND

kschl IN r_kschl.

SORT t_konv .

LOOP AT t_vbak1 INTO wa_vbak1.

LOOP AT t_konv INTO wa_konv

WHERE knumv = wa_vbak1-knumv.

IF sy-subrc EQ 0 .

wa_final-vbeln = wa_vbak1-vbeln .

wa_final-auart = wa_vbak1-auart .

wa_final-vkorg = wa_vbak1-vkorg .

wa_final-vtweg = wa_vbak1-vtweg .

wa_final-spart = wa_vbak1-spart .

wa_final-vkbur = wa_vbak1-vkbur .

wa_final-stunr = wa_konv-stunr .

wa_final-zaehk = wa_konv-zaehk .

wa_final-kschl = wa_konv-kschl .

wa_final-kvarc = wa_konv-kvarc .

wa_final-kbetr = wa_konv-kbetr.

wa_final-krech = wa_final-krech.

wa_final-varcond = wa_konv-varcond.

IF wa_final-varcond IS NOT INITIAL.

APPEND wa_final TO t_final .

ENDIF.

CLEAR : wa_final , wa_konv,r_kschl.

ENDIF.

ENDLOOP.

ENDLOOP.

ENDFORM.

is there any other alternative to this code.

this code makes performance issue.

thanks in advance.