Application Development and Automation 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: 
Read only

RFC Failure: Processing Repairable Materials: BAPI_ALM_ORDER_MAINTAIN

Former Member
0 Likes
780

Hello,

We are using a Function Module BAPI_ALM_ORDER_MAINTAIN Process Maintenance-/Service Order with in

custom RFC for "Autocreate repair order" and Executes in a separate LUW,

called in the User Exit EXIT_SAPLMBMB_001 (Customer Function Exit in the Case of Updating a Material Document),

in the Function Module MB_POST_DOCUMENT.

We are getting the Short Dump with RFC as Connection Closed no data, where as the Destination is NONE.

And the respective data is locked, while de-bugging no dump is resulted, seems like before getting the connection closed data is passed to the RFC, but here Destination is NONE,

Hello,

We are using a Function Module BAPI_ALM_ORDER_MAINTAIN Process Maintenance-/Service Order with in

custom RFC for "Autocreate repair order" and Executes in a separate LUW,

called in the User Exit EXIT_SAPLMBMB_001 (Customer Function Exit in the Case of Updating a Material Document),

in the Function Module MB_POST_DOCUMENT.

We are getting the Short Dump with RFC as Connection Closed no data, where as the Destination is NONE.

And the respective data is locked, while de-bugging no dump is resulted, seems like before getting the connection closed data is passed to the RFC, but here Destination is NONE,

4 REPLIES 4
Read only

Former Member
0 Likes
681

Could you paste the code where you are getting this dump.

Regards,

Jovito

Read only

0 Likes
681

Hello,

Please find following code.

After the Dump data is locked and Session with the Data is also locked.

Issue is only coming in Quality System, not in Development System, that too when we debug, probably due to time lag, no issues coming in Quality System.

&----


*& Include ZXMBCU01

&----


DATA: lt_mkpf TYPE STANDARD TABLE OF mkpf,

lt_mseg TYPE STANDARD TABLE OF mseg.

lt_mkpf = xmkpf[].

lt_mseg = xmseg[].

  • This program was created Kernel Release 1

  • In this first section we retrieve current release of the implied company code

  • In case not rolled-out yet, release is set to 0

TABLES: zbc_0111cc_rel, t001k, t001w.

DATA: lv_curr_release TYPE zrelease,

lv_bukrs TYPE bukrs,

lv_bwkey TYPE bwkey.

lv_curr_release = '999'.

SELECT SINGLE bwkey FROM t001w INTO lv_bwkey WHERE werks = xmseg-werks.

IF sy-subrc EQ 0.

SELECT SINGLE bukrs FROM t001k INTO lv_bukrs WHERE bwkey = lv_bwkey.

IF sy-subrc EQ 0.

SELECT SINGLE * FROM zbc_0111cc_rel WHERE bukrs = t001k-bukrs.

IF sy-subrc = 0.

lv_curr_release = zbc_0111cc_rel-relno.

ENDIF.

ENDIF.

ENDIF.

  • We then practice with case in order to make use of the correct functionality

CASE lv_curr_release.

WHEN '000'.

  • Do nothing, company code not rolled-out yet

WHEN OTHERS.

***********************************************************************

  • Description: Send mail to PO Requisitioner *

----


CALL FUNCTION 'Z_MM_0191_PO_SEND_MAIL'

EXPORTING

t_mseg = lt_mseg

t_mkpf = lt_mkpf

EXCEPTIONS

doc_not_goods_receipt = 1

mvt_typ_not_valid = 2

reqstner_not_maintained = 3

gr_owner_same_as_req = 4

OTHERS = 5.

IF sy-subrc <> 0.

ENDIF.

----


  • Description: Autocreate repair order *

----


Short Dump is coming at here

  • Execute in a separate LUW

CALL FUNCTION 'Z_PM_0491_REPAIR_ORDER' destination 'NONE' " ++Short Dump is coming at here++

EXPORTING

t_mseg = lt_mseg

t_mkpf = lt_mkpf

EXCEPTIONS

problem = 1.

IF sy-subrc ne 0.

  • Order could not be created

ENDIF.

ENDCASE.

Read only

0 Likes
681

Hello,

Please find the following Code.

function Z_PM_0491_REPAIR_ORDER.

*"----


""Local Interface:

*" IMPORTING

*" VALUE(T_MSEG) TYPE CCRCTT_MSEG

*" VALUE(T_MKPF) TYPE CCRCTT_MKPF

*" EXCEPTIONS

*" PROBLEM

*"----


  • Description: Autocreate repair order *

----


  • Get plant value

loop at t_mseg into lw_mseg.

  • Check if udd is active

refresh lt_dev.

call function 'Z_PM_XXXX_DEV_GET_PARAMETERS'

exporting

i_udd = lc_udd_0491

i_werks = lw_mseg-werks

importing

e_dev = lt_dev

exceptions

not_found = 1

others = 2.

check sy-subrc eq 0 and not lt_dev[] is initial.

  • Only for movement type 261

read table lt_dev into lw_dev index 1.

check lw_mseg-bwart = lw_dev-zzparameter1(3).

  • Check if material is repairable

