Skip to Content
0
Former Member
Mar 25, 2010 at 02:04 PM

RV_SCHEDULE_CHECK_DELIVERIES

680 Views

Hi Experts,

I am writing a program to give a report to my client which contains, the schedule line confirmed quantity

and delivered quantity at schedule line level. I am using the below mentioned fm 'RV_SCHEDULE_CHECK_DELIVERIES'

and the code i have written is.

SELECT vbeln

erdat

vbtyp

vtweg

spart

vkgrp

vkbur

auart

bstnk

kunnr

kvgr5

FROM vbak

INTO TABLE gt_vbak

WHERE vbtyp EQ gc_c

AND erdat IN s_erdat

AND vtweg IN s_vtweg

AND spart IN s_spart

AND vkbur IN s_vkbur

AND auart IN s_auart

AND vkorg EQ p_vkorg.

IF gt_vbak[] IS NOT INITIAL.

SELECT *

FROM vbap

INTO CORRESPONDING FIELDS OF TABLE xvbap

FOR ALL ENTRIES IN gt_vbak

WHERE vbeln = gt_vbak-vbeln.

  • AND werks IN s_werks.

  • AND abgru = space.

IF sy-subrc EQ 0.

SELECT *

FROM vbup

INTO TABLE xvbup

FOR ALL ENTRIES IN xvbap

WHERE vbeln = xvbap-vbeln

AND posnr = xvbap-posnr.

SELECT *

FROM vbfa

INTO TABLE xvbfa

FOR ALL ENTRIES IN xvbap

WHERE vbelv = xvbap-vbeln

AND posnv = xvbap-posnr

AND vbtyp_n = gc_j

AND vbtyp_v = gc_c.

SELECT *

FROM vbep

INTO TABLE xvbep

FOR ALL ENTRIES IN xvbap

WHERE vbeln = xvbap-vbeln

AND posnr = xvbap-posnr.

ENDIF.

ENDIF.

  • DATA: zvbap TYPE TABLE OF vbapvb ,

  • lzvbap TYPE vbapvb.

DATA: lvbep TYPE vbepvb.

  • LOOP AT xvbap INTO lvbap.

LOOP AT xvbep INTO lvbep.

CALL FUNCTION 'RV_SCHEDULE_CHECK_DELIVERIES'

EXPORTING

fbeleg = lvbep-vbeln

fposnr = lvbep-posnr

TABLES

fvbfa = xvbfa

fvbup = xvbup

fxvbep = xvbep

fvbap = xvbap

EXCEPTIONS

fehler_bei_lesen_fvbup = 1

fehler_bei_lesen_fxvbep = 2

OTHERS = 3.

IF sy-subrc <> 0.

RETURN.

ENDIF.

LOOP AT xvbep INTO lvbep WHERE vbeln = lvbep-vbeln

AND posnr = lvbep-posnr

AND etenr = lvbep-etenr.

MOVE-CORRESPONDING lvbep TO lvbep_out.

APPEND lvbep_out TO vbep_out.

CLEAR lvbep_out.

CLEAR lvbep.

ENDLOOP.

ENDLOOP.

But the program is not working properly, please suggest me what wrong i am doing? Or if there is any other way to get the delivery qty at schedule line level.