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

FM POSTING_INTERFACE_CLEARING can't execute in background task.

Former Member
0 Likes
2,587

Hi,

    I have create ZFM of POSTING_INTERFACE_CLEARING which is remote enabled,

    bt still can't execute in background task when call this ZFM in report.....plz help me out.....

18 REPLIES 18
Read only

former_member191569
Active Participant
0 Likes
2,291

Hello Tiya,

what is the error are you receiving? Could you build the Z-RFC correctly?

Read only

0 Likes
2,291

When I call this ZFM in background it couldn't work...and no error msg I received.

Read only

0 Likes
2,291

Hi Tiya

In order to receive results from it there is a way to receive results.

Create gloable variable GV_FLAG

Call your ZFM in background task

PERFORMING get_result ON END OF TASK.

Wait until gv_flag = 'X'.

Create a subroutine GET_RESULT

FORM GET_RESULT USING TASKNAME.

  RECEIVE RESULTS FROM FUNCTION  ZFM

      IMPORTING  abcd

     gv_flag = 'X'.

ENDFORM.

Read only

0 Likes
2,291

Hello Mr. Madan,

   

 

  I call ZFM in this way bt it dosen't work...

  CALL FUNCTION 'ZPOSTING_INTERFACE_CLEARING' IN BACKGROUND TASK AS SEPARATE UNIT DESTINATION NONE

  EXPORTING
    I_AUGLV                          = 'UMBUCHNG'
    I_TCODE                          = 'FB05'
    I_SGFUNCT                        = 'C'
    I_NO_AUTH                        = ' '
IMPORTING
*   E_MSGID                          =
*   E_MSGNO                          =
   E_MSGTY                          = V_MSGTY
   E_MSGV1                          = V_MSGV1
   E_MSGV2                          = V_MSGV2
   E_MSGV3                          = V_MSGV3
   E_MSGV4                          = V_MSGV4
*   E_SUBRC                          =
  TABLES
    T_BLNTAB                         = I_BLNTAB
    T_FTCLEAR                        = I_FTCLEAR
    T_FTPOST                         = I_FTPOST
    T_FTTAX                          = I_FTTAX
EXCEPTIONS
   CLEARING_PROCEDURE_INVALID       = 1
   CLEARING_PROCEDURE_MISSING       = 2
   TABLE_T041A_EMPTY                = 3
   TRANSACTION_CODE_INVALID         = 4
   AMOUNT_FORMAT_ERROR              = 5
   TOO_MANY_LINE_ITEMS              = 6
   COMPANY_CODE_INVALID             = 7
   SCREEN_NOT_FOUND                 = 8
   NO_AUTHORIZATION                 = 9
   OTHERS                           = 10
          .
IF SY-SUBRC <> 0.
  COMMIT WORK.
* Implement suitable error handling here
ENDIF.

Read only

0 Likes
2,291

Do like this

add your commit work in Z function module

  CALL FUNCTION 'ZPOSTING_INTERFACE_CLEARING' IN BACKGROUND TASK AS SEPARATE UNIT DESTINATION NONE
PERFORMING get_result ON END OF TASK

  EXPORTING
    I_AUGLV                          = 'UMBUCHNG'
    I_TCODE                          = 'FB05'
    I_SGFUNCT                        = 'C'
    I_NO_AUTH                        = ' '
IMPORTING
*   E_MSGID                          =
*   E_MSGNO                          =
   E_MSGTY                          = V_MSGTY
   E_MSGV1                          = V_MSGV1
   E_MSGV2                          = V_MSGV2
   E_MSGV3                          = V_MSGV3
   E_MSGV4                          = V_MSGV4
*   E_SUBRC                          =
  TABLES
    T_BLNTAB                         = I_BLNTAB
    T_FTCLEAR                        = I_FTCLEAR
    T_FTPOST                         = I_FTPOST
    T_FTTAX                          = I_FTTAX
EXCEPTIONS
   CLEARING_PROCEDURE_INVALID       = 1
   CLEARING_PROCEDURE_MISSING       = 2
   TABLE_T041A_EMPTY                = 3
   TRANSACTION_CODE_INVALID         = 4
   AMOUNT_FORMAT_ERROR              = 5
   TOO_MANY_LINE_ITEMS              = 6
   COMPANY_CODE_INVALID             = 7
   SCREEN_NOT_FOUND                 = 8
   NO_AUTHORIZATION                 = 9
   OTHERS                           = 10
          .

