Skip to Content
0
Former Member
Jul 03, 2006 at 02:42 PM

its very urgent plz solve this as soon as posssible

23 Views

Hi too all experts,

I have problem with subroutine calculate_measurement

FORM calculate_measurement USING p_objnr TYPE recaobjnr

p_date TYPE sydatum

CHANGING p_nutz TYPE rebdmeasvalue

p_nutz_unit TYPE rebdmeasunit

p_heiz TYPE rebdmeasvalue

p_heiz_unit TYPE rebdmeasunit.

DATA : lt_vibdobjass TYPE TABLE OF vibdobjass,

lw_vibdobjass TYPE vibdobjass,

lw_vibdro TYPE vibdro,

lw_vibdobjrel TYPE vibdobjrel,

lt_vibdmeas TYPE TABLE OF vibdmeas,

lw_vibdmeas TYPE vibdmeas.

CLEAR : p_nutz, p_nutz_unit,

p_heiz, p_heiz_unit,

lt_vibdmeas[],

lt_vibdobjass[].

SELECT * FROM vibdobjass INTO TABLE lt_vibdobjass

WHERE objnrsrc = p_objnr

AND validfrom <= p_date

AND validto >= p_date.

LOOP AT lt_vibdobjass INTO lw_vibdobjass.

SELECT SINGLE * FROM vibdro INTO lw_vibdro

WHERE objnr = lw_vibdobjass-objnrtrg.

IF sy-subrc = 0.

SELECT SINGLE * FROM vibdobjrel INTO lw_vibdobjrel

WHERE intrenotrg = lw_vibdro-intreno

AND typesrc = 'RO'

AND typetrg = 'RS'.

IF sy-subrc EQ 0.

SELECT SINGLE * FROM vibdobjrel INTO lw_vibdobjrel

WHERE intrenosrc EQ lw_vibdobjrel-intrenosrc

AND intrenotrg NE lw_vibdro-intreno

AND typesrc = 'RO'

AND typetrg = 'RS'.

IF sy-subrc EQ 0.

SELECT * FROM vibdmeas APPENDING TABLE lt_vibdmeas

WHERE intreno = lw_vibdobjrel-intrenotrg.

ENDIF.

ENDIF.

ENDIF.

ENDLOOP.

LOOP AT lt_vibdmeas INTO lw_vibdmeas

WHERE meas = 'A001'

OR meas = 'A999'.

IF lw_vibdmeas-meas = 'A001'.

p_nutz = p_nutz + lw_vibdmeas-measvalue.

p_nutz_unit = lw_vibdmeas-measunit.

ELSEIF lw_vibdmeas-meas = 'A999'.

p_heiz = p_heiz + lw_vibdmeas-measvalue.

p_heiz_unit = lw_vibdmeas-measunit.

ENDIF.

ENDLOOP.

ENDFORM. " calculate_measurement

because i want to convert the following code into function module so plz anyone can tell the what are all the import and export and tables and the logic because i never worked with FM.

Thanks in advance

reply if possible to my mail ravi_murki@rediffmail.com,ravimurki@gmail.com

Best Rgards

RAVI