ABAP Function ModuleCreated by Zero Li文档格式.docx

上传人:b****5 文档编号:18143450 上传时间:2022-12-13 格式:DOCX 页数:7 大小:531KB
下载 相关 举报
ABAP Function ModuleCreated by Zero Li文档格式.docx_第1页
第1页 / 共7页
ABAP Function ModuleCreated by Zero Li文档格式.docx_第2页
第2页 / 共7页
ABAP Function ModuleCreated by Zero Li文档格式.docx_第3页
第3页 / 共7页
ABAP Function ModuleCreated by Zero Li文档格式.docx_第4页
第4页 / 共7页
ABAP Function ModuleCreated by Zero Li文档格式.docx_第5页
第5页 / 共7页
点击查看更多>>
下载资源
资源描述

ABAP Function ModuleCreated by Zero Li文档格式.docx

《ABAP Function ModuleCreated by Zero Li文档格式.docx》由会员分享,可在线阅读,更多相关《ABAP Function ModuleCreated by Zero Li文档格式.docx(7页珍藏版)》请在冰豆网上搜索。

ABAP Function ModuleCreated by Zero Li文档格式.docx

InTcodeSE37,youcanseeaimporttab(theparametersneededtopassintothefunctionmodule)here,iftheOptionisselected,theparameterisnotrequired,ifthePassValueisselected,theparameterispassedbyvaluebutnotpassedbyreference.

在TcodeSE37,这里import是传入参数,Option如果打扣,就是可选的(不是必须),PassValue如果打扣,就是值传递(不是引用传递,这个概念基本编程语言都有,如果不懂上网查下)

TheparametersintheExporttabisparametersthefunctionreturnvalueafterprocess.

Exporttab里的参数是Function运行后的传出参数

YoucanputtheexportorimportparametersinChangingtab,usuallyyoucanputaparameterwhichwillbemodifiedinthefunction

你可以把那传入或传出的参数放在Changing这里,通常我会把那些在Function里改变的变量放这里

Inthetabletab,thetableneededtobeimportorexportcanbeputhere.WiththeLIKEkeyword,thetableisdifinedwithheadline

在Table这里,当然就是Table了,可以是传出的或传入的,用LIKE一个结构体来定义一个有Headline的Function

Youcanmaintaintheexceptionafterthefunction.Afterthecalling,theSY-SUBRCwillbesettotheexceptionnumber,isTextIDinvalid,SY-SUBRCwillbesetto1,ifInvalidlanguage,SY-SUBRCwillbesetto2,etc.Ifthereisnoexception,SY-SUBRCwillbe0.

你可以把Exception维护在这里,当完成Callfunction后,系统变量SY-SUBRC会设成Exception的值,如果ID无效,SY-SUBRC会设成1,如果语言无效,SY-SUBRC会设成2,如此类推。

如果没异常,则SY-SUBRC会是0.

Thecodebelowcallthefunctionmodule'

READ_TEXT'

togetthelongtextofthematerial

以下的代码可以拿到这个物料的长文本

Buttotheprogramtheparametersisexportedintothefunction(importinSE37),whenfinishingcallingtheprogramwillimporttheparametersfromthefunctionmodule.

在程中,程序把参数传出给FM,当调用FM后,程序引进FM的结果,这里是和SE37那里相对的。

DATA:

lt_tline 

TYPE 

STANDARD 

TABLE 

OF 

tline,

lw_tline 

tline.

CALL 

FUNCTION 

'

EXPORTING

CLIENT 

SY-MANDT

id 

GRUN'

language 

E'

name 

1500-600'

object 

MATERIAL'

ARCHIVE_HANDLE 

LOCAL_CAT 

IMPORTING

HEADER 

=

TABLES

lines 

lt_tline

EXCEPTIONS

1

2

3

not_found 

4

5

reference_check 

6

wrong_access_to_archive 

7

OTHERS 

8

.

IF 

sy-subrc 

<

>

0.

MESSAGE 

ID 

SY-MSGID 

SY-MSGTY 

NUMBER 

SY-MSGNO

WITH 

SY-MSGV1 

SY-MSGV2 

SY-MSGV3 

SY-MSGV4.

ELSE.

LOOP 

AT 

INTO 

lw_tline.

WRITE:

lw_tline-tdline.

ENDLOOP.

ENDIF.

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高等教育 > 艺术

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1