Skip to Content
0
Former Member
Jun 14, 2007 at 01:53 AM

update routine code help

22 Views

Hi all,

I have updates from an ODs to an infoprovider (infoobject). From the ODs Retail outlet is bpartner2 and Bpartner1 is suppose to update retail root (z_rtlrte) or territory rep(z_terre). This is not updating any records. Ideally z_rtlrte should only update when the conditions are met for it and z_terre should only update when the conditions are met for it. Is my logic correct,

Please help.

Start Routine:

DELETE DATA_PACKAGE WHERE BP_RELTYPE NE 'BUR011'

OR BP_RELTYPE NE 'BUR013'.

Routine for Infoobject retail root (z_rtlrte)

TYPES:

BEGIN OF DATA_PACKAGE_STRUCTURE.

INCLUDE STRUCTURE /BIC/CS80BP_REL.

TYPES:

RECNO LIKE sy-tabix,

END OF DATA_PACKAGE_STRUCTURE.

DATA:

DATA_PACKAGE TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE

WITH HEADER LINE

WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.

DATA :WA_MD type /bic/mz_retail occurs 0 with header line.

DATA :WA_TEMP type DATA_PACKAGE_STRUCTURE occurs 0 with header line.

DATA :WA_TEMP2 type DATA_PACKAGE_STRUCTURE occurs 0 with header line.

select * from /bic/mz_retail into WA_MD.

SORT WA_MD ASCENDING BY /BIC/Z_RETAIL.

if DATA_PACKAGE-BP_RELTYPE EQ 'BUR013'.

DELETE DATA_PACKAGE WHERE BP_RELTYPE EQ 'BUR013'

AND BP_RELDIR NE '1'.

DELETE DATA_PACKAGE WHERE BP_RELTYPE EQ 'BUR013'

AND FLGDELETED NE ''.

DELETE DATA_PACKAGE WHERE BP_RELTYPE EQ 'BUR013'

AND RECORDMODE EQ 'X'.

loop at DATA_PACKAGE into WA_Temp.

Read table WA_MD with Key /BIC/Z_RETAIL = wa_temp-bpartner2.

if

wa_md-/BIC/Z_RTLRTE EQ ''.

wa_temp-bpartner1 = wa_temp-bpartner1.

modify DATA_PACKAGE from wa_temp.

endif.

if

wa_md-/BIC/Z_RTLRTE EQ wa_md-/BIC/Z_RETAIL.

wa_temp-bpartner1 = wa_temp-bpartner1.

modify DATA_PACKAGE from wa_temp.

endif.

if

wa_md-/BIC/Z_RTLRTE NE wa_md-/BIC/Z_RETAIL.

wa_temp-bpartner1 = wa_md-/BIC/Z_RTLRTE.

modify DATA_PACKAGE from wa_temp.

endif.

endloop.

endif.

endselect.

Routine for Infoobject retail root (z_terre)

TYPES:

BEGIN OF DATA_PACKAGE_STRUCTURE.

INCLUDE STRUCTURE /BIC/CS80BP_REL.

TYPES:

RECNO LIKE sy-tabix,

END OF DATA_PACKAGE_STRUCTURE.

DATA:

DATA_PACKAGE TYPE STANDARD TABLE OF DATA_PACKAGE_STRUCTURE

WITH HEADER LINE

WITH NON-UNIQUE DEFAULT KEY INITIAL SIZE 0.

if DATA_PACKAGE-BP_RELTYPE EQ 'BUR011'.

DELETE DATA_PACKAGE WHERE BP_RELTYPE EQ 'BUR011'

AND FLGDELETED NE ''.

DELETE DATA_PACKAGE WHERE BP_RELTYPE EQ 'BUR011'

AND RECORDMODE EQ 'X'.

DELETE DATA_PACKAGE WHERE BP_RELTYPE EQ 'BUR011'

AND BP_RELDIR NE '2'.

SELECT * from /BIC/PZBP_TERRE into table lt_terre.

loop at DATA_PACKAGE .

read table lt_terre with KEY /BIC/ZBP_TERRE = DATA_PACKAGE-bpartner1.

if sy-subrc ne 0.

RETURNCODE = 4.

endif.

endloop.

SELECT * from /BIC/PZBP_retal into table lt_retal.

loop at DATA_PACKAGE .

read table lt_retal with KEY /BIC/ZBP_RETAL = DATA_PACKAGE-bpartner2.

if sy-subrc ne 0.

RETURNCODE = 4.

endif.

endloop.

endif.