2019 Nov 21 10:36 AM
hey guys, i have a requirement where a program displays agreement change log but in that change log it doesn't show the best old and new value... its showing for other fields though.
LOOP AT lt_hdr INTO ls_hdr.
CLEAR ls_final.
ls_final-username = ls_hdr-username.
ls_final-udate = ls_hdr-udate.
ls_final-utime = ls_hdr-utime.
CLEAR ls_konaind_konh.
READ TABLE lt_konaind_konh INTO ls_konaind_konh
WITH KEY knumh = ls_hdr-objectid
BINARY SEARCH.
IF sy-subrc EQ 0.
ls_final-knuma = ls_konaind_konh-knuma.
ls_final-kschl = ls_konaind_konh-kschl.
ls_final-bosta = ls_konaind_konh-bosta. "added on 21-11-19
CASE ls_konaind_konh-kotabnr.
WHEN 614.
READ TABLE lt_a614 INTO ls_a614
WITH KEY knumh = ls_konaind_konh-knumh
BINARY SEARCH.
IF sy-subrc EQ 0.
ls_final-datab = ls_a614-datab.
ls_final-datbi = ls_a614-datbi.
ls_final-vkorg = ls_a614-vkorg.
ls_final-vtweg = ls_a614-vtweg.
ls_final-kunnr = ls_a614-kunnr.
ENDIF.
WHEN 751.
READ TABLE lt_a751 INTO ls_a751
WITH KEY knumh = ls_konaind_konh-knumh
BINARY SEARCH.
IF sy-subrc EQ 0.
ls_final-datab = ls_a751-datab.
ls_final-datbi = ls_a751-datbi.
ls_final-kunnr = ls_a751-kunnr.
ENDIF.
WHEN 616.
READ TABLE lt_a616 INTO ls_a616
WITH KEY knumh = ls_konaind_konh-knumh
BINARY SEARCH.
IF sy-subrc EQ 0.
ls_final-datab = ls_a616-datab.
ls_final-datbi = ls_a616-datbi.
ls_final-fgnum = ls_a616-irm_fgnum.
ls_final-ftt = ls_a616-zz_ftt_nature.
ENDIF.
WHEN 605.
READ TABLE lt_a605 INTO ls_a605
WITH KEY knumh = ls_konaind_konh-knumh
BINARY SEARCH.
IF sy-subrc EQ 0.
ls_final-datab = ls_a605-datab.
ls_final-datbi = ls_a605-datbi.
ls_final-vkorg = ls_a605-vkorg.
ls_final-vtweg = ls_a605-vtweg.
ENDIF.
WHEN OTHERS.
ENDCASE.
ELSE.
CLEAR lv_knuma1.
lv_knuma1 = ls_hdr-objectid.
ls_final-knuma = lv_knuma1.
READ TABLE lt_kona INTO ls_kona
WITH KEY knuma = lv_knuma1
BINARY SEARCH.
IF sy-subrc EQ 0.
ls_final-bosta = ls_kona-bosta. "added on 21-11-19
ls_final-datab = ls_kona-datab.
ls_final-datbi = ls_kona-datbi.
ENDIF.
ENDIF.
CLEAR ls_pos.
READ TABLE lt_pos INTO ls_pos
WITH KEY objectid = ls_hdr-objectid
objectclas = ls_hdr-objectclas
changenr = ls_hdr-changenr
BINARY SEARCH.
IF sy-subrc EQ 0.
DATA(lv_tabix) = sy-tabix.
LOOP AT lt_pos INTO ls_pos FROM lv_tabix.
IF ls_pos-changenr <> ls_hdr-changenr.
EXIT.
ENDIF.
ls_final-fname = ls_pos-fname.
ls_final-chngind = ls_pos-chngind.
CLEAR ls_final-desc.
READ TABLE lt_dd04t INTO ls_dd04t
WITH KEY rollname = ls_pos-fname
BINARY SEARCH.
IF sy-subrc EQ 0.
ls_final-desc = ls_dd04t-scrtext_l.
ENDIF.
READ TABLE lt_zfi009 INTO ls_zfi009
WITH KEY fname = ls_pos-fname
BINARY SEARCH.
IF sy-subrc EQ 0.
ls_final-desc = ls_zfi009-descr.
ENDIF.
IF ls_final-kschl EQ zcl_vx_global_mh=>c_kschl_zbn1.
IF ls_final-fname EQ 'KBETR'.
ls_final-value_new = ls_pos-value_new / 10.
ls_final-value_old = ls_pos-value_old / 10.
CONDENSE ls_final-value_new.
CONDENSE ls_final-value_old.
ENDIF.
ELSE.
ls_final-value_new = ls_pos-value_new.
ls_final-value_old = ls_pos-value_old.
ENDIF.
IF ls_final-kschl IS INITIAL.
ls_final-section = 'Header'(004).
ELSE.
ls_final-section = 'Rule'(005).
ENDIF.
IF ls_final-fname EQ 'KEY'. "AND ls_final-chngind EQ 'I'.
ls_final-desc = 'Created'(006).
ENDIF.
IF ls_final-fname EQ 'STPRL'.
CALL FUNCTION 'CONVERSION_EXIT_PARVW_OUTPUT'
EXPORTING
input = ls_final-value_new
IMPORTING
output = ls_final-value_new.
ENDIF.
IF ls_final-fname EQ 'AEZET'
OR ls_final-fname EQ 'PMPAR'
OR ls_final-fname EQ 'OWNER' OR ls_final-fname EQ 'OWROL'
OR ls_final-fname EQ 'PMPRL' OR ls_final-fname EQ 'VAKEY'.
ELSEIF ls_final-fname EQ 'DATAB'
OR ls_final-fname EQ 'DATBI'.
lv_datab = ls_final-value_old.
IF lv_datab IS INITIAL OR lv_datab EQ space.
ELSE.
APPEND ls_final TO gt_final.
ENDIF.
CLEAR lv_datab.
ELSE.
APPEND ls_final TO gt_final.
ENDIF.
CLEAR: ls_final-fname, ls_final-chngind, ls_final-desc,
ls_final-value_old, ls_final-value_new,
ls_final-section.
ENDLOOP.
2019 Nov 21 12:54 PM
pro888 Pass COND_B to OBJECTCLAS when reading from table CDPOS,
VALUE_NEW & VALUE_OLD fields will give you new and old values