注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

原来为了你

我的人生就是要一次次的超越

 
 
 

日志

 
 
 
 

Call Function - starting new task  

2011-09-22 17:24:27|  分类: ABAP基础知识 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

The STARTING NEW TASK statement allows you to call a function module but it will be executed in a separate processing task asynchronously so the ABAP program logic does not wait for this FM to finish its processing but continues with the next line of abap code. The clever thing about this statement is that once the FM has finished processing it will then execute the specified FORM within the original program to continue processing.

This small example is actually the basis for reports which auto-refresh themselves. i.e. the program calls a function module in a new task which then waits a few seconds (WAIT 10 seconds). Once it returns to the program and performs the return form it basically re-runs the whole report again. This especially creates an endless loop so report keeps updating itself until it is cancelled by the user. < xmlnamespace prefix ="o" ns ="urn:schemas-microsoft-com:office:office" />

Execute FM in update task within separate unit of work 
call function 'Z_FMODULE'
  
starting new task 'UPDATE'
  destination 
'NONE'                          "可以不加,默认是NONE
  performing processing_done 
on end of task   "subroutine也可以不加
  
exporting
    i_p1 
p1.

break
-point"program does not wait for FM to finish processing and continues with next line of ABAP code

"perform display_report.

*&---------------------------------------------------------------------*
*&      Form  processing_done
*&---------------------------------------------------------------------*
form processing_done.
* In the mean time once processing of FM Z_FMODULE is complete this abap FORM is then executed.You can now perform any processing you like, including re-displaying a report
  
"perform display_report.
endform.                    "processing_done

在主程序中调用Call Function 'XXX',主程序不会等待Function的执行完成才继续。它们会并行执行,有必要的时候可以在主程序或Function中加wait up to N seconds.

  评论这张
 
阅读(971)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017