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: 

BADI for CJ20N to get the WBS status when changed

Former Member
0 Kudos

Hi all,

Here's the requirement:

I have to capture the previous status and currently changed status of the WBS element in CJ20N T-CODE and save this in the ZTABLE.

Every time the STATUS of WBS element changes..the ZTABLE has to get updated.

Will you please help me out to do this.

I have tried with BADI - WORKBREAKDOWN_UPDATE, could find that the status part is updated after the call to WORKBREAKDOWN_UPDATE.

Thanks and Regards,

Krishna Chaitanya G

Edited by: Krishna Chaitanya G on Apr 27, 2009 6:30 PM

7 REPLIES 7

Former Member
0 Kudos

Hi Chaitanya,

I had a quick check and I found below BADIs which can be useful

DIP_GET_SEL_DATA

DIP_DPBP_RRDP_PROC

CO_SRULE_CHECK

K_PLAN_RULE

WBS_FIELDS_FOR_ASSET

Regards

Shital

0 Kudos

hey shital,

i tried with them already and found that none of them can meet the req's..

any ways thanx for the help..

Please help me out if there is any BADI / USEREXIT where the changed system-status can be captured.

Thanks and Regards,

Krishna Chaitanya G

Edited by: Krishna Chaitanya G on May 7, 2009 7:05 PM

Former Member
0 Kudos

Hi

Check this BADI "PROJECTDEF_UPDATE"

with regards

Naveen

Former Member
0 Kudos

Use BADI WORKBREAKDOWN_UPDATE method AT_SAVE. The WBS elements are in internal table IT_WBS_ELEMENT which has structure PRPS. Use OBJNR to find status with function module

CALL FUNCTION 'STATUS_READ'

EXPORTING

  • CLIENT = SY-MANDT

objnr = gs_wbs_element-objnr

ONLY_ACTIVE = ' '

TABLES

STATUS = et_status

EXCEPTIONS

OBJECT_NOT_FOUND = 1

OTHERS = 2

The statuses are buffered in a separate memory area so be careful if you call any function modules that affect statuses e.g one to create Sales Orders as this initializes the buffered statuses and they are not changed when you save the WBS element. To get round this problem put the current status in a separate memory area carry out the processing that initializes the statuses and then recall the status from memory.

CALL FUNCTION 'STATUS_BUFFER_EXPORT_TO_MEMORY'

EXPORTING

i_memory_id = 'ZPSS_STATUS'.

LOOP AT gt_pss_01 ASSIGNING <ls_pss_01>.

AT NEW sold_to_party.

CLEAR: ls_order_header,

lt_order_items,

ls_order_partners,

lt_order_partners.

"Header

ls_order_header-doc_type = c_rsbill_order_type.

CALL METHOD <ls_pss_01>-o_pss01->get_sales_area

IMPORTING

e_sales_org = ls_order_header-sales_org

e_division = ls_order_header-division

e_distr_chan = ls_order_header-distr_chan

EXCEPTIONS

not_found = 1.

IF sy-subrc NE 0.

CONTINUE.

ENDIF.

"Partner

IF <ls_pss_01>-sold_to_party IS INITIAL.

CONTINUE.

ENDIF.

ls_order_partners-partn_role = 'AG'.

ls_order_partners-partn_numb = <ls_pss_01>-sold_to_party.

APPEND ls_order_partners TO lt_order_partners.

ENDAT.

"Items

CLEAR ls_order_items.

ls_order_items-itm_number = <ls_pss_01>-posnr.

ls_order_items-material = c_rsbill_material.

ls_order_items-wbs_elem = <ls_pss_01>-posid.

APPEND ls_order_items TO lt_order_items.

AT END OF sold_to_party.

CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'

EXPORTING

order_header_in = ls_order_header

behave_when_error = space "'P' "Save when error occurs

testrun = space

IMPORTING

salesdocument = <ls_pss_01>-sales_order

TABLES

return = <ls_pss_01>-bapireturn

order_items_in = lt_order_items

order_partners = lt_order_partners.

ENDAT.

ENDLOOP.

*--Re-fill status from memory

CALL FUNCTION 'STATUS_BUFFER_IMPORT_FROM_MEMO'

EXPORTING

i_memory_id = 'ZPSS_STATUS'.

Hope this is of some use

Former Member
0 Kudos

soved it by myself

0 Kudos

Hi Krishna,

do you mind sharing your solution?

Looking forward to it.

Kr,

Christian

0 Kudos

Hi Christian,

I have used the BADI -'WORKBREAKDOWN_UPDATEu2019 .

Created a Implementation for that.Used AT_SAVE Method .

I have copied the earlier status from JEST.

Triggered a FM from that BADI in background task(delay few seconds here).. by reading the Current status.. i have done the required action.

U can also read the status by FM 'STATUS_READ' by passing PRPS-OBJNR.

KC