cancel
Showing results for 
Search instead for 
Did you mean: 

CJ20N Release Exit or BADI

Former Member
0 Kudos

Hi Gurus, I need a BADI or user exit for tx CJ20N, this must be triggered on Release event (CTRL+F2). I tried with CNEX0006, CNEX0025, CNEX0028 and CNEX0029 but none of those works.

Any help will be apreciated.

Thanks a lot.

Accepted Solutions (1)

Accepted Solutions (1)

rakeshjain
Explorer
0 Kudos

Hi Luis,

Try this one - STATTEXT, Component - EXIT_SAPLBSVA_001.

It might work.

Best Regards,

Rakesh

Answers (3)

Answers (3)

0 Kudos

Hi,

There is no BADI for that but you can use an implicit enhancement spot. I used this technical way to prevent the release of WBS level 1 & 2.

Remark: Be careful with this way because you can bypass the standard code or block the standard SAP code. A mistake can cause inconsistencies in your SAP system

This enhancement was set in the beginning of the subroutine "status_change_ps" in the include program LCJDWF1Z.

I hope that this solution could help you.

Rgds,

Christophe

This is the coding.

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

DATA: BEGIN OF l_status,

db TYPE bsvx-sttxt,

buffer TYPE bsvx-sttxt,

END OF l_status.

DATA:

l_pspnr type prps-pspnr,

l_profl type proj-profl.

CONSTANTS: BEGIN OF lc_status,

created TYPE tj02t-txt04 VALUE 'CRTD',

released TYPE tj02t-txt04 VALUE 'REL',

END OF lc_status,

lc_investment type proj-profl VALUE 'Z000000'.

BREAK-POINT ID ZIM1_PS_CR684_PREVENT_RELEASE.

  • Check the Relase Event

IF vrgng_imp NE con_vng_freigabe.

EXIT.

ENDIF.

  • Check the Project Profile

READ TABLE pstab INDEX 1.

MOVE pstab-psphi TO l_pspnr.

SELECT SINGLE profl FROM proj

INTO l_profl

WHERE pspnr = l_pspnr.

IF sy-subrc <> 0 OR l_profl NE lc_investment.

EXIT.

ENDIF.

  • Read PSP-Elements

LOOP AT stat_check_ps WHERE selkz eq 'X'.

  • Read PRPS Data

READ TABLE pstab INDEX stat_check_ps-psind.

  • Check only the Level 1 & Level 2

IF pstab-stufe = 1 OR pstab-stufe = 2.

CLEAR: l_status.

  • Read DB Status

CALL FUNCTION 'STATUS_TEXT_EDIT'

EXPORTING

objnr = pstab-objnr

  • ONLY_ACTIVE = 'X'

spras = sy-langu

bypass_buffer = 'X'

IMPORTING

line = l_status-db

EXCEPTIONS

object_not_found = 1

OTHERS = 2

.

IF sy-subrc <> 0.

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

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

ENDIF.

  • Read Buffer Status

CALL FUNCTION 'STATUS_TEXT_EDIT'

EXPORTING

objnr = pstab-objnr

  • ONLY_ACTIVE = 'X'

spras = sy-langu

bypass_buffer = ' '

IMPORTING

line = l_status-buffer

EXCEPTIONS

object_not_found = 1

OTHERS = 2

.

IF sy-subrc <> 0.

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

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

ENDIF.

IF l_status-buffer NE lc_status-released

AND l_status-db NE lc_status-released.

  • Authority Check

AUTHORITY-CHECK OBJECT 'ZIM1_WBS'

ID 'ACTVT' FIELD '02'.

IF sy-subrc <> 0.

MESSAGE e229(/sapht/drm01).

  • You are not authorized to perform this release.

ENDIF.

ENDIF.

ELSE.

CONTINUE.

ENDIF.

ENDLOOP.

Former Member
0 Kudos

Thanks a lot guys but I could not trigger any of the enhancements at the click on EDIT -> STATUS -> RELEASE.

My requirement es to avoid the operation release depending on value of one User Field. Maybe this must be done using some kind of configuration. I've spent several days tryng to solve that. Even I tried to go home and wait the next day if it goes solved by itself, but doesn't work

Luis.

Former Member
0 Kudos

Hi Luis,

Even if you set the status via EDIT->STATUS->RELEASE the status won't be reflected in the database before you SAVE the transaction. Why don't you use BADI WORKBREAKDOWN_UPDATE method AT_SAVE for your purpose. You can stop the transaction being saved by issuing necessary error message and with the exception ERROR_WITH_MESSAGE for this method.

This BADI method will be triggered when you press SAVE in CJ20N. I never heard of any exit when you simply release the object.

Regards,

R

Former Member
0 Kudos

I'm pretty sure that is released without saving. When I left de transaction, enter again and check, it is released!. Maybe this is the main problem.

Former Member
0 Kudos

Hi,

Check:

CNEX0001 PS: User fields

CNEX0002 PS Authorization check

CNEX0003 PS: Customer specific fields standard project definitio

CNEX0004 PS: Customer specific fields standard WBS element

CNEX0005 PS: Customer specific fields in process (standard net)

CNEX0006 PS customer specific fields project definition

CNEX0007 PS customer specific fields WBS element

Find a badi for cj20n at particular place.

go to se24.

object type-> CL_EXITHANDLER

press display.

double click on method GET_INSTANCE.

Put a break Point in side the method CALL METHOD cl_exithandler=>get_class_name_by_interface.

then go to code Cj20n.

and you will get all the BADI which tiggers in cj20n.

code ll stop at break point u check variable exit_name of above class.

Regards,

Shraddha