Skip to Content
0
Former Member
Sep 08, 2010 at 10:20 AM

Update Routine Not able to understand.

25 Views

Hi Experts,

I am not able to understand the following Update Routine.

  • TABLES: ...

DATA: in TYPE f,

out TYPE f,

denom TYPE f, "test

numer TYPE f.

  • Def. of 'credit-documents': following doc.categ. are 'credit docs'

  • reversal invoice (N)

  • credit memo (O)

  • internal credit memo (6)

  • Credit-documents are delivered with negative sign. Sign is switched

  • to positive to provide positive key-figures in the cube.

*

  • The combination of characteristics DE_CRED and DOC-CLASS provides

  • a comfortable way to distinguisch e.g. positive incoming orders or

  • order returns.

DATA: deb_cred(3) TYPE c VALUE 'NO6'.

CONSTANTS: c_msgty_e VALUE 'E'.

  • Itab To store Material master data ***

DATA: BEGIN OF t_mat.

INCLUDE STRUCTURE /bi0/pmaterial.

data :/bic/zampr_hr like /BIC/VZSD_C03T-/BIC/ZAMPR_HR,

END OF t_mat.

DATA: i_mat LIKE t_mat OCCURS 0 WITH HEADER LINE.

  • Itab to store AR doc. details from ods ZAR_O03.

TABLES: /bic/azar_o0300, /bi0/mmat_unit.

DATA: BEGIN OF l_zar_o03.

INCLUDE STRUCTURE /bic/azar_o0300.

DATA: END OF l_zar_o03.

DATA: t_zar_o03 LIKE l_zar_o03 OCCURS 0 WITH HEADER LINE.

DATA: t_item_num LIKE /bic/azar_o0300-item_num,

t_recno LIKE sy-tabix.

DATA: B_DAT LIKE /BIC/CS2LIS_13_VDITM-BILL_DATE,

lv_ref_no type /BI0/OIREFER_DOC.

**********************************************************

$$ end of global - insert your declaration only before this line -

FORM compute_data_field

TABLES MONITOR STRUCTURE RSMONITOR "user defined monitoring

USING COMM_STRUCTURE LIKE /BIC/CS2LIS_13_VDITM

RECORD_NO LIKE SY-TABIX

RECORD_ALL LIKE SY-TABIX

SOURCE_SYSTEM LIKE RSUPDSIMULH-LOGSYS

CHANGING RESULT LIKE /BIC/VZSD_C03T-/BIC/ZAMPR_HR

UNIT LIKE /BIC/VZSD_C03T-CONT_UNIT

RETURNCODE LIKE SY-SUBRC

ABORT LIKE SY-SUBRC. "set ABORT <> 0 to cancel update

*

$$ begin of routine - insert your code only below this line -

  • fill the internal table "MONITOR", to make monitor entries

  • Begin of Update Routine dt. 21-MAR-2006 by Ravindra Kango, Capgemini.

  • To populate Ampere Hours Rating (Content Unit) from 0Material.

RESULT = COMM_STRUCTURE-bill_qty.

data: stab like /bi0/mmat_unit occurs 0 with header line.

DATA: P_UNIT LIKE /bi0/mmat_unit-MAT_unit.

DATA: P_NUMERATOR LIKE STAB-NUMERATOR,

P_DENOMINATOR LIKE STAB-DENOMINTR.

REFRESH STAB.

select * from /bi0/mmat_unit into table stab

where MATERIAL = COMM_STRUCTURE-material

AND objvers = 'A'

AND MAT_UNIT IN ('C05' , 'C10' , 'C16' , 'C20', 'C06').

IF sy-subrc = 0.

LOOP AT STAB.

if Stab-MAT_UNIT = 'C10' .

P_UNIT = 'C10'.

P_NUMERATOR = STAB-NUMERATOR.

P_DENOMINATOR = STAB-DENOMINTR.

EXIT.

ELSEIF Stab-MAT_UNIT = 'C20'.

P_UNIT = 'C20'.

P_NUMERATOR = STAB-NUMERATOR.

P_DENOMINATOR = STAB-DENOMINTR.

EXIT.

ELSEIF Stab-MAT_UNIT = 'C05'.

P_UNIT = 'C05'.

P_NUMERATOR = STAB-NUMERATOR.

P_DENOMINATOR = STAB-DENOMINTR.

EXIT.

ELSEIF Stab-MAT_UNIT = 'C06'.

P_UNIT = 'C06'.

P_NUMERATOR = STAB-NUMERATOR.

P_DENOMINATOR = STAB-DENOMINTR.

EXIT.

ELSEIF Stab-MAT_UNIT = 'C16'.

P_UNIT = 'C16'.

P_NUMERATOR = STAB-NUMERATOR.

P_DENOMINATOR = STAB-DENOMINTR.

EXIT.

ENDIF.

ENDLOOP.

  • ENDIF.

  • ENDLOOP.

  • result value of the routine

RESULT = COMM_STRUCTURE-bill_qty

  • P_DENOMINATOR / P_NUMERATOR.

  • result value of the unit

UNIT = P_UNIT.

ELSE .

RESULT = 0.

ENDIF.

  • End of Update Routine dt. 21-MAR-2006 by Ravindra Kango, Capgemini.

  • if the returncode is not equal zero, the result will not be updated

RETURNCODE = 0.

  • if abort is not equal zero, the update process will be canceled

ABORT = 0.

$$ end of routine - insert your code only before this line -

*

ENDFORM.

Please clarify the use of STAB , ITAB .

Thanks,

Utpal