Skip to Content
Author's profile photo Former Member

Automatic AVAC in SAP PS at Project Save

Problem statement

The availability control of an order or a project can be activated in the standard system only if the order or a WBS element of the project was already budgeted.

AVAC is not activated automatically at project creation.

Workaround proposed by SAP:

(Create a dummy budget or a solution by using a user status Profile

If this is not possible, you can use a user exit for releases higher than 4.6C (SAP_APPL) or for release 462 (IS-PS), so that you can activate the availability control on an order or a project, even if the object has not yet been budgeted. Activate the availability control using transaction KO31 (orders) or CJBN (projects).

Alternatively, you can activate the availability control by choosing ‘Extras -> Availability Control -> Activate’ in the budgeting transactions (KO22, KO24 and KO26 or CJ30, CJ37 and CJ38) and then saving (without budget).

Solution:

As soon as WBS element is created for the first time and user presses save button budget availability control gets activated automatically.

Mandatory Prerequisite:

SAP Note: 599813 must be successfully implemented beforehand. Refer code1 below for Badi implementation IM_behavoiour.

Details:

At project save 2 enhancement points will be used to activate AVAC at project save.

First enhancement point will get the project id from user and save it into a memory variable. Refer to code2 below.

Second enhancement point will call program to activate AVAC only if it is not already activated. Refer to code3 below.

Pseudo code

In Tcode Cj20n user will create project (definition + at least one WBS element). On event of pressing save button by the user, get project id (PROJ-PSPID) from SAPLCJWB. Export this project id to enhancement point in SAPLCNPB_M.

Pass project id (PROJ-PSPID) to PROJ table to get Project definition (internal) (PSPNR). Select object number (OBJNR) from PRPS where PRPS-PSPHI equals to PROJ-PSPNR.

Pass object number (OBJNR) to JEST to get INACT. If no rows are selected or INACT = ‘X’ then call program RBPFCPN1 and pass PROJ-PSPID.

Code 1:

BADI Definition

Implementation name

Methods

Comments

IM_BEHAVIOUR

ZIM_BEHAVIOUR

GET_BEHAVIOUR

n/a

In BADI ZIM_BEHAVIOUR

  IF situation = ‘ENABLE_AVC_WITHOUT_BUDGET’.
behaviour
= ‘X’.
ENDIF.

Code 2:

Enhancement

Main Program

Includes

Form Routines

ZPS_UPDATE

SAPLCNPB_M

LCNPB_MF55

In ZPS_UPDATE_1

data id TYPE c LENGTH 24 VALUE ‘ZPS_001’.
EXPORT PROJPSPID to MEMORY id id.

Code 3:

Enhancement

Main Program

Includes

Form Routines

ZPS_UPDATE

SAPLCNPB_M

LCNPB_MF55

In ZPS_UPDATE

data: id TYPE c LENGTH 24 VALUE ‘ZPS_001’,
W_OBJNR
TYPE J_OBJNR,
w_pspnr
TYPE PS_INTNR,
W_INACT
TYPE J_INACT.
IMPORT PROJPSPID from MEMORY id id.
IF PROJPSPID IS NOT INITIAL.
WAIT UP TO 1 SECONDS.
SELECT SINGLE pspnr
from proj INTO w_pspnr
WHERE pspid = projpspid.
IF sysubrc = 0.
SELECT SINGLE OBJNR
FROM PRPS INTO W_OBJNR
WHERE psphi = w_pspnr.
IF W_OBJNR IS NOT INITIAL.
SELECT SINGLE INACT
FROM JEST INTO W_INACT
WHERE OBJNR = W_OBJNR
AND STAT = ‘I0005’.
IF SYSUBRC <> 0 OR W_INACT = ‘X’.
SUBMIT RBPFCPN1 WITH CN_PROJNLOW eq PROJPSPID AND RETURN.
ENDIF.
ENDIF.
ENDIF.
ENDIF.

Benefits:

  1. AVAC automatically activates at project save.
  2. No user status is required to prevent PR/PO or other commitment to project without budget. This gives value to client also, as change for two users status is prevented and project stage transition becomes smooth.

  Known issues:  

  1. If we want to deactivate AVAC. Then user must not open project and click on save button otherwise AVAC will gets activated again.
  2. If server is slow and wait condition is 1 second plus user is creating project for first time; then it might be possible that project id is not saved to database table whereas it is passed to the memory variable. In this case AVAC will not get activated. To prevent this wait time can be increased.

Authors:-

Harsh Saxena

Consultant

Assigned Tags

      4 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Amaresh Makal
      Amaresh Makal

      Hello Harsh,

      Good that you documented it.

      I had done it in some of projects.

      Recently I had replied in a thread ( http://scn.sap.com/thread/3251195 ) on this topic, to implement the note 599813 to activate AVAC in the background even without budgeting.

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Thanks!

      Author's profile photo Muhammad Asif
      Muhammad Asif

      Hi Harsh,

      You have explained very well and comprehensivley in this therad.

      I have given same details to My ABAP Consultant for implementation, though he has done same implementation as you explained as per SAP Note 599813; but I am getting two problem;

      1.       AVAC is only activated when WBS system status is Budgeted, AVAC is not activated on System status created.

      2.       When WBS System Budgeted even then AVAC is not activated; first I need to change anything Project in CJ20N Transaction and save then project WBS system status change into AVAC.

      Actually, In SAP Note 599813 program “RBPFCPN1” is working in background, which  only works if WBS system status is budgeted.

      Do we need to change/modify this SAP Standard Program “RBPFCPN1”?

      Can you please guide us where we need to lead or please send complete implementation code.

      Best Regards,

      Muhammad Asif

      Author's profile photo Former Member
      Former Member

      Hi Harsh,

      SAP Note: 599813 appears to me as "Not Implantable". In the Note I see that says for version 4.6C.

      I have version 6.0, you implanted it in another version?

      Software Component From To And Subsequent
       SAP_APPL 46C 46C

      Best Regards,