Function Modules

Function Modules

Ex1 on function module with importing,exporting and exceptions
Business Req: Create a FMOD by name zget_cust_details to fetch customer details
STEP1: Create a FM in SE37
  • Go to SE37
  • Give a FM Name: ZGET_CUST_DET
  • Create
  • Provide Function Group name and Desc
  • Click on SAVE, Press Enter
  • Provide the importing parameter as below
 And exporting parameter as below
 And the exception as below


Write the below code :
  • Save->Act.  
  • Test with a valid custno  
  • Test with a invalid custno
  • Test without a custno
STEP2 : Now call the function module in main program
  • Click on ‘pattern’ button  
  • Provide the function module name and press enter   
  • The code will be automatically generated
  • Modify the code as below


  • Save->Act.
  • Test with a valid custno
  • Test with a invalid custno
  • Test without a custno

Ex2 on function module with TABLES Option
Business Req: Create a FMOD by name zget_cust_List to fetch List of customer details for a given country

STEP1: Create a FM in SE37
  • Go to SE37
  • Give a FM Name: ZGET_CUST_LIST
  • Create
  • Provide Function Group name and Desc
  • Click on SAVE, Press Enter
  • Provide the importing parameter as below



Provide the Int.table under TABLES as below

Write the below source Code

Save->act->test

STEP2 : Now call the function module in main program
  • Click on ‘pattern’ button
  • Provide the function module name and press enter
  • The code will be automatically generated
  • Modify the code as below

Save->act->test
Ex3 on function module with CHANGING Option
Business Req: Create a FMOD by name zget_cust_List to fetch List of customer details for a given country

STEP1: Create a FM in SE37
  • Go to SE37
  • Give a FM Name: ZCHANGING
  • Create
  • Provide Function Group name and Desc
  • Click on SAVE, Press Enter
  • Provide a changing work area as below




Write the below code

Save->act->test

STEP2 : Now call the function module in main program
  • Click on ‘pattern’ button
  • Provide the function module name and press enter
  • The code will be automatically generated
  • Modify the code as below


Save->act->test
Previous
Next Post »