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

'Missing parameter with PERFORM' error with a function IN BACKGROUND TASK

Former Member
0 Likes
3,058

I am getting this error when calling a custom function in MIGO user exit ZXMBCU01. When I remove the 'IN BACKGROUND TASK' the function works fine and there are no error messages. When using 'IN BACK...' you can't debug within it to see where the message comes from. I see the message with SM58. I am working in an sap 4.7 environment. I have not found any solutions from google searches.

Here is the statement within ZXMBCU01:

CALL FUNCTION 'Z_UPDATE_MATERIAL_AVAIL_STATUS' IN BACKGROUND TASK

EXPORTING

work_order = xmseg-aufnr.

Here is the code for the function:

FUNCTION Z_UPDATE_MATERIAL_AVAIL_STATUS.

*"----


""Update function module:

*"

""Local interface:

*" IMPORTING

*" VALUE(WORK_ORDER) LIKE AUFK-AUFNR DEFAULT '0000000000'

*"----


TABLES: eban, resb, aufk.

-Global Types----


TYPES: BEGIN OF t_data,

rsnum TYPE resb-rsnum,

rspos TYPE resb-rspos,

aufnr TYPE resb-aufnr, "Order Number

bdmng TYPE resb-bdmng, "Requirement Quantity

enmng TYPE resb-enmng, "Quantity withdrawn

bsmng TYPE eban-bsmng, "Quantity ordered against this purchase requisition

END OF t_data.

DATA: gt_data TYPE t_data OCCURS 0,

ga_data TYPE t_data.

-Global Variables----


DATA: gv_refused TYPE BAPIFLAG-BAPIFLAG,

gs_caufvd TYPE caufvd,

g_text TYPE t100-text,

gv_objnr LIKE aufk-objnr,

gv_status LIKE bsvx-sttxt,

gv_trig_stat TYPE c.

  • TABLES RETURNED FROM BAPI

DATA: BEGIN OF xreturn OCCURS 0.

INCLUDE STRUCTURE bapiret2.

DATA: END OF xreturn.

SELECT SINGLE objnr FROM aufk

INTO gv_objnr

WHERE aufnr = work_order.

CALL FUNCTION 'STATUS_TEXT_EDIT'

EXPORTING

flg_user_stat = 'X'

objnr = gv_objnr

only_active = 'X'

spras = sy-langu

IMPORTING

line = gv_status.

IF ( gv_status CS 'REL' ) AND

( gv_status NS 'NMAT' AND gv_status NS 'CNF' AND gv_status NS 'CLSD' AND

gv_status NS 'TECO' AND gv_status NS 'DLFL' ).

SELECT SINGLE *

FROM AUFK

WHERE aufnr = work_order AND

( auart = 'PM01' OR

auart = 'PM02' OR

auart = 'PM03' OR

auart = 'PM99' ).

IF sy-subrc = 0.

SELECT resbrsnum resbrspos resbaufnr resbbdmng resbenmng ebanbsmng

INTO CORRESPONDING FIELDS OF ga_data

FROM resb LEFT JOIN eban

ON resbrsnum = ebanarsnr AND

resbrspos = ebanarsps

WHERE resb~aufnr = work_order AND

resb~bdmng > 0.

  • SELECT rsnum rspos aufnr bdmng enmng

  • INTO CORRESPONDING FIELDS OF ga_data

  • FROM resb

  • WHERE aufnr = work_order

  • AND bdmng > 0.

  • SELECT SINGLE bsmng

  • INTO ga_data-bsmng

  • FROM eban

  • WHERE arsnr = ga_data-rsnum

  • AND arsps = ga_data-rspos.

  • IF sy-subrc <> 0.

  • CLEAR ga_data-bsmng.

  • ENDIF.

IF ga_data-bdmng = ga_data-enmng OR

ga_data-bdmng = ga_data-bsmng.

"update status - but all items must pass

ELSE.

gv_trig_stat = 'N'.

EXIT. "status won't change so get out now

ENDIF.

ENDSELECT.

  • IF ga_data~bdmng > 0.

  • IF ga_data-bdmng = ga_data-enmng OR

  • ga_data-bdmng = ga_data-bsmng.

IF gv_trig_stat <> 'N'.

CALL FUNCTION 'CO_IH_USERSTATUS_SET'

EXPORTING

I_AUFNR = ga_data-aufnr "'000005000263'

I_USR_STAT_INT = 'E0002'

  • I_USR_STAT_EXT =

  • I_SET_INACTIVE =

  • I_BUF_READ =

I_SPRAS = sy-langu

IMPORTING

E_CHNG_REFUSED = gv_refused

E_CAUFVD = gs_caufvd

TABLES

RETURN = xreturn.

LOOP AT xreturn

WHERE type = 'E'.

ENDLOOP.

IF sy-subrc <> 0.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.

RETURN.

ELSE.

READ TABLE xreturn INDEX 1.

CALL FUNCTION 'PI_BP_GET_MESSAGE_TEXT'

EXPORTING

iv_message_id = xreturn-id

iv_message_type = xreturn-type

iv_message_number = xreturn-number

iv_message_v1 = xreturn-message_v1

iv_message_v2 = xreturn-message_v2

iv_message_v3 = xreturn-message_v3

iv_message_v4 = xreturn-message_v4

IMPORTING

ev_message_text = g_text.

ENDIF.

ENDIF.

  • ENDIF.

  • ENDIF.

  • ENDSELECT.

ENDIF.

ENDIF.

ENDFUNCTION.

Does anyone have any ideas? Thank you very much in advance.

Glenn Allen

Software Architect (specializing in SAP)

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,516

Please check if the Function Module has been declared as RFC enabled. Check in the Attributes tab page of the Function Module.

Please let me know how this issue has been resolved.

4 REPLIES 4
Read only

former_member194669
Active Contributor
0 Likes
1,516

Hi,

CALL FUNCTION 'Z_UPDATE_MATERIAL_AVAIL_STATUS' IN BACKGROUND TASK

EXPORTING

work_order = xmseg-aufnr.

Check whether XMSEG-AUFNR is as same type of AUFK-AUFNR?

aRs

Read only

Former Member
0 Likes
1,517

Please check if the Function Module has been declared as RFC enabled. Check in the Attributes tab page of the Function Module.

Please let me know how this issue has been resolved.

Read only

kathryn_mcgallicher
Active Participant
0 Likes
1,516

Hello,

Maybe you also need to include the destination? Here's how we use it:

call function 'Z_CS_WEB_DO_BACKGROUND_MOVEINS'

in background task

destination 'NONE'

tables

pe_premises = i_premises.

And, the function module itself is marked as RFC-enabled as the previous poster suggested.

K---

Read only

0 Likes
1,516

I'd be starting a process of elimination... perhaps start with an "exit." right after

SELECT SINGLE objnr 
  FROM aufk
  INTO gv_objnr
  WHERE aufnr = work_order.
exit.  "leave FM NOW

and if that doesn't crash, work down the code down the code in the function e.g. comment out the BAPI_commit call... and / or build a little test harness report to call the Z function in background task... btw, does the ST22 dump point to anything more specific...?