Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Update Price in PM Order Operations Item Services ABAP

joao_loureiro
Discoverer

Hi gurus,

I need to update external service lines price in PM order operation.

I have a implementation using BAPI_ALM_ORDER_MAINTAIN. Basically, I just need to pass the service line details to tables it_servicelines and it_servicelines_up. The servicelines details I get using BAPI_ALM_ORDER_GET_DETAIL.

A snipet from my code:

CONCATENATE l_aufnr l_vornr INTO l_objectkey.

CLEAR: w_methods.

w_methods-refnumber = l_refnumber.

w_methods-objecttype = c_serviceline.

w_methods-method = c_change.

w_methods-objectkey = l_objectkey.

APPEND w_methods TO t_methods.

CLEAR: w_servicelines.

w_servicelines-activity = w_servicos_upd-vornr.

w_servicelines-outline = w_servicos_upd-outline.

w_servicelines-srv_line = w_servicos_upd-srv_line.

w_servicelines-gross_price = w_servicos_upd-netwr.

APPEND w_servicelines TO t_servicelines.

CLEAR: w_servicelines_up.

w_servicelines_up-activity = w_servicos_upd-vornr.

w_servicelines_up-outline = w_servicos_upd-outline.

w_servicelines_up-srv_line = w_servicos_upd-srv_line.

w_servicelines_up-gross_price = c_x.

APPEND w_servicelines_up TO t_servicelines_up.

It works fine when the operation have just ONE service line.

But when the operation HAVE more than one service line (not necessarily updating more than one service) I get the message E SRV 007 "The field PRICE_UNIT is customised as Hidden mode".

DEBUGGING:

The error is triggered in method CL_SERVICE_LINE_MMSRV=>CHECK_FIELD_SELECTION (the field is really customized as Hidden mode). OK.

But the problem is:

Im method CL_SERVICE_LINE_MMSRV=>SET_SERVICE_LINE I've found a problem. Trying to update the first row of two in operation:

The internal tables imt_service_line and imt_service_linex holds the data from tables it_servicelines and it_servicelines_up. OK.

It iterates this method for each serviceline in operation.

In the first row, it's OK. In imt_service_linex only the field GROSS_PRICE is marked with 'X'. The CL_SERVICE_LINE_MMSRV=>CHECK_FIELD_SELECTION is OK.

In second row, several fields are marked with 'X'. But I didn't filled the table it_servicelines_up for the second serviceline. When came to CL_SERVICE_LINE_MMSRV=>CHECK_FIELD_SELECTION it returns the error.

Can it be a bug or limitation in the BAPI?

My code is like this example:

http://saptuts.com/abap-function-module-example/example-program-how-to-update-price-in-pm-order-oper...

I've already came to this thread, and others.

https://archive.sap.com/discussions/thread/3241240

https://apps.support.sap.com/sap/support/knowledge/preview/en/2524622

5 REPLIES 5

JL23
Active Contributor
0 Kudos

What does " I came across https://apps.support.sap.com/sap/support/knowledge/preview/en/2524622 mean?

This is a preview and not the full KBA. It even wants you to read other OSS notes. Did you log on to the launchpad and read the solution, did you do what was said in the solution?

Have you at all tried to do what you want to do by BAPI with the normal transaction manually? Did you not get the SRV007 error in the normal transaction? Based on this info the next steps could be decided, whether you have to look at your own coding or into SAP Customizing and programs.


0 Kudos

Hi, I did read the note 2524622. Change the customizing is not an option. And like I said. for the second row, many fields came market with "X" to update.

Cause

  • The field COST_ELEMENT is set as hidden in customizing for MM services.
  • Additionally, corrective Note may not be applied.

Resolution

  1. If Note 2108786 is not applied (and is valid for your version), apply the correction.
  2. Enter transaction SPRO (or OLMSRV to skip to pt.3)
  3. Select Materials Management.
  4. Select External Services Management.
  5. Select Define Screen Layout.
  6. Double click on the field selection: Row 8 - Operation.
  7. Double Click on Entry sheet.
  8. Locate the field 'Internal entry sheet number'.
  9. Change field to Optional.

Like I said. It works fine for a single service line. But only if the operation have only one serviceline.

In normal transaction - IW32 - It works normal.
In earlier versions, in BAPI documentation tells that "Servicelines can't be updated". But not in my version.

0 Kudos

It works in IW32 fine, just not in BAPI_ALM_ORDER_MAINTAIN.

joao_loureiro
Discoverer

Any help or idea for this?

0 Kudos

Did anyone come across this as well? Can someone look into this please? I'm running into the issue of Deleting a Service Line using BAPI_ALM_ORDER_MAINTAIN and it doesn't work for more than one service per operation.