Before reading this document please go through document Enhancements in SAP Project Systems Assembly Processing
In SAP project systems assembly processing a sales document in SD triggers the creation of a network in PS and the different network activities assigned to that network trigger the creation of a project definition and WBS elements. The leading driver of WBS elements creation is therefore the network activities. Hence WBS elements from the standard project structure that are not assigned to any network activity are not created.
This is a standard behavior of the SAP system and for the moment there is no customizing option to manipulate it.
Analysis of the standard behavior of the system
In SAP project systems assembly processing the project definition and its respective WBS elements are created inside function module CO_ZF_REF_PSP_ATTACH, which is called inside form CO_ORDER_POST (include LCO61F0W). This function module accepts as import parameter a network header structure (i.e. structure CAUFVD). In the assembly processing the network processed by the sales document item is then passed to this function module.
In function module CO_ZF_REF_PSP_ATTACH the different network activities of the network header import parameter are selected and stored in internal table REF_PROJN. This internal table is then passed as table parameter to function module CJWI_PROJECT_NETWORK_ATTACH.
In form TABLES_STANDARDPSP_INIT, called inside function module CJWI_PROJECT_NETWORK_ATTACH, the system constructs internal table TMP_ATTACH_CJWI based on all standard WBS elements assigned to the network activities in import parameter table REF_PROJN.
Then the system calls function module CJWB_PROJECT_COPY so to perform the copy of the standard project structure. In form ELEMENTS_OBLIGATORY the system then calls function module CJWI_FILTER_ELM_OBLIGATORY and uses internal table LISTE_SPS_POS to filter the WBS elements from the standard project structure that should in fact be copied. The basis for the internal table LISTE_SPS_POS is the internal table TMP_ATTACH_CJWI, which was previously constructed in form TABLES_STANDARDPSP_INIT.
Based on the analysis of the standard behavior of the system we can see that internal table TMP_ATTACH_CJWI plays a very important role in deciding which WBS elements should in fact be copied from the standard structure. Hence a simple way to enhance the system would be to create an implicit enhancement implementation at the end of form TABLES_STANDARDPSP_INIT and append to internal table TMP_ATTACH_CJWI the WBS elements without network activity assignment that should also be created by the assembly processing. The system processes this table in a quite robust way and even double entries are correctly handled. An example of code would be as follows:
* assumption: there is a field call ZZCRT in both structures CI_PRPSS and CI_PRPS. This field is just to identify which WBS elements are “important” and should be created even thought no network activity assignment exists.
DATA: lt_prpss TYPE TABLE OF prpss. DATA: ls_prpss LIKE LINE OF lt_prpss. DATA: ls_tab_definitions LIKE LINE OF tab_definitions. DATA: ls_tmp_attach_cjwi LIKE LINE OF tmp_attach_cjwi. DATA: ls_tab_attach TYPE rcjwi_imp1. DATA: l_co_act TYPE c LENGTH 1. * In principle there could be more than 1 entry in table tab_definitions, but based on the assembly processing concepts this seems very unlikely. READ TABLE tab_definitions INTO ls_tab_definitions INDEX 1. IF sy-subrc = 0. CLEAR l_co_act. LOOP AT tab_attach INTO ls_tab_attach. IF ls_tab_attach-f_co = abap_true. l_co_act = abap_true. EXIT. ENDIF. ENDLOOP. SELECT * FROM prpss INTO TABLE lt_prpss WHERE psphi = ls_tab_definitions-pspnr. IF sy-subrc = 0. LOOP AT lt_prpss INTO ls_prpss. CLEAR ls_tmp_attach_cjwi. ls_tmp_attach_cjwi-spsnr = ls_prpss-pspnr. ls_tmp_attach_cjwi-sps_posid = ls_prpss-posid. ls_tmp_attach_cjwi-sps_psphi = ls_prpss-psphi. ls_tmp_attach_cjwi-kokrs = ls_prpss-pkokr. ls_tmp_attach_cjwi-f_co = l_co_act. APPEND ls_tmp_attach_cjwi TO tmp_attach_cjwi. ENDLOOP. ENDIF. ENDIF.
This enhancement is applicable to any situation in which WBS elements should be created by the assembly processing, but there is no necessity at all to have network activities assigned to them.
Important final notes
It is important to highlight that the presence of WBS elements without any assignment to network activities could have impacts in the project scheduling (due to network scheduling). Therefore it would be wise to be sure that these isolated elements should in fact exist.
It is also important to highlight that a similar result could be achieved by using “dummy” activities whose sole purpose is to trigger the creation of the WBS elements to which they are assigned. Nevertheless the presence of these “dummy” activities could be considered disruptive by some users. Another similar result could be achieved by using also these “dummy” activities, but this time combined with method BEFORE_UPDATE of BAdI WORKORDER_UPDATE. In this case the “dummy” activities would be created by the system together with their assigned WBS elements, but inside method BEFORE_UPDATE of BAdI WORKORDER_UPDATE they would be set as deleted and get status DLFL (deletion flag). A code sample for achieving this would be as follows:
* assumption: there is a field call ZZDEL in structures CI_AFVU and CI_PLPO. This field is just to identify which network activity should be set as deleted in method BEFORE_UPDATE.
DATA: lt_jstat TYPE TABLE OF jstat. DATA: ls_jstat LIKE LINE OF lt_jstat. FIELD-SYMBOLS: <t_operation> LIKE it_operation. FIELD-SYMBOLS: <s_operation> LIKE LINE OF it_operation. FIELD-SYMBOLS: <s_operation_old> LIKE LINE OF it_operation_old_afvc. CONSTANTS: c_dlfl TYPE j_status VALUE 'I0076'. ASSIGN ('(SAPLCOBT)AFVG_BT') TO <t_operation>. CHECK <t_operation> IS ASSIGNED. CLEAR ls_jstat. ls_jstat-stat = c_dlfl. APPEND ls_jstat TO lt_jstat. LOOP AT <t_operation> ASSIGNING <s_operation> WHERE zzdel = abap_true. READ TABLE it_operation_old_afvc ASSIGNING <s_operation_old> WITH KEY aufpl = <s_operation>-aufpl aplzl = <s_operation>-aplzl. IF sy-subrc NE 0. CALL FUNCTION 'STATUS_CHANGE_INTERN' EXPORTING objnr = <s_operation>-objnr TABLES status = lt_jstat. IF sy-subrc = 0. <s_operation>-loekz = abap_true. ENDIF. ENDIF. ENDLOOP.