on 01-08-2013 2:47 PM
Hello ,
We created a program to be able to schedule Project in mass. Problem is that when
the second project is scheduled with BAPI_BUS2172_SCHEDULE the previous
and first project is used in BAPI_CPROJECTS_COMMIT_WORK. We tried to
use BAPI_BUS2172_FREE as below but it dumps.
Can someone help us here? Is the code wrong? Do we also need to use
BAPI_CPROJECTS_REMOVE_OBJECTS and how?
Thanks
in advance!
DATA: lv_profile TYPE bapi_ts_status_profile-status_profile,
lv_pguid TYPE bapi_ts_guid-project_definition_guid,
ls_stat TYPE bapi_ts_business_transaction,
lv_guid TYPE dpr_tv_entity_guid.
LOOP AT gt_link.
READ TABLE gt_guid WITH KEY project_id = gt_link-project_id.
IF sy-subrc = 0.
CLEAR: gs_dpr_proj.
lv_pguid = gt_guid-guid.
CALL FUNCTION 'BAPI_BUS2172_SCHEDULE'
EXPORTING
project_definition_guid = lv_pguid
TABLES
return = gt_return.
CALL FUNCTION 'BAPI_CPROJECTS_COMMIT_WORK'
TABLES
return = gt_return.
CALL FUNCTION 'BAPI_BUS2172_FREE'
EXPORTING
project_definition_guid = lv_pguid
iv_remove_changed = 'X'
TABLES
return = gt_return.
ENDIF.
ENDLOOP.
Hello ,
error is found
We realized that the second scheduling was done with still the first GUID. Reason
is that inside the BAPI_BUS2172_SCHEDULE a partial delete is done from the
variables and internal tables, not a complete one. This is due to the fact that
variable sv_structure_built_completely is not reset after the first schedule. I found a note 1660030, but it only concerns Task creation ... not Projects.
The solution was to add next code just before my call of BAPI_BUS2172_SCHEDULE :
CALL METHOD cl_ppm_scheduling=>set_structure_built_completely( ).
This can be closed
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Davy,
what does the dump 'say'? Best regards
Thorsten
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Thorsten ,
hereby the dump detail
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_REF_IS_INITIAL', was not
caught in
procedure "GET_ATTRIBUTES" "(METHOD)", nor was it propagated by a RAISING
clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
You attempted to use a 'NULL' object reference (points to 'nothing')
access a component (variable: "ME->MR_NATIVE_P").
An object reference must point to an object (an instance of a class)
before it can be used to access components.
Either the reference was never set or it was set to 'NULL' using the
CLEAR statement.
METHOD GET_ATTRIBUTES.
DATA:
LR_ATTRIBUTE_ASSIGNMENT TYPE REF TO CL_DPR_PRO_ASSIGNMENT,
LS_CGPL_ATTRIBUTES TYPE CGPL_PROJECT,
LS_CGPL_ATTRIBUTES_OLD TYPE CGPL_PROJECT,
LS_DPR_ATTRIBUTES TYPE DPR_PROJECT,
LS_DPR_ATTRIBUTES_OLD TYPE DPR_PROJECT.
IF ES_ATTRIBUTES IS NOT SUPPLIED
AND ES_ATTRIBUTES_OLD IS NOT SUPPLIED.
RETURN.
ENDIF.
CLEAR:
ES_ATTRIBUTES,
ES_ATTRIBUTES_OLD.
*/Get CGPL-attributes
CALL METHOD mr_native_p->GET_ATTRIBUTES
IMPORTING
EX_ATTRIBUTES = LS_CGPL_ATTRIBUTES
EX_ATTRIBUTES_OLD = LS_CGPL_ATTRIBUTES_OLD.
*/Get attribute assignment
LR_ATTRIBUTE_ASSIGNMENT = GET_ATTRIBUTE_ASSIGNMENT( ).
*/Get DPR-attributes
CALL METHOD LR_ATTRIBUTE_ASSIGNMENT->GET_ATTRIBUTES ( this is where he stucks)
IMPORTING
ES_ATTRIBUTES = LS_DPR_ATTRIBUTES
ES_ATTRIBUTES_OLD = LS_DPR_ATTRIBUTES_OLD.
IF ES_ATTRIBUTES IS SUPPLIED.
*/ Merge attributes from CGPL and DPR
CALL METHOD MERGE_ATTRIBUTES
EXPORTING
IS_CGPL_ATTRIBUTES = LS_CGPL_ATTRIBUTES
IS_DPR_ATTRIBUTES = LS_DPR_ATTRIBUTES
IMPORTING
ES_ATTRIBUTES = ES_ATTRIBUTES.
ENDIF.
IF ES_ATTRIBUTES_OLD IS SUPPLIED.
*/ Merge attributes from CGPL and DPR
CALL METHOD MERGE_ATTRIBUTES
EXPORTING
IS_CGPL_ATTRIBUTES = LS_CGPL_ATTRIBUTES_OLD
IS_DPR_ATTRIBUTES = LS_DPR_ATTRIBUTES_OLD
IMPORTING
ES_ATTRIBUTES = ES_ATTRIBUTES_OLD.
ENDIF.
ENDMETHOD.
Hope this helps
Davy
User | Count |
---|---|
11 | |
6 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.