Skip to Content
0
Former Member
Nov 01, 2006 at 05:36 PM

PM Suborder with BAPI "BAPI_ALM_ORDER_MAINTAIN"

1487 Views

Hallo,

I'm trying to create a PM suborder (IW36) with the BAPI "BAPI_ALM_ORDER_MAINTAIN". My problem is that the BAPI is not doing what I want. What I get is a normal PM order and not a suborder.

I attached the source code I used below. I implemented the BADI "IBAPI_ALM_ORD_MODIFY", too. There the both field values from table lt_extension are assigned to the corresponding fields of structure "CAUFVD".

My questions:

Is it possible to create a suborder with this BAPI?

Which parameters do I have to supply?

Thanks a lot for your help in advance

Hubert

The ABAP source code I used

lw_method-refnumber = '000001'.

lw_method-objecttype = 'HEADER'. "#EC NOTEXT

lw_method-method = 'CREATE'. "#EC NOTEXT

lw_method-objectkey = '%00000000001'.

APPEND lw_method TO lt_methods.

lw_method-objecttype = 'OPERATION'. "#EC NOTEXT

CONCATENATE '%00000000001'

gc_operation_number

INTO lw_method-objectkey.

APPEND lw_method TO lt_methods.

lw_method-objecttype = 'TEXT'. "#EC NOTEXT

CONCATENATE '%00000000001'

gc_operation_number

INTO lw_method-objectkey.

APPEND lw_method TO lt_methods.

lw_method-objecttype = 'USERSTATUS'. "#EC NOTEXT

CONCATENATE '%00000000001'

gc_operation_number

INTO lw_method-objectkey.

APPEND lw_method TO lt_methods.

lw_method-objecttype = space.

lw_method-method = 'SAVE'. "#EC NOTEXT

APPEND lw_method TO lt_methods.

  • Order

lw_header-orderid = '%00000000001'.

lw_header-order_type = gc_auart_suborder.

lw_header-priority = object_tab-priok.

lw_header-planplant = object_tab-iwerk.

lw_header-plangroup = object_tab-ingpr.

lw_header-short_text = object_tab-ltxa1.

lw_header-estimated_costs = object_tab-usr07 * 10.

lw_header-currency = object_tab-use07.

lw_header-mn_wk_ctr = object_tab-v_arbpl.

lw_header-plant = object_tab-v_werks.

lw_header-start_date = object_tab-fsavd.

lw_header-finish_date = object_tab-fsedd.

  • lw_header-maintplant = object_tab-swerk.

  • lw_header-pmacttype = object_tab-ilart.

APPEND lw_header TO lt_header.

  • Operation of the Order

lw_operation-activity = gc_operation_number.

lw_operation-control_key = object_tab-steus.

lw_operation-work_cntr = object_tab-v_arbpl.

lw_operation-plant = object_tab-v_werks.

lw_operation-langu = syst-langu.

lw_operation-description = object_tab-ltxa1.

lw_operation-unload_pt = object_tab-ablad.

lw_operation-field_key = gc_slwid_pm.

lw_operation-usr00 = object_tab-usr00.

lw_operation-usr01 = object_tab-usr01.

lw_operation-usr02 = object_tab-usr02.

lw_operation-usr03 = object_tab-usr03.

lw_operation-usr10 = object_tab-usr10.

lw_operation-usr11 = object_tab-usr11.

APPEND lw_operation TO lt_operation.

  • Long Text: SubOrder

lw_text-orderid = '%00000000001'.

lw_text-langu = syst-langu.

lw_text-textstart = '00000001'.

IF object_tab-indtx = gc_true.

  • code to get long text and put it into table lt_tlines

...

ELSE. " no long text

lw_tline-tdformat = space.

lw_tline-tdline = object_tab-ltxa1.

APPEND lw_tline TO lt_tlines.

lw_text-textend = '00000001'.

ENDIF. " object_tab-indtx = gc_true

APPEND lw_text TO lt_text.

  • User Status of the new SubOrder

lw_userstatus-langu = syst-langu.

lw_userstatus-change_event = '02'.

  • tj30t: Texts for User Status

SELECT SINGLE txt04

INTO l_txt04

FROM tj30t

WHERE stsma = g_stsma_order

AND estat = 'E0010' " Order initialized

AND spras = syst-langu.

IF syst-subrc = 0.

lw_userstatus-user_st_text = l_txt04.

ELSE. " error SELECT SINGLE tj30t

lw_userstatus-user_st_text = 'INI'.

ENDIF. " syst-subrc SELECT SINGLE tj30t

APPEND lw_userstatus TO lt_userstatus.

  • Extension, hier the superior order number is transfered

lw_extension-structure = 'CAUFVD'. "#EC NOTEXT

lw_extension-valuepart1 = object_tab-aufnr.

lw_extension-valuepart2 = object_tab-lead_aufnr.

APPEND lw_extension TO lt_extension.

  • Process Maintenance-/Service Order

CALL FUNCTION 'BAPI_ALM_ORDER_MAINTAIN'

TABLES

it_methods = lt_methods

it_header = lt_header

  • IT_HEADER_UP = lT_HEADER_UP

  • IT_HEADER_SRV =

  • IT_HEADER_SRV_UP =

it_userstatus = lt_userstatus

  • IT_PARTNER =

  • IT_PARTNER_UP =

it_operation = lt_operation

  • it_operation_up = lt_operation_up

  • IT_RELATION =

  • IT_RELATION_UP =

  • IT_COMPONENT =

  • IT_COMPONENT_UP =

  • IT_OBJECTLIST =

  • IT_OBJECTLIST_UP =

  • IT_OLIST_RELATION =

it_text = lt_text

it_text_lines = lt_tlines

  • IT_SRULE =

  • IT_SRULE_UP =

  • IT_TASKLISTS =

extension_in = lt_extension

return = lt_return

et_numbers = lt_numbers.