Skip to Content
0
Former Member
Feb 13, 2008 at 01:18 PM

Please read the rules before answering! Points will be removed!

22 Views

Block - 1

-


CALL FUNCTION 'CHANGEDOCUMENT_READ'

EXPORTING

date_of_change = v_start

objectclass = 'MATERIAL'

tablename = 'MBEW'

time_of_change = '000000'

date_until = v_last

time_until = '235959'

TABLES

editpos = i_editpos

EXCEPTIONS

no_position_found = 1

wrong_access_to_archive = 2

time_zone_conversion_error = 3

OTHERS = 4.

IF sy-subrc EQ 0.

  • To find records whose price was changed using MR21 *transaction in current month.

  • These records have to be excluded from the Flat File.

LOOP AT i_editpos INTO wa_editpos WHERE tcode = 'MR21' AND fname = 'STPRS'.

wa_tab2-matnr = wa_editpos-tabkey+3(18).

wa_tab2-bwkey = wa_editpos-tabkey+21(4).

wa_tab2-bwtar = wa_editpos-tabkey+25(10).

wa_tab2-udate = wa_editpos-udate.

APPEND wa_tab2 TO i_tab2.

ENDLOOP.

ENDIF.

Block - 2

-


CLEAR v_name.

CALL FUNCTION 'CHANGEDOCUMENT_READ_HEADERS'

EXPORTING

date_of_change = v_start

objectclass = 'MATERIAL'

time_of_change = '000000'

username = v_name

date_until = v_last

time_until = '235959'

TABLES

i_cdhdr = i_cdhdr

EXCEPTIONS

no_position_found = 1

wrong_access_to_archive = 2

time_zone_conversion_error = 3

OTHERS = 4.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

LOOP AT i_cdhdr INTO wa_cdhdr.

REFRESH:i_editpos.

CALL FUNCTION 'CHANGEDOCUMENT_READ_POSITIONS'

EXPORTING

changenumber = wa_cdhdr-changenr

tablename = 'MBEW'

TABLES

editpos_with_header = i_editpos

EXCEPTIONS

no_position_found = 1

wrong_access_to_archive = 2

OTHERS = 3.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ELSE.

LOOP AT i_editpos INTO wa_editpos WHERE tcode = 'MR21' AND fname = 'STPRS'.

wa_tab2-matnr = wa_editpos-tabkey+3(18).

wa_tab2-bwkey = wa_editpos-tabkey+21(4).

wa_tab2-bwtar = wa_editpos-tabkey+25(10).

wa_tab2-udate = wa_editpos-udate.

APPEND wa_tab2 TO i_tab2.

ENDLOOP.

ENDIF.

ENDLOOP.

Second block of code has taken less time . What is the Reason?

Edited by: Julius Bussche on Jul 15, 2008 9:09 AM