cancel
Showing results for 
Search instead for 
Did you mean: 

unable to create a subtask within a task for cProjects

Former Member
0 Kudos

Hi All,

I am unable to create a subtask within a task using BAPI_BUS2175_CREATE. When I pass the GUID of the project definition and fill the corresponding task structures to the BAPI, a task gets created at the phase level. But when I pass the GUID of the task along with the task

information, subtask does not get created. The BAPI returns the following error message:

DPR_SHARED 051: You cannot create Task for (Task Name).

Steps for recreating the error message are:

-


1. GUID is found out using function module CONVERSION_EXIT_DPRCE_INPUT.

2. GUID and task information is passed to BAPI_BUS2175_CREATE.

3. Task is created if project definition GUID is passed, but if task GUID is passed, there is no subtask created. An error message is displayed:

DPR_SHARED 051: You cannot create Task for (Task Name).

Any help would be appreciated.

Thanks,

Tom

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member189058
Active Contributor
0 Kudos

Hi all,

I have used the same and it works absolutely fine.

here is a code sample


CONSTANTS:
   lc_rfc_none        TYPE string VALUE 'NONE'.       " RFC on same server
DATA:
  lv_header_task_guid TYPE bapi_ts_guid-parent_guid, " Header Task GUID
  ls_sub_task TYPE bapi_ts_task,
  ls_sub_task_upd TYPE bapi_ts_task_upd,
  lt_crtask_return TYPE TABLE OF bapiret2,
  ls_extension_in TYPE bapiparex,
  ls_extension_out TYPE bapiparex,
  lv_task_guid TYPE bapi_ts_guid-parent_guid. " Task GUID

* Assign sub-task name. (Task Number is internally generated)
ls_sub_task-task_name = 'ST 1.1'.
ls_sub_task_upd-task_name = 'X'.

* Assign Sort Number
ls_sub_task-sort_number = '00010'.
ls_sub_task_upd-sort_number = 'X'.

* Assign Duration
ls_sub_task-duration = 30.
ls_sub_task_upd-duration = 'X'.

* Assign Work.
ls_sub_task-planned_work = 240.
CALL FUNCTION 'CONVERSION_EXIT_CUNIT_INPUT'
  EXPORTING
    input          = 'H'
  IMPORTING
    output         = ls_sub_task-planned_work_unit
  EXCEPTIONS
    unit_not_found = 1
    OTHERS         = 2.
IF sy-subrc <> 0.
ENDIF.
ls_sub_task_upd-planned_work = 'X'.
ls_sub_task_upd-planned_work_unit = 'X'.

CALL FUNCTION 'BAPI_BUS2175_CREATE'
     DESTINATION lc_rfc_none
     EXPORTING
         iv_parent_guid   = lv_header_task_guid
         is_task          = ls_sub_task
         is_task_upd      = ls_sub_task_upd
         is_extension_in  = ls_extension_in
      IMPORTING
         es_extension_out = ls_extension_out
     TABLES
         return           = lt_crtask_return.
* If task is successfully created,
READ TABLE lt_crtask_return WITH KEY type = lc_success number = '114'.
IF sy-subrc = 0.
* Get task GUID

lv_task_guid = lt_crtask_return-message_v1.

CALL FUNCTION 'BAPI_CPROJECTS_COMMIT_WORK'
  DESTINATION 
    lc_rfc_none
  TABLES
    return = lt_bapiret2.
endif.

In order to find the GUID of the header task use function module:

DPR_GET_GUID_BY_ID_FROM_DB

with IV_Number = task number for the header task and IV_OBJECT_TYPE = TTO

Read the documentation for 'BAPI_BUS2175_CREATE' before using it.

make sure you have maintained IS_TASK_UPDATE structure as well.

Regards,

Reema.

bjoern_panter
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Tom,

a note is in preparation. Please wait until it is finished.

regards

Björn

Former Member
0 Kudos

Hello, I am experiencing the same issue. Do you know if the note has been created? Can someone advice?

Former Member
0 Kudos

Hello All,

Can anyone help me on this? I am stuck here. Any help would be highly appreciated. (Ofcourse points will be awarded)

Former Member
0 Kudos

Hi Guys ,

When i run the bapi_bus2175_get_detail i do not get any results populated in e_roleassingment table. i get the values in authorizations table. The actual finish date is also returned in odd formate. i am trying to get the users that can be assigned to the task and the actual finish date.

Can any one please run this bapi in their system and the results . i want to check if this is a bug in our version of RPM.

Points will be awarded for all helpful answers.

Thanks,

Chandra.

Former Member
0 Kudos

Below is a temporary work around. Not perfect but worked for me.

METHOD IF_DPR_COMMON_REQUEST~GET_RESULT.

*/Initialize returning argument

CLEAR: RV_RESULT.

*/Set result

RV_RESULT = MV_RESULT.

*{ INSERT 1

  • Set RV_RESULT to SUCCESS 'S' in order to migrate TASK in PHASE

  • Only to be done for Z_PHASE Tcode

  • Created By : Petros Yannoutsos

  • Created On : 24 August 2006

  • This will be removed post migration.

if sy-tcode = 'Z_PHASE' or sy-uname = 'YAN059'.

RV_RESULT = 'S'.

endif.

*} INSERT

Former Member
0 Kudos

Hi Tom

I am experiencing the same issue and its driving me nuts. Please post a solution if you come accross one. In the mean tiem its back to the dubugger for me. I will do the same should I come accross a solution.

Regards

Petros