cancel
Showing results for 
Search instead for 
Did you mean: 

Setting flag account assignment element in PS within BADI doesn't work

former_member184588
Active Participant
0 Kudos

Hello,

I would like to set the flag for account assignement element and billing element in PS depending on some fields of cProjects. Hint 993642 says that can be done in GCC_PS_PROJECT_LABEL. Unfortunately I don't know how to pass some parameters from cProjects to the relevant method.

For transfering the standard fields I am using (thanks to Matthias) the BADI DPR_FIN_GECCO_ATTR.

There are several blocks with fields I set. Each block looks similar to (except the field and the value)


ls_attribute-data_element     = space.
      ls_attribute-value            = space.
      ls_attribute-field_name_orext = 'WBS_ACCOUNT_ASSIGNMENT_ELEMENT'.
      ls_attribute-fldname_receiver = space.
      ls_attribute-struc_name_copa  = space.
      ls_attribute-field_name_copa  = space.
      ls_attribute-ext_attr_name    = space.
      ls_attribute-ext_attr_value   = space.
      INSERT ls_attribute INTO TABLE ct_attributes.

In the default method the WBS_ACCOUNT_ASSIGNMENT_ELEMENT and WBS_BILLING_ELEMENT are overridden constant to 'X' like hint 993642 describes. But at least I have no glue how to pass my relevant parameters to the method to be able to set the values in my own implementation of this method.

So, does someone knows how to pass values to this method?

Thx,

Vanessa

Edited by: Vanessa Martinez on Oct 28, 2008 9:23 AM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Vanessa,

I tested the proposal I told you today, and when I came into debug mode in BADI F_EX_GCC_PS_PROJECT_LABEL~GET_WBS_ELEMENT, here is what I obtain in structure ATTRIBUTES_OF_EXT_OBJ.

Line | Data_element | value | field_name_orext

1 | | TEST | USER_FIELD_CHAR20_1

2 | | TEST2 | USER_FIELD_CHAR20_2

3 | | TEST3 | USER_FIELD_CHAR10_1

4 | | TEST4 | USER_FIELD_CHAR10_2

So if you build an enhancement at the end of the method (don't hesitate to copy standard code if it helps), you should be able to retrieve your values, and set the flags as wanted.

read table ATTRIBUTES_OF_EXT_OBJ

into ls_attribute

with key field_name_orext = 'USER_FIELD_CHAR10_2' (actually the name you set on cProjects side, so you might be able to do it as well for WBS_ACCOUNT_ASSIGNMENT).

Matthias

Edited by: Matthias BRISSEAU on Oct 28, 2008 2:21 PM

former_member184588
Active Participant
0 Kudos

Hello Matthias,

I realized that you are right with the things you wrote. Unfortunately I have the problem with the CHANGE_WBS_ELEMENT. There I am missing the fields. The point I don't get is why is it possible with the GET_WBS_ELEMENT and not with CHANGE_WBS_ELEMENT.

Is there a way to get the guid of the corresponding project, phase or task?

Thx, Vanessa

Former Member
0 Kudos

Hi Vanessa,

To be honnest, I asked the same question myself, but never spent time on it. I basically followed the SAP note telling me to enhance the GET_WBS_ELEMENT method.

To retrieve the corresponding cProjects GUID from the WBS-E in SAP ERP (if it's not already there in the object attributes, I don't remember), you can use the following way:

- First read the OBJNR from table PRPS.

- Then read EXT_OBJECT_ID from table IAOM_ASSIGNMENTS, with key the previous OBJNR (and business scenario if needed).

Matthias

former_member184588
Active Participant
0 Kudos

Hello Matthias,

your described process works really well. Unfortunately I don't know where I can get the information if the ext_object_id is a project, phase or task. In this way I need to search in the different tables if there is the ext_object_id...

Or is there an easier way? Did I miss something?

Thank you very much and sorry for the delayed reply,

Vanessa

Former Member
0 Kudos

Hi Vanessa,

Could you please explain deeper your last problem? I don't get why/where you want to know the cProject object type.

Matthias

former_member184588
Active Participant
0 Kudos

Hello Matthias,

I am following your advice:

- First read the OBJNR from table PRPS.

- Then read EXT_OBJECT_ID from table IAOM_ASSIGNMENTS, with key the previous OBJNR (and business scenario if needed).

Now I would like to get my customer fields out of the CI+ fields of the project/phase/task I am just handling in the method. In this way I need to know if I have to get it from DPR_PROJECT, DPR_PHASE or DPR_TASK.

For this I think that I need to get the type (proj, phase, task) of the object. Or am I wrong with this and there is an much easier way to get my customer fields?

Thanks a lot,

Vanessa

Former Member
0 Kudos

Vanessa,

This is available in standard, by using BADI DPR_FIN_GECCO_ATTR / modify_attributes method.

As I explained before in another topic, you have to replace the orext field by the standard WBS-E field one (listed in structure BAPI_BUS2054_DETAIL in your ERP system).

As a result, for instance:

*COMPANY CODE

ls_attribute-data_element = space.

ls_attribute-value = <ls_project_int>-ZZCOMPANYCODE.

ls_attribute-field_name_orext = 'COMPANY_CODE'.

ls_attribute-fldname_receiver = space.

ls_attribute-struc_name_copa = space.

ls_attribute-field_name_copa = space.

ls_attribute-ext_attr_name = space.

ls_attribute-ext_attr_value = space.

INSERT ls_attribute INTO TABLE ct_attributes.

As this BADI is on cProjects side, you can easily determine your object type by calling method get_object_type from ir_common instance.

This works perfectly. However, as soon as an error occurs for one field, all the integration is cancelled. So check carefully the controlling cockpit.

Matthias

Answers (0)