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

CALL FUNCTION 'Z_CHECK_EXIT' ?

Former Member
0 Likes
588

How can I use CALL FUNCTION 'Z_CHECK_EXIT' for checking two conditions :

1) The enhancement is to be triggered while creation(va01)/change(va02) of sales orders for Africa fleet card sales only.So check whether va01 or va02.

2) Check whether the sales order type is one from ZSDS,ZSDR,ZSCD and ZSCR.

Source code for the function module:

FUNCTION Z_CHECK_EXIT.

*"----


""Local interface:

*" IMPORTING

*" REFERENCE(USEREXIT) TYPE CHAR10

*" REFERENCE(CK1) TYPE CHAR10

*" REFERENCE(CK2) TYPE CHAR10 OPTIONAL

*" REFERENCE(CK3) TYPE CHAR10 OPTIONAL

*" REFERENCE(CK4) TYPE CHAR10 OPTIONAL

*" REFERENCE(CK5) TYPE CHAR10 OPTIONAL

*" EXPORTING

*" REFERENCE(EXECUTE) TYPE CHAR1

*" TABLES

*" I_ZA01 STRUCTURE ZA01

*"----


  • Initialize:

CLEAR: EXECUTE.

REFRESH: I_ZA01.

CLEAR: ZA01, I_ZA01.

  • Null userexit value results in non-execution of user exit.

IF NOT USEREXIT IS INITIAL.

  • start of performance enhancement (BRBU 6/20/02)

describe table xza01 lines i_lines.

if I_lines = 0.

select * from za01 into table xza01.

endif.

read table xza01 with key ZZUSEREXIT = USEREXIT

CK1 = CK1

CK2 = CK2

CK3 = CK3

CK4 = CK4

CK5 = CK5.

  • SELECT SINGLE * FROM ZA01 WHERE ZZUSEREXIT = USEREXIT AND

  • CK1 = CK1 AND

  • CK2 = CK2 AND

  • CK3 = CK3 AND

  • CK4 = CK4 AND

  • CK5 = CK5.

  • end of performance enhancement (BRBU 6/20/02)

IF SY-SUBRC EQ 0.

  • Determine if execution restricted to a single userid

IF xzA01-UNAME IS INITIAL OR xZA01-UNAME = SYST-UNAME.

EXECUTE = 'X'.

I_ZA01 = xZA01.

APPEND I_ZA01.

ENDIF.

ENDIF.

ENDIF.

ENDFUNCTION

.

and This is the way it is called in the program:

CALL FUNCTION 'Z_CHECK_EXIT'

EXPORTING

USEREXIT = 'EFNDTAXWAR'

CK1 = ' '

CK2 =

CK3 =

CK4 =

CK5 =

IMPORTING

EXECUTE = EXECUTE

TABLES

I_ZA01 = I_ZA01 .

1 REPLY 1
Read only

Former Member
0 Likes
499

Hi,

I guess your calling this exit FM from an include program. Based on the conditions required you set an memory 'ID' using EXPORT <SY-TCODE-ORDER TYPE> TO MEMORY ID <XXX>. Inside the FM you use the IMPORT <SY-TCODE-ORDER TYPE> FROM MEMORY ID <XXX>. Check for the VA01/VA02 and order type in <SY-TCODE-ORDER TYPE> and go ahead.

-Amarjit Singh