cancel
Showing results for 
Search instead for 
Did you mean: 

Searching for method in cProjectthat is creating and updating PSP-elements

former_member184588
Active Participant
0 Kudos

Hello,

I cannot find the save button in the source code of cProjects. Can someone tell me where to find it?

More concrete I am searching the code that creates/updates the PSP-elements. In this place I would like to add some code to set some customer fields and the account element flag. Is there a BADI that I could use for this?

Thx, Vanessa

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello,

To transfer automatically fields from cProjects to PS, you can implement BADI DPR_FIN_GECCO_ATTR, method MODIFY-ATTRIBUTES.

You can find all the fields available in structure BAPI_BUS2054_DETAIL in SAP ERP (except Short ID which is not working in standard). What's more there is a sample code in the BADI.

Once your project is transferred in SAP PS and the BADI is well implemented, the fields will be updated at SAVE in real time.

Then, to default accounting flags, you can define substition rules in PS, or implememt BADI 'GCC_PS_PROJECT_LABEL', method 'GET_WBS_ELEMENT' (everything is in your ERP system). Accounting flags are changeable there.

Matthias

former_member184588
Active Participant
0 Kudos

Hello Matthias,

really thank you for your answer. This sounds to be exactly what I was looking for.

Thank you,

Vanessa

former_member184588
Active Participant
0 Kudos

Thanks for all the already given answers.

former_member184588
Active Participant
0 Kudos

Then, to default accounting flags, you can define substition rules in PS, or implememt BADI 'GCC_PS_PROJECT_LABEL', method 'GET_WBS_ELEMENT' (everything is in your ERP system). Accounting flags are changeable there.

Hello,

sorry for being not excact enough describing the my problem.

I think that I have no need for substition rules in PS.

My problem is that I want to modify user defined fields and fields like "account assignment element". The account assignement element flag is set by the value of a customer field in cProjects. For this I am searching for some source code.

Is there a one2one connection between the cprojects-element and the ps-element (and if yes, how can I use this connection?) or do I really have to lookup the whole ps-structure via 'BAPI_BUS2172_GET_TREE'?

In the example code they are filling ls_attribute-variables like field_name_orext and I don't know where to find the possible values for this because I have no glue how and where the fields are mapped to.

Could someone support me with some example code for handling the PS stuff?

Help would be great.

Have a nice evening,

a really confused Vanessa

Former Member
0 Kudos

>

>

> In the example code they are filling ls_attribute-variables like field_name_orext and I don't know where to find the possible values for this because I have no glue how and where the fields are mapped to.

Hi Vanessa,

You can find the available variabel for transfer in structure BAPI_BUS2054_DETAIL in your PS system (as I wrote above). Then you just have to replace the sample field by the one you want to transfer, and the sample value by the one set in your cProjects application. I assume you will have to retrieve it from the parameter ir_common (could be then a project, a phase, or a task object for instance -> to be treated in different cases depending on object type).

>

>

> Is there a one2one connection between the cprojects-element and the ps-element (and if yes, how can I use this connection?) or do I really have to lookup the whole ps-structure via 'BAPI_BUS2172_GET_TREE'

The connection between cProjects and PS is not always 1 to 1. You can define it in the ERP customizing. For instance, several CPR element can be merged into 1 PS element for accouting integration. 'BAPI_BUS2172_GET_TREE' retrieves only the CPR structure, so I don't think it will be usefull there. But what do you want to achieve here, if all the fields you want to transfer are available in the previous structure?

I wrote this by heart, I'm not at office right now. I will send you a sample code tomorrow if you're still in trouble.

Matthias

former_member184588
Active Participant
0 Kudos

Hello Matthias,

thx a lot for spending time with my strange and maybe uncoordinated questions. There is just that there has to be done so much and the forum is the onliest source of informations I really have. So I am really happy about the answers and hope that I am not to difficult to handle.

Unfortunetly I have some customer fields that are not the user_field_20 style. Furthermore it is an extension of the database table. For this I need the connection between the cProj and PS-elements.

