Fonction SAP BAPI_EXPENDITUREPROGTREE_STSTA - Change System or User Status of Positions of Program Sub-Tree

Paramètre Reférence Type Long. Valeur par déf. Facultatif Description
APPROVALYEAR BAPIPROGPOSID-APPROVALYEAR N 4 Approval Year of Program
LANGUAGE BAPIPROGAUX-LANGU C 1 X Logon Language in SAP Format
LANGUAGE_ISO BAPIPROGAUX-LANGU_ISO C 2 X Logon Language in ISO Format
POSITION BAPIPROGPOSID-POSITION C 24 Position ID
PROGRAM BAPIPROGPOSID-PROGRAM C 8 Program Name
TEST_RUN BAPIPROGAUX-TEST_RUN C 1 ' ' X Test Run
USER_STATUS_FIRST BAPIPROGAUX-USTAT_FIRST C 1 ' ' X Set User Status First

Paramètre Reférence Long. Facultatif Description
RETURN BAPIRET2 548 X Return Messages
SYSTEM_STATUS BAPIPROGSTATACTVT 38 X Setting of System Status
USER_STATUS BAPIPROGUSERSTAT 31 X Setting of User Status

Function
Using this method, you can change the system status and user status ofthe positions of a program sub-tree.

Notes
The changes to system status are transferred in tableSYSTEM_STATUS.The changes to user status are transferred in tableUSER_STATUS.
In these tables, you only need to enter those program positions of thesub-tree, for which a status change should actually be carried out. Youdo not have to transfer the complete sub-tree with all of itspositions. The sequence in the table of the positions to be changed isalso not important, however, the positions have to belong to thesub-tree entered.
Since the system status and user status can each influence the other,you can specify which status should be set first, using the
USER_STATUS_FIRST indicator.
INCLUDE IM_APPROVALYEAR OBJECT DOKU ID TX
INCLUDE IM_LANGUAGE OBJECT DOKU ID TX
INCLUDE IM_LANGUAGE_ISO OBJECT DOKU ID TX
INCLUDE IM_POSITION OBJECT DOKU ID TX
INCLUDE IM_PROGRAM OBJECT DOKU ID TX
INCLUDE IM_TEST_RUN OBJECT DOKU ID TX

Meaning
The indicator specifies that the user status is changed before thesystem status when status changes are made. If the indicator is notset, the system status is changed first.
The sequence of status changes is important, since the system statusand user status of a program position can each influence the other.Certain status changes can cause other status changes to be made, ormay prevent certain other changes. The depedencies among the differentstatuses is set in the status profile.
Changes to statuses take place only if no errors occur for any of theindividual status changes in the SYSTEM_STATUS and USER_STATUS tables.That is, either all statuses are changed or no statuses are changed.

Meaning
Overview of the most important return messages (TYPE.ID.NUMBER):
INCLUDE IM_AP003 OBJECT DOKU ID TX
INCLUDE IM_AP005 OBJECT DOKU ID TX
INCLUDE IM_AP015 OBJECT DOKU ID TX
INCLUDE IM_AP076 OBJECT DOKU ID TX
INCLUDE IM_AP120 OBJECT DOKU ID TX
INCLUDE IM_AP154 OBJECT DOKU ID TX
INCLUDE IM_APBAPI027 OBJECT DOKU ID TX(SYSTEM_STATUS-POSITION or USER_STATUS-POSITION field)
INCLUDE IM_APBAPI039 OBJECT DOKU ID TX(SYSTEM_STATUS-ACTIVITY field)
INCLUDE IM_APBAPI040 OBJECT DOKU ID TX
INCLUDE IM_APBAPI041 OBJECT DOKU ID TX(LANGUAGE or LANGUAGE_ISO field)
INCLUDE IM_APBAPI042 OBJECT DOKU ID TX(LANGUAGE or LANGUAGE_ISO field)
INCLUDE IM_APBAPI043 OBJECT DOKU ID TX(USER_STATUS-STATUS field)
INCLUDE IM_B1886 OBJECT DOKU ID TX(LANGUAGE_ISO field)
INCLUDE IM_BS002 OBJECT DOKU ID TX(SYSTEM_STATUS-ACTIVITY field)
INCLUDE IM_BS003 OBJECT DOKU ID TX(SYSTEM_STATUS-ACTIVITY field)
INCLUDE IM_BS007 OBJECT DOKU ID TX(SYSTEM_STATUS-ACTIVITY field)
INCLUDE IM_TL080 OBJECT DOKU ID TX(LANGUAGE field)

Definition
The table transfers the changes to the system status that are to becarried out on the positions of a program sub-tree.
The row structure of the table contains the following fields:
,,POSITION,,- ID of the program position to be changed
,,ACTIVITY,,- business activity
,,CHANGE_NO,,- change sequence
Notes
You can carry out a number of status changes to a program position atone time. When you do so, the CHANGE_NO field displays the sequence ofthe individual changes to this position.
The new statuses are set based on the business activity entered in theACTIVITY field. The possible activities are:
,,REL,,,,,,- Release
,,REMOVE_REL,,- Cancel release
,,LOCK_PLAN,,- Lock plan
,,ULOCK_PLAN,,- Unlock plan
,,LOCK_BUDG,,- Lock budget
,,ULOCK_BUGD,,- Unlock budget
,,LOCK_ALL,,- Lock all
,,ULOCK_ALL,,- Unlock all
Example
A program sub-tree contains positions POS_1 and POS_2, among others.You want to release POS_1, after which you want its budget and plan tobe locked. For POS_2, you want to cancel a release that was madepreviously.
The table involved, SYSTEM_STATUS, could look like this:
,,POSITION,,AVTIVITY,,CHANGE_NO
,,---------------------------------
,,POS_1,,,,LOCK_BUDG,,,,02
,,POS_1,,,,REL,,,,,,,,01
,,POS_2,,,,REMOVE_REL,,,,01
,,POS_1,,,,LOCK_PLAN,,,,03

Meaning
The table transfers changes to user status that are to be carried outon positions of a program sub-tree.
The row structure of the table contains the following fields:
,,POSITION,,- ID of the program position to be changed
,,STATUS,,,,- User status
,,NOT_ACTIVE,,- Indicator for status active/not active
,,CHANGE_NO,,- Sequence of change
Notes
You can carry out a number of status changes to a program position atone time. When you do so, the CHANGE_NO field displays the sequence ofthe individual changes to this position.
The new statuses to be set are entered in the STATUS field. If theNOT_ACTIVE indicator is set, the status entered is set to 'not active'.The allowed user statuses are specified in the user status profile.
Example
A program sub-tree contains positions POS_1 and POS_2, among others. Inaddition, the statuses STAT_1 and STAT_2 have been defined in the userstatus profile. For POS_1, you want to set STAT_2 status first, andthen STAT_1 status. In both cases the status should be 'active'. POS_2has STAT_1 that is set to 'active', and you want to change this to 'notactive'.
The USER_STATUS table could look like this:
,,POSITION,,STATUS,,NOT_ACTIVE,,CHANGE_NO
,,-----------------------------------------
,,POS_1,,,,STAT_1,,,, ,,,,,,02
,,POS_2,,,,STAT_1,,,,X,,,,,,01
,,POS_1,,,,STAT_2,,,, ,,,,,,01