move lw_mseg-matnr to lv_objek.

call function 'CLAF_CLASSIFICATION_OF_OBJECTS'

EXPORTING

classtype = lc_class_001

object = lv_objek

inherited_char = lc_x

TABLES

t_class = lt_class[]

t_objectdata = lt_value_class[]

EXCEPTIONS

no_classification = 1

no_classtypes = 2

invalid_class_type = 3

OTHERS = 4.

if sy-subrc eq 0.

read table lt_value_class into lw_value with key atnam = lc_ypm_repairable.

if sy-subrc eq 0.

if lw_value-ausp1 eq lc_repairable.

  • Material is repairable -> get PM order data

CALL FUNCTION 'BAPI_ALM_ORDER_GET_DETAIL'

EXPORTING

NUMBER = lw_mseg-aufnr

IMPORTING

ES_HEADER = lw_pheader

TABLES

RETURN = lt_bapiret2.

  • Continue if data read successfully

read table lt_bapiret2 with key type = lc_e.

check sy-subrc ne 0.

  • Refresh all tables

clear: lw_methods, lw_header, lw_operation, lw_component, lw_extension_in.

refresh: lt_methods, lt_header, lt_operation, lt_extension_in, lt_component, lt_return, lt_numbers.

  • Prepare data for suborder creation

  • Append following info in the IT_METHODS

lw_methods-refnumber = 1.

lw_methods-objecttype = 'HEADER'.

lw_methods-method = lc_create.

lw_methods-objectkey = lc_objectkey.

append lw_methods TO lt_methods.

lw_methods-refnumber = 1.

lw_methods-objecttype = 'OPERATION'.

lw_methods-method = lc_create.

lw_methods-objectkey = lc_objectkey.

append lw_methods TO lt_methods.

  • We will create a component

lw_methods-refnumber = 1.

lw_methods-objecttype = 'COMPONENT'.

lw_methods-method = lc_create.

lw_methods-objectkey = lc_objectkey.

append lw_methods TO lt_methods.

*

lw_methods-refnumber = 1.

lw_methods-objecttype = space.

lw_methods-method = lc_save_method.

lw_methods-objectkey = lc_objectkey.

append lw_methods TO lt_methods.

  • Specify header information in IT_HEADER

lw_header-orderid = lc_orderid.

lw_header-order_type = lw_pheader-order_type.

lw_header-planplant = lw_pheader-planplant.

lw_header-mn_wk_ctr = lw_pheader-mn_wk_ctr.

lw_header-plant = lw_pheader-planplant.

lw_header-pmacttype = lc_rev.

lw_header-funct_loc = lw_pheader-funct_loc.

lw_header-equipment = lw_pheader-equipment.

lw_header-priority = lc_3.

lw_header-start_date = sy-datum.

lw_header-finish_date = sy-datum + lc_30.

lw_header-short_text = lw_mseg-matnr.

shift lw_header-short_text left deleting leading lc_0.

concatenate lc_repairof lw_header-short_text into lw_header-short_text separated by space.

lw_header-assembly = lw_mseg-matnr.

append lw_header to lt_header.

  • Update IT_OPERATION

lw_operation-activity = lc_0010.

lw_operation-control_key = lc_ypm1.

lw_operation-plant = lw_pheader-maintplant.

lw_operation-assembly = lw_mseg-matnr.

lw_operation-work_cntr = lw_pheader-mn_wk_ctr.

lw_operation-description = lw_header-short_text.

append lw_operation to lt_operation.

  • Update component in IT_COMPONENT

lw_component-material = lw_mseg-matnr.

lw_component-plant = lw_pheader-maintplant.

lw_component-stge_loc = lw_mseg-lgort.

lw_component-activity = lc_0010.

lw_component-item_cat = lc_l.

lw_component-requirement_quantity = - lw_mseg-menge.

lw_component-requirement_quantity_unit = lw_mseg-meins.

append lw_component to lt_component.

  • Linking to the superior order: will happen in Badi IBAPI_ALM_ORD_MODIFY

lw_extension_in-structure = lc_struc.

lw_extension_in-valuepart1 = lw_mseg-aufnr.

append lw_extension_in to lt_extension_in.

  • Create subordinate order

call function 'BAPI_ALM_ORDER_MAINTAIN'

tables

it_methods = lt_methods

it_header = lt_header

it_operation = lt_operation

extension_in = lt_extension_in

it_component = lt_component

return = lt_return

et_numbers = lt_numbers.

read table lt_return into lw_return with key type = lc_e.

if sy-subrc ne 0.

  • If all went well, commit order creation

clear lw_return.

call function 'BAPI_TRANSACTION_COMMIT'

exporting

wait = 'X'

importing

return = lw_return.

else.

  • Otherwise raise exception

raise problem.

endif.

endif.

endif.

endif.

endloop.

endfunction.

Read only

Former Member
0 Likes
681

Hi ,

Remove the destination keyword and try.

CALL FUNCTION 'Z_PM_0491_REPAIR_ORDER'
EXPORTING
t_mseg = lt_mseg
t_mkpf = lt_mkpf
EXCEPTIONS
problem = 1.