On the other hand and this is the good thing with it I am using the BAPI_BUS2054_DETAIL structure like you told in previous postings. . This works good for a field like user_field20... but I at the moment I am facing problems with a field like "WBS_ACCOUNT_ASSIGNMENT_ELEMENT" because all my elements are flagged and I don't get the flag deactivated. Maybe I am missing there something. At the moment I am using following code:


  DATA ls_attribute LIKE LINE OF ct_attributes.
  DATA lv_resp_org_unit TYPE dpr_tv_resp_organization.
  DATA lr_dpr_project_o TYPE REF TO cl_dpr_project_o.
  DATA lv_project_type TYPE dpr_tv_pro_type.

  DATA irtype TYPE string.
  DATA bestellnummer TYPE string.
  DATA bermotiv TYPE string.

  field-symbols <ls_project_ext> type dpr_ts_project_ext.
  field-symbols <ls_phase_ext> type dpr_ts_phase_ext.
  field-symbols <ls_task_ext> type dpr_ts_task_ext.

  irtype = IR_COMMON->GET_OBJECT_TYPE( ).

  case irtype.
    when 'DPO'. "Project

* BAPI_BUS2172_GET_TREE  ->  guid

      assign ir_project_ext->* to <ls_project_ext>.
      bestellnummer = <ls_project_ext>-extended_attributes-zzbestellnummer.
      bermotiv = <ls_project_ext>-extended_attributes-zzberechnungsm.
      lv_project_type = <ls_project_ext>-pro_type.

      ls_attribute-data_element     = space.
      ls_attribute-value            = ''.
      ls_attribute-field_name_orext = 'WBS_BILLING_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.

      ls_attribute-data_element     = space.
      ls_attribute-value            = ' '.
      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.

      ls_attribute-data_element     = space.
      ls_attribute-value            = 'Want to be a icebear'.
      ls_attribute-field_name_orext = 'USER_FIELD_CHAR20_1'.
      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.

      ls_attribute-data_element     = space.
      ls_attribute-value            = 'Let us rock'.
      ls_attribute-field_name_orext = 'ZZORDERNO'.
      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.


    when 'PPO'.   "Phase
     assign ir_attributes_ext->* to <ls_phase_ext>.

    when 'TTO'. "Task
      assign ir_attributes_ext->* to <ls_task_ext>.

  ENDCASE.

What I understand is that I cannot set the ZZORDERNO in the last ls_attribute-block because it is not definded in the BAPI_BUS2054_DETAIL-structure. But how can I set the WBS_ACCOUNT_ASSIGNMENT_ELEMENT-field when at the end of the process the database table always has all flags set (maybe something in the customizing?)?

Do I need to do a 'commit' in my scenario?

Thx and have a good night/a good morning,

Vanessa

Former Member
0 Kudos

Hi,

Your code logic seems OK. As you set a space for parameter WBS_ACCOUNT_ASSIGNMENT, it's normal the checkbox is not flagged.

To do so, you have to get the data from your object instance (let's say lr_project), find the value of your specific field for account assignment, then set 'X' as the passed value (instead of ' ').

For customer fields defined in an extension table, it's not available in standard. The only way is to build a custom interface: the idea could be to send the additional data to your ERP system through a custom function call, then update the WBS data in the ERP system asynchronously (for performance purpose). It's quite tricky to handle as you have to cope with the standard lock of WBS-E locks. On our side, we updated the Short ID like this: we send a table with WBS + Short ID, call in background a custom FM in SAP ERP, then update the WBS-E. We also set a short delay before the update to avoid the standard lock.

Matthias

former_member184588
Active Participant
0 Kudos

Good morning Matthias,

thanks for the reply. The values regarding the first answer block are not set correctly. They are overridden everytime. But when you say that the programming logic I feel quite confortable with it and will continue investigating this problem.

At the second anser block... quite funny. I understood nothing But this is quite okay at the moment because I have to learn a lot. Your recommondation is surely correct but the topic is much to advanced...

Thx and have a nice day,

Vanessa

At this point the topic is spreading to several questions. So I will close this thread also because my main question is answered. Thx a alot, Vanessa

Answers (0)