Code to create WBS using BAPI_PROJECT_MAINTAIN

Hi,
I am creating a program for mass upload of project definition and WBS elements. I was able to create the project definition using BAPI_PROJECTDEF_CREATE. For the WBS, I am using BAPI_PROJECT_MAINTAIN. But I was not able to create WBS yet. Can you give me a sample code for the BAPI_PROJECT_MAINTAIN that can create a WBS? What should be the values to be populated in the table i_method_project, i_wbs_element_table, etc.
Please help.. I will reward points.
Thanks,
Lalyn

Hi Lalyn.
Firstly, I would like to suggest you not to use "REWARD POINTS" which is againts the rules of engagement.
Hope you take things positively.
I would like to suggest a couple of references, which are similar to your issue,
[SDN - Reference for Updating value of WBS element - BAPI_PROJECT_MAINTAIN|Update WBS element;
[SDN - Reference for issues related to creation of WBS element using BAPI_PROJECT_MAINTAIN|Problems with BAPI_PROJECT_MAINTAIN;
[SDN Wiki - Standard Reference for ABAP Program to Upload WBS ELEMENTS IN Hierarchy|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abap%2bprogram%2bto%2bupload%2bwbs%2belements%2bin%2bhierarchy ]
Hope that's usefull.
Good Luck & Regards.

Similar Messages

  • Error in Creating Level2 WBS using BAPI_PROJECT_MAINTAIN

    Hi All,
    I am trying to Create a WBS-element at Level 2 of an already existing WBS-element using BAPI_PROJECT_MAINTAIN.
    I suppose the 'hierarchy table' has to be populated for positioning a WBS in the structure. But I am getting the error 'The transfered hierarchy is inconsistent. Too many errors.'.
    I desire to have the following WBS structure in place :
    Project Definition :   PROJ_DEF
    WBS for level 1   :   WBS1
    WBS for level 2   :   WBS2 (This has to be at a sub-node of WBS1,and NOT at the same level as  WBS1)
    Can some one give me solution to this error, and suggest a way to create the WBS in this pattern.
    Regards,
    Somil
    I have written the following code to populate the hierarchy table :
      l_hierarchy-wbs_element         = 'WBS1'.
      l_hierarchy-project_definition   = 'PROJ_DEF'.
      l_hierarchy-up                        = ' '.
      l_hierarchy-down                    = 'WBS2'.
      l_hierarchy-right                     = ' '.
      l_hierarchy-left                       = ' '.
      APPEND l_hierarchy TO t_hierarchy_table.
      l_hierarchy-wbs_element         = 'WBS2'.
      l_hierarchy-project_definition    = 'PROJ_DEF'.
      l_hierarchy-up                         = 'WBS1'.
      l_hierarchy-right                      = ' '.
      l_hierarchy-left                        = ' '.
      l_hierarchy-down                    = ''.
      APPEND l_hierarchy TO t_hierarchy_table.

    For create the network and the activity I use this:
    ***  NETWORK ACTIVITY
       wa_network-network = '000000000001'.
    *  wa_network-network_type = 'PS02'.
       wa_network-short_text = 'Network'.
       wa_network-wbs_element = ld_wbs.
       wa_network-project_definition = ld_projdef.
       APPEND wa_network TO it_network.
       wa_projmethod-objecttype = 'Network'.
       wa_projmethod-method = 'Create'.
       wa_projmethod-objectkey = ld_wbs.
       wa_projmethod-refnumber = '000001'.
       APPEND wa_projmethod TO it_projmethod.
       CLEAR wa_projmethod.
       d_refnumber = '000001'.
       wa_activity-network = wa_network-network.
       wa_activity-project_definition = ld_projdef.
       wa_activity-wbs_element = ld_wbs.
       wa_activity-activity = '0010'.
       wa_activity-control_key = 'PS02'.
       wa_activity-description = 'Activity 1'.
       wa_activity-plant = '1000'.
       wa_activity-cost_elem = '0000705003'.
       wa_activity-purch_org = '1000'.
       wa_activity-pur_group = '100'.
       wa_activity-matl_group = '90'.
       wa_activity-constraint_type_start = '5'.
       wa_activity-constraint_type_finish = '5'.
       APPEND wa_activity TO it_activity.
       CLEAR wa_activity.
       wa_projmethod-objecttype = 'NetworkActivity'.
       wa_projmethod-method = 'Create'.
       wa_projmethod-objectkey = ld_wbs.
       wa_projmethod-refnumber = d_refnumber.
       APPEND wa_projmethod TO it_projmethod.
       d_refnumber = d_refnumber + 1.
       CLEAR wa_projmethod.

  • Issue creating WBS using BAPI_BUS2054_CREATE_MULTI

    Hi All,
    I am trying to create WBS elements under existing project (CJ20N) using “BAPI_BUS2054_CREATE_MULTI”. I am I am getting “ET_RETURN” with message type ‘S-W-I’, even after commit no WBS created. Type ‘S’ message says “Individual check for creating the object WBS Element XXX required”. Please find my code for more info. I am I using correct BAPI? Any hint or suggestion welcome. Thanks in advance.
    Regards,
    Trim
    LOOP AT gt_wbs_element .
        MOVE-CORRESPONDING gt_wbs_element to gt_wbs_element_bapi.
        MOVE : gt_wbs_element-mims_id    to gt_wbs_element_bapi-USER_FIELD_CHAR20_1.
        MOVE : gt_wbs_element-PROJECT_DEFINITION to gv_proj.
    *** Conert all dates
        split_date gt_wbs_element-WBS_BASIC_START_DATE gt_wbs_element_bapi-WBS_BASIC_START_DATE.
        split_date gt_wbs_element-WBS_BASIC_FINISH_DATE gt_wbs_element_bapi-WBS_BASIC_FINISH_DATE.
        split_date gt_wbs_element-WBS_FORECAST_START_DATE gt_wbs_element_bapi-WBS_FORECAST_START_DATE.
        split_date gt_wbs_element-WBS_FORECAST_FINISH_DATE gt_wbs_element_bapi-WBS_FORECAST_FINISH_DATE.
    *   split_date gt_wbs_element-WBS_ACTUAL_START_DATE gt_wbs_element_bapi-WBS_ACTUAL_START_DATE.
    *   split_date gt_wbs_element-WBS_ACTUAL_FINISH_DATE gt_wbs_element_bapi-WBS_ACTUAL_FINISH_DATE.
        APPEND gt_wbs_element_bapi.
    ****   Update Custome 'Z' Fields
        clear : BAPI_TE_WBS_ELEMENT, gv_error.
        BAPI_TE_WBS_ELEMENT-WBS_ELEMENT    = gt_wbs_element-WBS_ELEMENT.
        BAPI_TE_WBS_ELEMENT-ZZCP_APPRBUD   = gt_wbs_element-ZZCP_APPRBUD.
        BAPI_TE_WBS_ELEMENT-ZZCP_ELECT     = gt_wbs_element-ZZCP_ELECT.
        BAPI_TE_WBS_ELEMENT-ZZCP_AREA      = gt_wbs_element-ZZCP_AREA.
        BAPI_TE_WBS_ELEMENT-ZZCP_PROG      = gt_wbs_element-ZZCP_PROG.
        BAPI_TE_WBS_ELEMENT-ZZCP_SUBPR     = gt_wbs_element-ZZCP_SUBPR.
    **    BAPI_TE_WBS_ELEMENT-ZZCP_FINALDAT  = gt_wbs_element-ZZCP_FINALDAT.
        BAPI_TE_WBS_ELEMENT-ZZCP_TOTBUD    = gt_wbs_element-ZZCP_TOTBUD.
    **    BAPI_TE_WBS_ELEMENT-ZZCP_DADHC_REG = gt_wbs_element-ZZCP_DADHC_REG.
    **    BAPI_TE_WBS_ELEMENT-ZZCP_DADHC_CEP = gt_wbs_element-ZZCP_DADHC_CEP.
        BAPI_TE_WBS_ELEMENT-ZZCP_PREDBUD   = gt_wbs_element-ZZCP_PREDBUD.
        BAPI_TE_WBS_ELEMENT-ZZCP_CLIENT    = gt_wbs_element-ZZCP_CLIENT.
        BAPI_TE_WBS_ELEMENT-ZZCP_PM_NAME   = gt_wbs_element-ZZCP_PM_NAME.
        GT_EXTENSION_IN-STRUCTURE = 'BAPI_TE_WBS_ELEMENT'.
        GT_EXTENSION_IN-VALUEPART1 = BAPI_TE_WBS_ELEMENT+0(199).
        GT_EXTENSION_IN-VALUEPART2 = BAPI_TE_WBS_ELEMENT+199(171).
        APPEND GT_EXTENSION_IN.
        MOVE-CORRESPONDING gt_wbs_element to wa_wbs_elem.
        AT END OF PROJECT_DEFINITION.
    *** Inalise BAPI
          CALL FUNCTION 'BAPI_PS_INITIALIZATION'.
          clear gt_return[].
          CALL FUNCTION 'BAPI_BUS2054_CREATE_MULTI'
            EXPORTING
              I_PROJECT_DEFINITION       = gv_proj
            TABLES
              IT_WBS_ELEMENT             = gt_wbs_element_bapi
              ET_RETURN                  = gt_return
              EXTENSIONIN                = gt_extension_in
    *         EXTENSIONOUT               =
            EXCEPTIONS
              error_message              = 1
              others                     = 2.
    *** Check GT_RESULT for success
          LOOP AT gt_return where type co 'EA'.
            gv_error = 'X'.
          ENDLOOP.
          IF gv_error is initial.
            CALL FUNCTION 'BAPI_PS_PRECOMMIT'
              TABLES
                ET_RETURN = gt_return_pre.
            LOOP AT gt_return_pre where type co 'EA'.
              gv_error = 'X'.
            ENDLOOP.
          ENDIF.
          IF gv_error is INITIAL.
            CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
              EXPORTING
                WAIT   = '1'
              IMPORTING
                RETURN = GT_RETURN_COMMIT.
            clear gv_write.
            format color 4.
            CONCATENATE 'Success: WBS Attached to Project' gv_proj '-'
                   into  gv_write.
            WRITE / gv_write. CLEAR gv_write.
            move-corresponding wa_wbs_elem to gt_wbs_suc.
            gt_wbs_suc-message      = gv_write.
            gt_wbs_suc-message_type = 'S'.
            append gt_wbs_suc.
            format reset.
          else.
            clear gv_write.
            format color 6.
            CONCATENATE 'Error: Attaching WBS to Project' space '-' space gv_proj
                    into  gv_write.
            WRITE / gv_write. CLEAR gv_write.
            move-corresponding wa_wbs_elem to gt_wbs_suc.
            gt_wbs_suc-message      = gv_write.
            gt_wbs_suc-message_type = 'E'.
            append gt_wbs_suc.
            format reset.
          ENDIF.
          CLEAR: gv_proj, gt_wbs_element_bapi, gt_extension_in, gt_return_pre, GT_RETURN_COMMIT.
          refresh: gt_wbs_element_bapi, gt_extension_in, gt_return_pre, GT_RETURN_COMMIT.
        endat.
      ENDLOOP.

    Hi Trim
    The message comes from (It is S004) in the BAPI_BUS2054_CREATE_MULTI (see below bold).  I would be placing a breakpoint at the point where the BAPI is calling the function PS_BAPI_PREPARE to see if the lv_subrc variable is being set at this stage.
    Cheers
    Gareth
          call function 'CJ2054_CREATE'
               exporting
                    i_pspid             = i_project_definition
                    i_wbs_element       = ls_wbs_element
               tables
                    extensionin         = extensionin
               exceptions
                    element_not_created = 1
                    dates_not_created   = 2.
        endif.
        if sy-subrc <> 0 or lv_subrc <> 0.
          message e007(cnif_pi) with text-wbs ls_wbs_element-wbs_element
                                into null.
          lv_error = con_yes.
        else.
    <b>      message s004(cnif_pi) with text-wbs ls_wbs_element-wbs_element
                                into null.</b>

  • How to create services using BAPI_PROJECT_MAINTAIN

    Hi Gurus,
    I wish to create services ( in Ext Processing tab in tcode CN22) using BAPI_PROJECT_MAINTAIN. Please help me.
    Regards
    Ajay
    Moderator message: please search for available information/documentation before asking, try solving problems yourself first.
    Edited by: Thomas Zloch on Dec 8, 2010 2:50 PM

    Hi Lalyn.
    Firstly, I would like to suggest you not to use "REWARD POINTS" which is againts the rules of engagement.
    Hope you take things positively.
    I would like to suggest a couple of references, which are similar to your issue,
    [SDN - Reference for Updating value of WBS element - BAPI_PROJECT_MAINTAIN|Update WBS element;
    [SDN - Reference for issues related to creation of WBS element using BAPI_PROJECT_MAINTAIN|Problems with BAPI_PROJECT_MAINTAIN;
    [SDN Wiki - Standard Reference for ABAP Program to Upload WBS ELEMENTS IN Hierarchy|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/abap%2bprogram%2bto%2bupload%2bwbs%2belements%2bin%2bhierarchy ]
    Hope that's usefull.
    Good Luck & Regards.

  • Create Activity using BAPI_PROJECT_MAINTAIN !!!

    All,
    I have been working to create the PD, WBS Elements, Networks & Activities using the FM BAPI_PROJECT_MAINTAIN.
    I am able to create the PD, WBS Elements & Networks.
    Now when I am trying to create the Activities, I am unable to find what OBJECTKEY needs to be given in the I_METHOD_PROJECT Table of the FM.
    OBJECTTYPE = NETWORKACTIVITY
    METHOD        = CREATE
    OBJECTKEY  = ????
    I get an Error as - "An incorrect object key was entered for object type NetworkActivity" - when I give the OBJECTKEY as the Network Number for which I want to create the Activity.
    I have serached everywhere I could but unable to get the solution.
    Please advise - I have literally given up now.
    Regards,
    Pankaj Agarwal.

    Project Definition needs to be passed in OBJECTKEY, if OBJECTTYPE = 'PROJECTDEFINITION'.
    Edited by: Poorna Chandrasekhar on Jan 29, 2009 5:12 PM

  • Wbs element can no longer be shifted error while creating wbs

    i am trying to create wbs with bapi_project_maintain, i am facing an error with message no 418 WBS element 1899-CAP-10-100-001-1507 can no longer be shifted

    - You tried to change the hierarchy of the project, despite the fact that some budget has already been assigned. Try to add the WBS to another node or place in the project hierarchy.
    - You could also reset budget using transaction CJ30 and remove the availability control on the project using transaction CJBW.
    Regards,
    Raymond

  • The BAPI of creating WBS

    Dear experts,
         Can you tell which BAPI to create WBS(Cost Plan) ?
         Can you tell which BAPI to modify WBS(Cost Plan) ?
         Which T-code to create WBS  ?
    Best Regards,
    Merry

    hello,
    check this FM BAPI_BUS2054_CREATE_MULTI
    WBS elements can be created for a project with BAPI "BAPI_BUS2054_CREATE_MULTI". To do this, parameter "I_PROJECT_DEFINITION" must contain the project definition for which the WBS elements are to be created. The individual WBS elements with all required values must be entered in table "IT_WBS_ELEMENT_TABLE". The WBS elements are created next to each other, in the same sequence as in table "IT_WBS_ELEMENT_TABLE". A WBS element under which the new WBS elements are to be created can be specified in parameter "I_WBS_UP". A WBS element that is to be located directly to the left of the new WBS elements can be specified with parameter "I_WBS_LEFT". If "I_WBS_LEFT" is not specified, the new WBS elements are added on the left-hand side. If I_WBS_UP is also not specified, the new WBS elements are added on the left and on the first level.
    Note: Check the below link it will be useful,
    http://abap.wikiprog.com/wiki/BAPI_BUS2054_CREATE_MULTI
    for modify please check the documentation of FMs
    AIPO_WBSELEM_MODIFY_CHECK
    AIPO_WBSELEM_MODIFY_FIELDS..
    for tcode check this link CJ20N
    to know abt WBS element read the site
    http://www.sap-img dot com/project/what-is-wbs-element.htm
    Thank u,
    santhosh

  • Create PO using BAPI

    i hve written foll code to crate PO using BAPI. but i get a runtime error:
    "Type conflict when calling a function module (field length)."
    the code is as follows:
    REPORT  z_h_d_bapi_1                            .
    DATA : bapiekko like bapiekko,
           po_header LIKE bapiekko OCCURS 0 WITH HEADER LINE,
           po_items LIKE bapiekpo OCCURS 0 WITH HEADER LINE,
           po_item_schedules like bapieket occurs 0 with header line,
           return LIKE bapireturn OCCURS 0 WITH HEADER LINE.
    *POPULATE HEADER DATA FOR PO
    CLEAR po_header.
    REFRESH po_header.
    po_header-po_number  = '4500000000'    .
    po_header-created_on   = '06/05/2006'     .
    po_header-purch_org = '1000'      .
    po_header-pur_group = '026'     .
    po_header-vendor  = '420'    .
    po_header-sales_pers  = 'Mr. rahul'    .
    APPEND po_header.
    *POPULATE ITEM DATA.
    CLEAR po_items.
    REFRESH po_items.
    po_items-po_item = '00030'.
    po_items-material = 'T-M15D06'.
    po_items-plant = '1000'.
    po_items-store_loc = '0001'.
    po_items-quantity = '1000'.
    po_items-unit = '10'.
    po_items-net_price = '1000000'.
    po_items-price_unit = '67000'.
    APPEND po_items.
    *POPULATE SCHEDULES DATA
    clear po_item_schedules.
    refresh po_item_schedules.
    po_item_schedules-po_item = '00030'.
    po_item_schedules-deliv_date = sy-datum.
    po_item_schedules-quantity = '1000'.
    append po_item_schedules.
    CALL FUNCTION 'BAPI_PO_CREATE'
      EXPORTING
        po_header                        = bapiekko
      PO_HEADER_ADD_DATA               = po_header
      HEADER_ADD_DATA_RELEVANT         = '1'
      PO_ADDRESS                       =
       SKIP_ITEMS_WITH_ERROR            = 'X'
      ITEM_ADD_DATA_RELEVANT           = '1'
      HEADER_TECH_FIELDS               =
    IMPORTING
      PURCHASEORDER                    =
      tables
        po_items                         = po_items
      PO_ITEM_ADD_DATA                 =
        po_item_schedules                = po_item_schedules
       PO_ITEM_ACCOUNT_ASSIGNMENT       =
      PO_ITEM_TEXT                     =
       RETURN                            = return
      PO_LIMITS                        =
      PO_CONTRACT_LIMITS               =
      PO_SERVICES                      =
      PO_SRV_ACCASS_VALUES             =
      PO_SERVICES_TEXT                 =
      PO_BUSINESS_PARTNER              =
      EXTENSIONIN                      =
      POADDRDELIVERY                   =
    LOOP AT return.
        WRITE / return-message.
    ENDLOOP.

    Hiral,
    Check the below code for creating PO using the BAPI BAPI_PO_CREARE.
    Check u have used conversion input (CONVERSION_EXIT_ALPHA_INPUT) for the vendor. Also check in table <b>lfa1</b> that the given vendor is present or not.
    *& Report  YPRA_SAMPLE08                                               *
    REPORT  ypra_sample08.
    Create Service PO
    DATA: wa_po_header TYPE bapiekkoc,
          wa_po_add_header TYPE bapiekkoa,
          ws_po_number TYPE bapiekkoc-po_number,
          ws_po_number1 TYPE bapimepoheader-po_number,
          ws_pack_no TYPE packno,
          i_poitems TYPE bapiekpoc OCCURS 0 WITH HEADER LINE,
          i_poitems_sch TYPE bapieket OCCURS 0 WITH HEADER LINE,
          i_acct_*** TYPE bapiekkn OCCURS 0 WITH HEADER LINE,
          i_return TYPE bapireturn OCCURS 0 WITH HEADER LINE,
          i_return1 TYPE bapiret2 OCCURS 0 WITH HEADER LINE,bapiret2,
          i_services TYPE bapiesllc OCCURS 0 WITH HEADER LINE,
          bapi_esll TYPE bapiesllc OCCURS 0 WITH HEADER LINE,
          i_srv_accass TYPE bapiesklc OCCURS 0 WITH HEADER LINE,
          i_po_limits TYPE bapiesuhc OCCURS 0 WITH HEADER LINE,
          i_po_contract_limits  TYPE bapiesucc OCCURS 0 WITH HEADER LINE.
    DATA: serial_no LIKE bapiesknc-serial_no,
          line_no   LIKE bapiesllc-line_no,
          pack_no LIKE bapiesllc-line_no.
    wa_po_header-doc_date = sy-datum.
    wa_po_header-doc_type = 'ZES3'.
    wa_po_header-co_code = 'SP01'.
    wa_po_header-purch_org = 'SP01'.
    wa_po_header-pur_group = 'ES1'.
    wa_po_header-vendor = '0001000025'.
    wa_po_header-created_by = sy-uname.
    wa_po_header-langu    = sy-langu.
    i_poitems-po_item = 10.
    i_poitems-item_cat = '9'.
    i_poitems-acctasscat = 'K'.
    i_poitems-plant = 'SP01'.
    i_poitems-short_text = '007002046'.
    i_poitems-disp_quan = '1'.
    *i_poitems-mat_grp = 'ZES1'.
    *i_poitems-pckg_no  = '0000000265'.
    *i_poitems-line_no  = 1.
    i_poitems-pckg_no  = 10.
    APPEND i_poitems.
    i_poitems_sch-po_item = 10.
    i_poitems_sch-deliv_date = sy-datum.
    APPEND i_poitems_sch.
    i_acct_***-po_item = 10.
    i_acct_***-serial_no = 01.
    *i_acct_***-g_l_acct = '0007910100'.
    i_acct_***-co_area  = '1000'.
    i_acct_***-cost_ctr = '0000012000'.
    APPEND i_acct_***.
    i_acct_***-po_item = 10.
    i_acct_***-serial_no = 02.
    i_acct_***-co_area  = '1000'.
    i_acct_***-cost_ctr = '0000012000'.
    APPEND i_acct_***.
    i_acct_***-po_item = 10.
    i_acct_***-serial_no = 03.
    i_acct_***-co_area  = '1000'.
    i_acct_***-cost_ctr = '0000012000'.
    APPEND i_acct_***.
    *i_acct_***-po_item = 10.
    *i_acct_***-serial_no = 04.
    *i_acct_***-co_area  = '1000'.
    *i_acct_***-cost_ctr = '0000012000'.
    *APPEND i_acct_***.
    bapi_esll-pckg_no = 10.
    bapi_esll-line_no = 1.
    bapi_esll-outl_no = '0'.
    bapi_esll-outl_ind = 'X'.
    bapi_esll-subpckg_no = 20.
    bapi_esll-from_line = 1.
    bapi_esll-to_line = 3.
    APPEND bapi_esll.
    bapi_esll-pckg_no = 20.
    bapi_esll-line_no = 2.
    bapi_esll-service = '000000000003000018'.
    bapi_esll-quantity = '317946.000'.
    bapi_esll-gr_price = '21111.0000'.
    bapi_esll-price_unit = '10000'.
    APPEND bapi_esll.
    *bapi_esll-pckg_no = 30.
    *bapi_esll-line_no = 1.
    *bapi_esll-outl_no = '0'.
    *bapi_esll-outl_ind = 'X'.
    *bapi_esll-subpckg_no = 40.
    *APPEND bapi_esll.
    bapi_esll-pckg_no = 20.
    bapi_esll-line_no = 3.
    bapi_esll-service = '000000000003000017'.
    bapi_esll-quantity = '317946.000'.
    bapi_esll-gr_price = '21111.0000'.
    bapi_esll-price_unit = '10000'.
    APPEND bapi_esll.
    i_srv_accass-pckg_no = 10.
    i_srv_accass-line_no = 1.
    i_srv_accass-serno_line = 01.
    i_srv_accass-serial_no = 01.
    i_srv_accass-percentage = 100.
    APPEND i_srv_accass.
    i_srv_accass-pckg_no = 20.
    i_srv_accass-line_no = 2.
    i_srv_accass-serno_line = 02.
    i_srv_accass-serial_no = 02.
    i_srv_accass-percentage = 100.
    i_srv_accass-quantity = '1'.
    APPEND i_srv_accass.
    i_srv_accass-pckg_no = 20.
    i_srv_accass-line_no = 3.
    i_srv_accass-serno_line = 03.
    i_srv_accass-serial_no = 03.
    i_srv_accass-percentage = 100.
    i_srv_accass-quantity = '1'.
    APPEND i_srv_accass.
    *i_srv_accass-pckg_no = 40.
    *i_srv_accass-line_no = 3.
    *i_srv_accass-serno_line = 03.
    *i_srv_accass-serial_no = 03.
    *i_srv_accass-percentage = 100.
    *i_srv_accass-quantity = '1'.
    *APPEND i_srv_accass.
    CALL FUNCTION 'BAPI_PO_CREATE'
      EXPORTING
        po_header                        = wa_po_header
        po_header_add_data               = wa_po_add_header
      HEADER_ADD_DATA_RELEVANT         =
      PO_ADDRESS                       =
        skip_items_with_error            = 'X'
      ITEM_ADD_DATA_RELEVANT           =
      HEADER_TECH_FIELDS               =
    IMPORTING
       purchaseorder                    = ws_po_number
      TABLES
        po_items                         = i_poitems
      PO_ITEM_ADD_DATA                 =
        po_item_schedules                = i_poitems_sch
        po_item_account_assignment       = i_acct_***
      PO_ITEM_TEXT                     =
       return                           = i_return
       po_limits                        = i_po_limits
       po_contract_limits               = i_po_contract_limits
        po_services                      = bapi_esll
        po_srv_accass_values             = i_srv_accass
      PO_SERVICES_TEXT                 =
      PO_BUSINESS_PARTNER              =
      EXTENSIONIN                      =
      POADDRDELIVERY                   =
    IF NOT ws_po_number  IS INITIAL.
      ws_po_number1 = ws_po_number.
      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
        EXPORTING
          wait = '2'.
      WRITE: / ws_po_number.
    ENDIF.
    break gbpra8.
    LOOP AT i_return.
    ENDLOOP.
    Regards,
    Prakash.

  • How to use BAPI_PROJECT_MAINTAIN to create network activities under WBS elements ?

    Hello ABAPers,
    I have been using BAPI_PROJECT_MAINTAIN to create Project and WBS elements and I have done them without any errors.
    Now I need help on how to create network activities.
    Can anyone share on how to pass data to I_NETWORK table and I_ACTIVITY table and a brief description on what they are ?
    Thanks in advance,
    Kiran

    Hi Kiran,
    Do the following steps
    1.pass the following to i_method_project
    method_project-refnumber = lv_refnum.
    method_project-objecttype = 'NETWORK-ACTIVITY'.
    method_project-method = 'UPDATE'.
    concatenate aufnr(network nr) vornr(activity) into method_project-objectkey.
    2.Into i_activity
    activity-network = aufnr.
    activity-activity = vornr.
    3.i_activity_update
    activity_update-network = 'X'.
    activity_update-activity = 'X'.
    It should work.If not let me know.
    Rgds,
    K.S.

  • Creating a WBS hierarchy using BAPI_PROJECT_MAINTAIN

    Hi,
    I am trying to create WBS hierarchy, but i am facing some problem in creating it. The code that i have written is :
    DATA : I_PROJECT_DEFINITION LIKE BAPI_PROJECT_DEFINITION OCCURS 0 WITH HEADER LINE,
           I_PROJECT_DEFINITION_UPD LIKE  BAPI_PROJECT_DEFINITION_UP OCCURS 0 WITH HEADER LINE,
           RETURN LIKE  BAPIRETURN1 OCCURS 0 WITH HEADER LINE,
           I_METHOD_PROJECT LIKE BAPI_METHOD_PROJECT OCCURS 0 WITH HEADER LINE,
           I_WBS_ELEMENT_TABLE LIKE BAPI_WBS_ELEMENT OCCURS 0 WITH HEADER LINE,
           I_WBS_HIERARCHIE_TABLE LIKE BAPI_WBS_HIERARCHIE OCCURS 0 WITH HEADER LINE.
    CLEAR I_PROJECT_DEFINITION.
    I_PROJECT_DEFINITION-PROJECT_DEFINITION = 'TEST_2'.
    APPEND I_PROJECT_DEFINITION.
    CLEAR I_METHOD_PROJECT.
    MOVE 'WBS-Element' TO I_METHOD_PROJECT-OBJECTTYPE.
    MOVE  'Create' TO I_METHOD_PROJECT-METHOD.
    MOVE 'T1' TO I_METHOD_PROJECT-OBJECTKEY.
    MOVE '000001' TO I_METHOD_PROJECT-REFNUMBER.
    APPEND I_METHOD_PROJECT.
    CLEAR I_METHOD_PROJECT.
    MOVE 'WBS-Element' TO I_METHOD_PROJECT-OBJECTTYPE.
    MOVE  'Create' TO I_METHOD_PROJECT-METHOD.
    MOVE 'T2' TO I_METHOD_PROJECT-OBJECTKEY.
    MOVE '000002' TO I_METHOD_PROJECT-REFNUMBER.
    APPEND I_METHOD_PROJECT.
    CLEAR I_METHOD_PROJECT.
    MOVE 'WBS-Element' TO I_METHOD_PROJECT-OBJECTTYPE.
    MOVE  'Create' TO I_METHOD_PROJECT-METHOD.
    MOVE 'T3' TO I_METHOD_PROJECT-OBJECTKEY.
    MOVE '000003' TO I_METHOD_PROJECT-REFNUMBER.
    APPEND I_METHOD_PROJECT.
    CLEAR I_METHOD_PROJECT.
    MOVE  'Save' TO I_METHOD_PROJECT-METHOD.
    APPEND I_METHOD_PROJECT.
    CLEAR I_WBS_ELEMENT_TABLE.
    I_WBS_ELEMENT_TABLE-WBS_ELEMENT = 'T1'.
    I_WBS_ELEMENT_TABLE-PROJECT_DEFINITION = I_PROJECT_DEFINITION-PROJECT_DEFINITION.
    I_WBS_ELEMENT_TABLE-DESCRIPTION = 'T1'.
    APPEND I_WBS_ELEMENT_TABLE.
    CLEAR I_WBS_ELEMENT_TABLE.
    I_WBS_ELEMENT_TABLE-WBS_ELEMENT = 'T2'.
    I_WBS_ELEMENT_TABLE-PROJECT_DEFINITION = I_PROJECT_DEFINITION-PROJECT_DEFINITION.
    I_WBS_ELEMENT_TABLE-DESCRIPTION = 'T2'.
    APPEND I_WBS_ELEMENT_TABLE.
    CLEAR I_WBS_ELEMENT_TABLE.
    I_WBS_ELEMENT_TABLE-WBS_ELEMENT = 'T3'.
    I_WBS_ELEMENT_TABLE-PROJECT_DEFINITION = I_PROJECT_DEFINITION-PROJECT_DEFINITION.
    I_WBS_ELEMENT_TABLE-DESCRIPTION = 'T3'.
    APPEND I_WBS_ELEMENT_TABLE.
    CLEAR I_METHOD_PROJECT.
    MOVE 'WBS-Hierarchy' TO I_METHOD_PROJECT-OBJECTTYPE.
    MOVE  'Create' TO I_METHOD_PROJECT-METHOD.
    APPEND I_METHOD_PROJECT.
    CLEAR I_METHOD_PROJECT.
    MOVE  'Save' TO I_METHOD_PROJECT-METHOD.
    APPEND I_METHOD_PROJECT.
    CLEAR I_WBS_HIERARCHIE_TABLE.
    MOVE 'T1' TO I_WBS_HIERARCHIE_TABLE-WBS_ELEMENT.
    MOVE I_PROJECT_DEFINITION-PROJECT_DEFINITION TO I_WBS_HIERARCHIE_TABLE-PROJECT_DEFINITION.
    MOVE 'T2' TO I_WBS_HIERARCHIE_TABLE-DOWN.
    APPEND I_WBS_HIERARCHIE_TABLE.
    CLEAR I_WBS_HIERARCHIE_TABLE.
    MOVE 'T2' TO I_WBS_HIERARCHIE_TABLE-WBS_ELEMENT.
    MOVE I_PROJECT_DEFINITION-PROJECT_DEFINITION TO I_WBS_HIERARCHIE_TABLE-PROJECT_DEFINITION.
    MOVE 'T1' TO I_WBS_HIERARCHIE_TABLE-UP.
    MOVE 'T3' TO I_WBS_HIERARCHIE_TABLE-RIGHT.
    APPEND I_WBS_HIERARCHIE_TABLE.
    CLEAR I_WBS_HIERARCHIE_TABLE.
    MOVE 'T3' TO I_WBS_HIERARCHIE_TABLE-WBS_ELEMENT.
    MOVE I_PROJECT_DEFINITION-PROJECT_DEFINITION TO I_WBS_HIERARCHIE_TABLE-PROJECT_DEFINITION.
    MOVE 'T1' TO I_WBS_HIERARCHIE_TABLE-UP.
    MOVE 'T2' TO I_WBS_HIERARCHIE_TABLE-LEFT.
    APPEND I_WBS_HIERARCHIE_TABLE.
    CALL FUNCTION 'BAPI_PROJECT_MAINTAIN'
      EXPORTING
        i_project_definition               = I_PROJECT_DEFINITION
        i_project_definition_upd           = I_PROJECT_DEFINITION_UPD
      IMPORTING
        RETURN                             = RETURN
      tables
        i_method_project                   = I_METHOD_PROJECT
      I_WBS_ELEMENT_TABLE_UPDATE         =
        I_WBS_ELEMENT_TABLE                = I_WBS_ELEMENT_TABLE
      I_WBS_MILESTONE_TABLE              =
      I_WBS_MILESTONE_TABLE_UPDATE       =
        I_WBS_HIERARCHIE_TABLE             = I_WBS_HIERARCHIE_TABLE
      I_NETWORK                          =
      I_NETWORK_UPDATE                   =
      I_ACTIVITY                         =
      I_ACTIVITY_UPDATE                  =
      I_RELATION                         =
      I_RELATION_UPDATE                  =
      E_MESSAGE_TABLE                    =
      I_ACTIVITY_ELEMENT                 =
      I_ACTIVITY_ELEMENT_UPDATE          =
      I_ACTIVITY_MILESTONE               =
      I_ACTIVITY_MILESTONE_UPDATE        =
    Please can anyone check and tell me what exactly is the problem?
    Thank you.

    Hi Poorvika,
    I am facing same problem. If you find solution, can you please post it here?
    Thanks
    ABAPer

  • Creating the WBS using bapis

    i am creating the WBS using thses bapis
    1. BAPI_PS_INITIALIZATION
    2. BAPI_BUS2001_CREATE
    3. BAPI_PS_PRECOMMIT
    4. BAPI_TRANSACTION_COMMIT/BAPI_TRANSACTION_ROLLBACK
    but i am getting the error
    Field COMPANY_CODE/Company code: Changing the contents of the field is not permitted
    Field BUSINESS_AREA/Business area: Changing the contents of the field is not permitted 
    Field WBS_ACCOUNT_ASSIGNMENT_ELEMENT/Acct asst elem.: Changing the contents of the field is not permitted         
    Field OBJECTCLASS/Object Class: Changing the contents of the field is not permitted     
    Please help to resolve this
    kanishak

    Hi,
    have you tried to look for corresponding OSS notes? I've never had any problems with this BAPI and according to BAPI documentation all fields from input structure can be used. It looks more like error. Or don't you have any validation for projects definitions? If you can find the reason you can still debug that code and see why it's failing.
    BTW your BAPI is for Project definition creation, not WBS element. You can maintain WBS elements form any project using BAPI BAPI_PROJECT_MAINTAIN.
    Cheers

  • Creating WBS element using bapi BAPI_PS_INITIALIZATION

    Hi All,
    I have created Project definition successfully  using function module "BAPI_PROJECT_MAINTAIN" .
    But while trying to create Wbs-Element for the project definition using same function module  "BAPI_PROJECT_MAINTAIN"   we are getting the following error
    Key does not correspond to mask: TR.XXXXX.X.X.XXX
    Could any one help me out to resolve this issue.
    Thanks in advance.
    harsha p

    Hi harsha p,
    Error CJ609 "Key does not correspond to mask:TR.XXXXX.X.X.XXX" is always caused by an inconsistency between the project/WBS object number and the coding mask. Therefore, to solve the problem can you please try to run report ZZADJUSTPOSID from note 453280 attached?
    The report should be imported into your system manually by SE38.
    Please run it first in test mode to check the wrong entries and then correct them in update mode.
    Best Regards,
    Edna

  • WBS creation using BAPI_PROJECT_MAINTAIN

    Hi Gurus
    We are trying to create a WBS element with custom program. We are succesfully able to create the WBS element but facing errors in positioning the WBS element.
    The input for the program is project and parent under which the WBS has to be created. The program is working fine when we create the WBS under a parent which is in CRTD system status. But, when we try to create WBS under a parent which is in REL system status, it is terminating with errors. (Errors: CJ 467 - subhierarchy is not consistent, CJ 280 - Termination - too many errors, CJ 036 - Data cannot be saved). We are using BAPI_PROJECT_MAINTAIN for this.
    We have tried to remove all "custom" configuration and go with standard SAP configuration (like investment profile, status profile, field selection, etc).
    Can anybody suggest anything that can help us to get through the error?
    Thanks a lot in advance,

    Hi,
    I am using this BAPI without any problems but I don't have access to that system. So maybe you have some issue with data. What you can do is that you will create your project manually in CJ20N and the you will call BAPI BAPI_PROJECT_GETINFO to get info about your project. You can compare your BAPI call with structures for project created manually.  It may help you to find a reason for those error messages. You can also try to debug where you are getting those messages.
    Cheers

  • Creating Proj Defn using BAPI_PROJECT_MAINTAIN

    Hi all,
    I ahve created Proj defn and an WBS element using BAPI_PROJECT_MAINTAIN...
    Now i want ot know the procedure to create network header and an activity...
    I have created an Network header also....
    and i got error while creating an activity
    the error reads as
    "Relationship type could not converted to the internal format..."
    Hw to overcome this error...
    thanx in advance

    Check this note
    Note 501332 - No type of relationship for BOR 'Network'
    if this note does not resolve your problem , then you may need to use conversion exit for Relationship Type.

  • Problem while creating WBS elements using LSMW

    Hello experts,
    I am able to create Project Definitions using LSMW. (using recording)
    But there is a problem while creating WBS elements.
    Tcode CJ20 has table control and that will become problem for multiple rows (levels).
    Can anyone suggest a solution to mass upload WBS elements?
    Thanks for your valuable advice.

    Hi,
    Instead of using "BAPI_PROJECT_MAINTAIN", use following solution. We are using this solution and it is working pretty good.
    If the WBS element is already created and you want to create one more with same data, first get the WBS related information using BAPI_PROJECT_GETINFO as you are doing currently.
    I am using different sets of BAPIs to create project, create / change WBS element.
    I use function module from Function group CJ2001 ( Project related BAPIs ), CJ2054 ( WBS related BAPIs ) and PS_BAPI ( pre/post processing BAPIs ). There are specific order in which you need to execute these BAPIs.
    For example if you want to create / change the WBS element, the BAPIs sequence is:
    <b>1. BAPI_PS_INITIALIZATION
    2. BAPI_BUS2054_CREATE_MULTI ( to create  WBS )
             or
    2. BAPI_BUS2054_CHANGE_MULTI ( to change WBS )
    3. BAPI_PS_PRECOMMIT
    4. BAPI_TRANSACTION_COMMIT</b>
    Check the documentation of BAPI "BAPI_BUS2054_CREATE_MULTI " to see how these function modules work.
    Let me know if you need further information.
    Regards,
    RS

Maybe you are looking for

  • Itunes 10.5 Install fail (win Vista 32bit)

    Hello everyone. I'm really frustrated why i can't complete the new update for itunes. I've had no problems with previous updates/installers. Check the picture below (it's in dutch). What should I do? I uninstalled itunes, maybe that should work for i

  • TDS rate for Vendor

    Dear All,               As I need to maintan TDS rate as per requirement of user and requirement is as follows, Vendor Name           CMS Info Systems Pvt Ltd PAN                    AAMCS2311K Vendor Code               5314 Rate:                NIL C

  • Finicky mouse/lost work

    I know that if you swipe the mouse surface with your finger sideways, you go to a page ahead or behind, like swiping on the ipad.  Every once in a while though, I did not purposely swipe and the page I'm working on goes away.  If I try to get back to

  • Positioning an image

    <a href = "#" class = "navbar-brand"><img src="img/logo.png" /> </a> How do i position my logo. I need to position it a certaint distance from the top. Do i use css and make a div around this. I tried that and it didnt work.

  • TS3694 I can only restore my iphone so far and then it stops

    I can only restore my iphone so far and then it stops