Wait until gv_flag = 'X'.


FORM GET_RESULT USING TASKNAME.


  RECEIVE RESULTS FROM FUNCTION  ZPOSTING_INTERFACE_CLEARING
IMPORTING
*   E_MSGID                          =
*   E_MSGNO                          =
   E_MSGTY                          = V_MSGTY
   E_MSGV1                          = V_MSGV1
   E_MSGV2                          = V_MSGV2
   E_MSGV3                          = V_MSGV3
   E_MSGV4                          = V_MSGV4

     gv_flag = 'X'.

ENDFORM.

Read only

0 Likes
2,291

Hello Mr. Madan,

   

Syntax error message raised in

CALL FUNCTION 'ZPOSTING_INTERFACE_CLEARING' IN BACKGROUND TASK AS SEPARATE UNIT DESTINATION NONE

PERFORMING get_result ON END OF TASK

Read only

0 Likes
2,291

My mistake..here is the correct syntax

 

DATA

gv_flag TYPE c.

CALL FUNCTION 'ZPOSTING_INTERFACE_CLEARING' STARTING NEW TASK 'T1'
DESTINATION
'NONE'
PERFORMING get_result
ON END OF TASK
EXPORTING
i_auglv =
'UMBUCHNG'
i_tcode =
'FB05'
i_sgfunct =
'C'
i_no_auth =
' '
TABLES
T_BLNTAB = I_BLNTAB
T_FTCLEAR = I_FTCLEAR
T_FTPOST = I_FTPOST
T_FTTAX = I_FTTAX
EXCEPTIONS
clearing_procedure_invalid =
1
clearing_procedure_missing =
2
table_t041a_empty =
3
transaction_code_invalid =
4
amount_format_error =
5
too_many_line_items =
6
company_code_invalid =
7
screen_not_found =
8
no_authorization =
9
OTHERS = 10.
WAIT UNTIL gv_flag = 'X'.

 

FORM

get_result USING taskname.


RECEIVE RESULTS FROM FUNCTION 'zposting_interface_clearing'.
IMPORTING
E_MSGID =
E_MSGNO =
E_MSGTY = V_MSGTY
E_MSGV1 = V_MSGV1
E_MSGV2 = V_MSGV2
E_MSGV3 = V_MSGV3
E_MSGV4 = V_MSGV4

gv_flag =
'X'.

ENDFORM.

"GET_RESULT

Read only

0 Likes
2,291

Ya it work in foreground bt i want to execute it in backgound.

Read only

0 Likes
2,291

Any specifc reason for background?

Read only

0 Likes
2,291

Ya this is the requirement of the report.

Read only

0 Likes
2,291

It is started as new task under new LUW in parallel.

Read only

0 Likes
2,291

Then you can simply use BACKGROUND task but there is no importing/changing parameters allowed in that case. Please read SAP help for pros and cons of the BACKGROUND task. If you are least bother about importing/changing then you can simply put a commit work after the call of function in background task and it will get executed

Nabheet

Read only

0 Likes
2,291

Ya I use so many times bt it can't work.

Read only

Former Member
0 Likes
2,291

Hi Tiya,

Check again whether it is remotely enabled or not?

or you can go for foreground task.

Read only

0 Likes
2,291

Hi Irish,

            I again go through ZFM,it is remote enabled.....

Read only

0 Likes
2,291

It cant work means it does not return you document number..?

Read only

0 Likes
2,291

Ya u r correct it can't receive any value in

IMPORTING

*   E_MSGID                          =

*   E_MSGNO                          =

   E_MSGTY                          = V_MSGTY

   E_MSGV1                          = V_MSGV1

   E_MSGV2                          = V_MSGV2

   E_MSGV3                          = V_MSGV3

   E_MSGV4                          = V_MSGV4

*   E_SUBRC                          =

Read only

0 Likes
2,291

Yes that is the way this calling function in background task works..you can use the other syntax...to achiveve the results

Nabheet