Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Need helps on BADI "HRBAS00INFTY"

Former Member

Dear Sir/Madam,

I have to implement the BADI "HRBAS00INFTY" to capture changes to the position details. The "IN UPDATE" method will be used to monitor these changes.

The requirement is, if any changes to the position's details is happened, then I have to update a custom table "ZPOST_STATUS".

I got a problem here, and I would like explain it in two cases:

case 1:

In PP01, I select the position(20000123) OBJECT(hrp1000), and go into change mode. Then I change the Object Abbreviation from "ABC" to "XYZ", and then click save. The BADI was executed and update the ZPOST_STATUS.

case 2:

In PP01, I select the position(20000123) OBJECT(hrp1000), and go into change mode. Then I click save without do any changes. The BADI was executed and update the ZPOST_STATUS.

I just want the ZPOST_STATUS table to be updated in case 1 situation, but I do not want the ZPOST_TABLE be updated in case 2. I understand that I need to do comparison in case 2 based on the OLD_IMAGE and NEW_IMAGE, but I can not find any documentation on how to implement this.

Is anyone had done this requirement before? if yes, can you please show me any documentation, or the codes that you had did?

Your help really appreciated.

Br,

Edison

1 ACCEPTED SOLUTION

former_member156446
Active Contributor
0 Kudos

try to put a select single in the BADI and get the same record and check if lv_selct_single-value NE new_image-value then update table.. else don't.

5 REPLIES 5

former_member156446
Active Contributor
0 Kudos

try to put a select single in the BADI and get the same record and check if lv_selct_single-value NE new_image-value then update table.. else don't.

Former Member
0 Kudos

HI,

Compare the OLD_IMAGE and NEW_IMAGE if there exist the change then update the Z table.

OLD_IMAGE  - holds the old values 
NEW_IMAGE - holds the new values


Get the selected data from the plog_tab and then get the selected data from OLD_IMAGE 
LOOP AT OLD_IMAGE INTO l_OLD WHERE <PLOG>. ENDLOOP. 
LOOP AT NEW_IMAGE INTO l_NEW. ENDLOOP.

IF L_OLD NE L_NEW.
 Update to z table.
ENDIF.

0 Kudos

Hi Avinash,

I got confused when i make changes to position details in PPOME, and I got dozen of records in the plog_tab.

Is it the plog_tab holding the data that apply to the infotype?

The data with OPERA "D" will be removed, and with OPERA "I" will be inserted?

thank:)

Br,

Edison

0 Kudos

Hi,

Yes it plog_tab holds the new data with Operation that need's to be done.

Former Member
0 Kudos

Hi,

Based on research another implementation in the system, I had wrote the code belows to solve the problem that I have.

thank you Avinash and J@Y for answering my question.

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

FIELD-SYMBOLS: <hrdbtab> TYPE hrdbtab,

<lw_old> TYPE bef_image,

<lw_new> TYPE aft_image,

<lw_old_image> TYPE ANY,

<lw_new_image> TYPE ANY,

<lw_dd03l> LIKE LINE OF lt_dd03l,

<lw_old_field> TYPE ANY,

<lw_new_field> TYPE ANY.

LOOP AT lt_plog_tab ASSIGNING <hrdbtab>

WHERE otype = 'S'

AND plvar = lf_plvar

AND infty = '1000'

AND begda LE sy-datum

AND endda GE sy-datum

AND ( opera = 'D' OR opera = 'U' OR opera = 'I' ).

IF lf_update EQ 'X'.

EXIT.

ENDIF.

PERFORM check_value_1000.

ENDLOOP.

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

FORM check_value_1000.

IF lt_new_image IS NOT INITIAL.

  • It is an update / insert

LOOP AT lt_new_image ASSIGNING <lw_new>.

IF lt_old_image IS NOT INITIAL.

UNASSIGN <lw_old>.

READ TABLE lt_old_image WITH KEY otype = <lw_new>-otype

plvar = <lw_new>-plvar

infty = <lw_new>-infty

subty = <lw_new>-subty

objid = <lw_new>-objid

begda = <lw_new>-begda

endda = <lw_new>-endda

ASSIGNING <lw_old>.

IF <lw_old> IS ASSIGNED.

MOVE-CORRESPONDING: <lw_old> TO lw_old_image,

<lw_new> TO lw_new_image.

CONCATENATE 'P' lw_new_image-infty INTO lf_struct_name.

CREATE DATA: lf_old_image TYPE (lf_struct_name),

lf_new_image TYPE (lf_struct_name).

ASSIGN: lf_old_image->* TO <lw_old_image>,

lf_new_image->* TO <lw_new_image>.

CALL METHOD cl_hr_pnnnn_type_cast=>wplog_to_pnnnn

EXPORTING

wplog = lw_old_image

IMPORTING

pnnnn = <lw_old_image>.

CALL METHOD cl_hr_pnnnn_type_cast=>wplog_to_pnnnn

EXPORTING

wplog = lw_new_image

IMPORTING

pnnnn = <lw_new_image>.

SELECT * INTO TABLE lt_dd03l FROM dd03l

WHERE tabname EQ lf_struct_name

AND as4local EQ 'A'

AND intlen NE 0.

IF sy-subrc EQ 0.

LOOP AT lt_dd03l ASSIGNING <lw_dd03l> WHERE fieldname EQ 'STEXT'.

ASSIGN COMPONENT: <lw_dd03l>-fieldname OF STRUCTURE <lw_new_image> TO <lw_new_field>,

<lw_dd03l>-fieldname OF STRUCTURE <lw_old_image> TO <lw_old_field>.

IF <lw_new_field> NE <lw_old_field>.

PERFORM update_jobpost_status.

ENDIF.

ENDLOOP.

ENDIF.

ELSE.

PERFORM update_jobpost_status.

ENDIF.

ELSE.

  • New Record

PERFORM update_jobpost_status.

ENDIF.

ENDLOOP.

ELSE.

  • No new image then it is a delete

PERFORM update_jobpost_status.

ENDIF.

ENDFORM.