TWI459295B - System and method for dynamically calling function modules - Google Patents

System and method for dynamically calling function modules Download PDF

Info

Publication number
TWI459295B
TWI459295B TW097132135A TW97132135A TWI459295B TW I459295 B TWI459295 B TW I459295B TW 097132135 A TW097132135 A TW 097132135A TW 97132135 A TW97132135 A TW 97132135A TW I459295 B TWI459295 B TW I459295B
Authority
TW
Taiwan
Prior art keywords
function module
variable
code
parameter
called
Prior art date
Application number
TW097132135A
Other languages
Chinese (zh)
Other versions
TW201009711A (en
Inventor
Chang-Gen Fang
Feng Liu
Bo Liu
Original Assignee
Hon Hai Prec Ind Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hon Hai Prec Ind Co Ltd filed Critical Hon Hai Prec Ind Co Ltd
Priority to TW097132135A priority Critical patent/TWI459295B/en
Publication of TW201009711A publication Critical patent/TW201009711A/en
Application granted granted Critical
Publication of TWI459295B publication Critical patent/TWI459295B/en

Links

Landscapes

  • Stored Programmes (AREA)
  • Executing Machine-Instructions (AREA)

Description

動態調用功能模組的系統及方法 System and method for dynamically calling function modules

本發明涉及一種程式設計系統及方法,尤其關於一種動態調用功能模組的系統及方法。 The present invention relates to a programming system and method, and more particularly to a system and method for dynamically invoking a functional module.

在SAP系統中,功能模組數目龐大、功能強大,所有的系統操作基本上都可以透過調用功能模組來實現。一般情況下,調用功能模組之前必須知道該功能模組的參數的數量、類型和結構,調用時正確地匹配參數。然而,在某些特定的系統需求中,在設計編程的時候並不知道所要調用的功能模組,只有在運行的時候才能確切知道所要調用的功能模組。功能模組的不確定導致了其參數數量、類型和結構的不確定,給功能模組的調用帶來了極大的困難。 In the SAP system, the number of function modules is large and powerful, and all system operations can basically be realized by calling function modules. In general, before calling a function module, you must know the number, type, and structure of the parameters of the function module, and match the parameters correctly when called. However, in some specific system requirements, the function module to be called is not known at the time of design programming, and the function module to be called can be known only when running. The uncertainty of the function module leads to the uncertainty of the number, type and structure of its parameters, which brings great difficulties to the call of the function module.

鑒於以上內容,有必要提供一種動態調用功能模組的系統及方法。 In view of the above, it is necessary to provide a system and method for dynamically calling a function module.

一種動態調用功能模組的系統,該系統包括:變數定義代碼生成模組,用於根據傳入的被調用功能模組資訊,獲得被調用功能模組參數資訊,並生成變數定義代碼,所述變數定義代碼用於定義被調用功能模組參數相對應的變數,所述變數包括輸入變數和輸 出變數;輸入賦值代碼生成模組,用於根據被調用功能模組資訊,生成輸入賦值代碼,該輸入賦值代碼用於為輸入變數賦值;調用代碼生成模組,用於根據被調用功能模組資訊、被調用功能模組參數資訊及定義的變數,生成功能模組調用代碼;輸出賦值代碼生成模組,用於根據被調用功能模組參數資訊,生成輸出賦值代碼,該輸出賦值代碼用於傳出被調用功能模組藉由輸出變數返回的參數值;及代碼執行模組,用於依次執行生成的變數定義代碼、輸入賦值代碼、功能模組調用代碼及輸出賦值代碼,以完成功能模組的調用。 A system for dynamically calling a function module, the system comprising: a variable definition code generation module, configured to obtain parameter information of a called function module according to information of an incoming function module, and generate a variable definition code, The variable definition code is used to define a variable corresponding to the called function module parameter, the variable including the input variable and the input The input value generating module is configured to generate an input assignment code according to the called function module information, the input assignment code is used to assign an input variable, and the code generation module is used to be used according to the called function module. Information, called function module parameter information and defined variables, generate function module calling code; output assignment code generating module, configured to generate an output assignment code according to the called function module parameter information, the output assignment code is used for Transmitting the parameter value returned by the called function module by outputting the variable; and the code execution module for sequentially executing the generated variable definition code, the input assignment code, the function module calling code, and the output assignment code to complete the function mode Group call.

一種動態調用功能模組的方法,該方法包括步驟:根據傳入的被調用功能模組資訊,獲得被調用功能模組參數資訊,並生成變數定義代碼,所述變數定義代碼用於定義被調用功能模組參數相對應的變數,所述變數包括輸入變數和輸出變數;根據被調用功能模組資訊,生成輸入賦值代碼,該輸入賦值代碼用於為輸入變數賦值;根據被調用功能模組資訊、被調用功能模組參數資訊及定義的變數,生成功能模組調用代碼;根據被調用功能模組參數資訊,生成輸出賦值代碼,該輸出賦值代碼用於傳出被調用功能模組藉由輸出變數返回的參數值;執行變數定義代碼,定義被調用功能模組相對應的變數,所述變數包括輸入變數及輸出變數;執行輸入賦值代碼,為定義的輸入變數賦值;執行功能模組調用代碼,得到被調用功能模組藉由輸出變數返回的參數值;及執行輸出賦值代碼,傳出被調用功能模組藉由輸出變數返回的參數值。 A method for dynamically calling a function module, the method comprising the steps of: obtaining information of a called function module parameter according to an incoming function module information, and generating a variable definition code, wherein the variable definition code is used to define a called a variable corresponding to the function module parameter, the variable includes an input variable and an output variable; and an input assignment code is generated according to the called function module information, the input assignment code is used to assign an input variable; according to the called function module information The function module parameter information and the defined variable are called to generate a function module calling code; according to the called function module parameter information, an output assignment code is generated, and the output assignment code is used for transmitting the called function module by outputting The parameter value returned by the variable; executing a variable definition code defining a variable corresponding to the called function module, the variable including the input variable and the output variable; executing the input assignment code to assign a value to the defined input variable; executing the function module calling code , obtaining the parameter value returned by the called function module by outputting the variable; and Line output assignment code came output variable parameter values returned by the called function module.

本發明實現了各種功能模組的動態調用,有助於系統全局整合架構的實現。 The invention realizes the dynamic invocation of various functional modules, and contributes to the realization of the system global integration architecture.

10‧‧‧動態調用功能模組的系統 10‧‧‧Systems that dynamically call function modules

100‧‧‧變數定義代碼生成模組 100‧‧‧variable definition code generation module

101‧‧‧輸入賦值代碼生成模組 101‧‧‧Input assignment code generation module

102‧‧‧調用代碼生成模組 102‧‧‧call code generation module

103‧‧‧輸出賦值代碼生成模組 103‧‧‧Output assignment code generation module

104‧‧‧代碼執行模組 104‧‧‧ Code Execution Module

S501‧‧‧生成變數定義代碼 S501‧‧‧ Generate variable definition code

S502‧‧‧生成輸入賦值代碼 S502‧‧‧ Generate input assignment code

S503‧‧‧生成功能模組調用代碼 S503‧‧‧ Generate function module calling code

S504‧‧‧生成輸出賦值代碼 S504‧‧‧ Generate output assignment code

S505‧‧‧執行變數定義代碼,定義變數 S505‧‧‧Execute variable definition code, define variables

S506‧‧‧執行輸入賦值代碼,為輸入變數賦值 S506‧‧‧Execute the input assignment code to assign values to the input variables

S507‧‧‧執行功能模組調用代碼,得到返回的參數值 S507‧‧‧ Execute the function module calling code to get the returned parameter value

S508‧‧‧執行輸出賦值代碼,傳出返回的參數值 S508‧‧‧Execute the output assignment code and pass the returned parameter value

圖1係本發明動態調用功能模組的系統的功能模組圖。 1 is a functional block diagram of a system for dynamically calling a function module of the present invention.

圖2係FLIST參數的結構示意圖。 Figure 2 is a schematic diagram of the structure of the FLIST parameter.

圖3係FIMPORT參數的結構示意圖。 Figure 3 is a schematic diagram of the structure of the FIMPORT parameter.

圖4係FTABLES參數的結構示意圖。 Figure 4 is a schematic diagram of the structure of the FTABLES parameter.

圖5係本發明動態調用功能模組的方法流程圖。 FIG. 5 is a flow chart of a method for dynamically calling a function module according to the present invention.

下述實施例以SAP系統為例進行說明。為便於理解,對相關技術作如下解釋。 The following examples are described by taking an SAP system as an example. For ease of understanding, the related art is explained as follows.

功能模組參數類型:功能模組的參數有importing、exporting、changing和tables四種類型,其中,importing參數是單純的輸入參數,exporting參數是單純的輸出參數,changing參數既是輸入又是輸出參數,其值在傳入後能夠被功能模組所修改,tables參數既是輸入又是輸出參數,用來傳遞多行結構相同的資料。 Function module parameter types: The parameters of the function module are four types: importing, exporting, changing, and tables. The importing parameter is a simple input parameter, the exporting parameter is a simple output parameter, and the changing parameter is both an input and an output parameter. Its value can be modified by the function module after being passed in. The tables parameter is both an input and an output parameter, which is used to transfer the same data of multiple rows.

參閱圖2所示,係一個名為FLIST的tables參數,該tables參數有三個欄位,第一個欄位名為SEQNO,第二個欄位名為FNAME,第三個欄位名為FINDIC。tables參數的某一位置可以用行和欄位表示,例如,FLIST的第一行SEQNO欄位值為1,第二行FNAME欄位值為Func2,第三行FINDIC欄位值為S。tables參數的某一位置還可以用行和列表示,例如,FLIST的第一行SEQNO欄位也就是FLIST的第一行第一列。 Referring to Figure 2, there is a table parameter named FLIST. The table parameter has three fields, the first field is named SEQNO, the second field is named FNAME, and the third field is named FINDIC. A certain position of the tables parameter can be represented by rows and fields. For example, the first line of the FLIST has a value of 1 in the SEQNO field, the second line has a FNAME field value of Func2, and the third line has a FINDIC field value of S. A certain position of the tables parameter can also be represented by rows and columns. For example, the first line of the FLIST column is the first column of the first row of the FLIST.

功能模組有五種被調用方式:同步、非同步、事務、佇列和平行 。 There are five ways to call a function module: synchronous, asynchronous, transaction, queue, and parallel. .

包含程式(include programs):包含程式能夠將代碼模組化,並能夠被其他程式所引用,包含程式中的代碼也就是該其他程式的一部分。 Include programs: Include programs that modularize code and can be referenced by other programs, including the code in the program.

參閱圖1所示,係本發明動態調用功能模組的系統10的功能模組圖。該動態調用功能模組的系統10包括變數定義代碼生成模組100、輸入賦值代碼生成模組101、調用代碼生成模組102、輸出賦值代碼生成模組103及代碼執行模組104。 Referring to Figure 1, there is shown a functional block diagram of a system 10 for dynamically invoking a functional module of the present invention. The system 10 of the dynamic call function module includes a variable definition code generation module 100, an input assignment code generation module 101, a call code generation module 102, an output assignment code generation module 103, and a code execution module 104.

所述變數定義代碼生成模組100用於根據從統一介面傳入的被調用功能模組資訊,獲得被調用功能模組參數資訊,並生成變數定義代碼。所述變數定義代碼用於定義被調用功能模組參數相對應的變數,所述變數包括輸入變數和輸出變數。在本實施例中,所述被調用功能模組資訊包括被調用功能模組的名稱、被調用方式及被調用功能模組的參數值。被調用功能模組可以是一個,也可以是多個。例如,被調用功能模組為Func1、Func2和Func3。在本實施例中,所述統一介面包括三個tables參數:FLIST、FIMPORT和FTABLES。FLIST用來傳送被調用功能模組的名稱及被調用方式,參閱圖2所示,其中SEQNO表示被調用功能模組編號,FNAME表示被調用功能模組名稱,FINDIC表示被調用方式。FIMPORT用來傳送被調用功能模組的importing參數、exporting參數和changing參數,參閱圖3所示,其中PARAMTYPE表示參數類型,I和E分別表示importing類型和exporting類型,PARAMNAME表示參數名稱,PARAMVALUE表示參數值。FTABLES用來傳送被調用功能模組的tables參數,參閱圖4所示,其中TBLNAME表示該 tables參數的名稱,TBLROW表示該tables參數的某行,TBLCOL表示該tables參數的某列,FLDNAME表示該tables參數的欄位名,FLDVALUE表示該tables參數某一位置(即某行某列)相對應的數值。參閱圖4所示,本實施例由TBLROW和FLDNAME確定該tables參數的某一位置,TBLCOL取為0。 The variable definition code generating module 100 is configured to obtain the called function module parameter information according to the called function module information transmitted from the unified interface, and generate a variable definition code. The variable definition code is used to define a variable corresponding to the called function module parameter, the variable including an input variable and an output variable. In this embodiment, the called function module information includes the name of the called function module, the called mode, and the parameter value of the called function module. The called function module can be one or more. For example, the called function modules are Func1, Func2, and Func3. In this embodiment, the unified interface includes three tables parameters: FLIST, FIMPORT, and FTABLES. FLIST is used to transfer the name of the called function module and the called mode. See Figure 2, where SEQNO indicates the called function module number, FNAME indicates the called function module name, and FINDIC indicates the called mode. FIMPORT is used to transfer the importing parameter, exporting parameter and changing parameter of the called function module. See Figure 3, where PARAMTYPE indicates the parameter type, I and E respectively represent the importing type and exporting type, PARAMNAME indicates the parameter name, and PARAMVALUE indicates the parameter. value. FTABLES is used to transfer the table parameters of the called function module, as shown in Figure 4, where TBLNAME indicates The name of the tables parameter, TBLROW represents a row of the tables parameter, TBLCOL represents a column of the tables parameter, FLDNAME represents the field name of the tables parameter, and FLDVALUE represents a certain position of the tables parameter (ie, a row of a row) corresponding to The value. Referring to FIG. 4, in this embodiment, a certain position of the tables parameter is determined by TBLROW and FLDNAME, and TBLCOL is taken as 0.

所述變數定義代碼生成模組100根據傳入的被調用功能模組的名稱獲得被調用功能模組參數資訊。例如,在SAP系統中,藉由系統透明表FUPARAREF獲得被調用功能模組參數資訊。所述被調用功能模組參數資訊包括參數的類型、tables參數的結構等。 The variable definition code generation module 100 obtains the called function module parameter information according to the name of the incoming called function module. For example, in the SAP system, the called function module parameter information is obtained by the system transparent table FUPARAREF. The parameter information of the called function module includes the type of the parameter, the structure of the tables parameter, and the like.

所述變數定義代碼生成模組100根據被調用功能模組參數資訊,生成變數定義代碼。所述變數定義代碼為每個被調用功能模組的參數定義一個相同類型的變數。對於tables參數,相對應的tables變數與該tables參數的結構相同。如前所述,importing參數是輸入參數,exporting參數是輸出參數,changing參數和tables參數既是輸入又是輸出參數。為便於說明,將輸入參數對應的變數稱為輸入變數,將輸出參數對應的變數稱為輸出變數,因此,定義的importing變數是輸入變數,定義的exporting變數是輸出變數,定義的changing變數和tables變數既是輸入又是輸出變數。例如,被調用功能模組有兩個importing參數KUNAG和KUNNR,有一個exporting參數BSTKD,有一個tables參數REPAIRITEM,則變數定義代碼定義兩個importing變數L_KUNAG和L_KUNNR,定義一個exporting變數L_BSTKD,定義一個tables變數T_REPAIRITEM,其中,L_KUNAG和L_KUNNR是輸入變數,L_BSTKD是輸出變數,T_REPAIRITEM既是輸入又是輸出變數。 The variable definition code generation module 100 generates a variable definition code according to the called function module parameter information. The variable definition code defines a variable of the same type for each parameter of the called function module. For the tables parameter, the corresponding tables variable has the same structure as the tables parameter. As mentioned earlier, the importing parameter is the input parameter, the exporting parameter is the output parameter, and the changing parameter and the tables parameter are both the input and the output parameter. For convenience of explanation, the variable corresponding to the input parameter is called the input variable, and the variable corresponding to the output parameter is called the output variable. Therefore, the defined import variable is the input variable, the defined exporting variable is the output variable, the defined changing variable and the tables Variables are both input and output variables. For example, the called function module has two importing parameters KUNAG and KUNNR, one exporting parameter BSTKD, and one table parameter REPAIRITEM. The variable definition code defines two importing variables L_KUNAG and L_KUNNR, defines an exporting variable L_BSTKD, defines a table. The variable T_REPAIRITEM, where L_KUNAG and L_KUNNR are input variables, L_BSTKD is an output variable, and T_REPAIRITEM is both an input and an output variable.

在本實施例中,變數定義代碼生成模組100將生成的變數定義代碼寫入包含程式ZINP_FUNC_0001。 In the present embodiment, the variable definition code generation module 100 writes the generated variable definition code into the inclusion program ZINP_FUNC_0001.

所述輸入賦值代碼生成模組101用於根據傳入的被調用功能模組資訊,生成輸入賦值代碼。所述輸入賦值代碼用於根據傳入的被調用功能模組的參數值給相對應的輸入變數賦值。如前所述,假設變數定義代碼用於定義兩個importing變數L_KUNAG和L_KUNNR,定義一個tables變數T_REPAIRITEM,則所述輸入賦值代碼生成模組101根據傳入的被調用功能模組的參數值生成輸入賦值代碼,該輸入賦值代碼分別給L_KUNAG、L_KUNNR及T_REPAIRITEM賦值。在本實施例中,輸入賦值代碼生成模組101將生成的輸入賦值代碼寫入包含程式ZINP_FUNC_0002。 The input assignment code generating module 101 is configured to generate an input assignment code according to the incoming called function module information. The input assignment code is used to assign a value to a corresponding input variable according to a parameter value of the incoming called function module. As described above, assuming that the variable definition code is used to define two importing variables L_KUNAG and L_KUNNR, defining a tables variable T_REPAIRITEM, the input assignment code generating module 101 generates an input based on the parameter values of the incoming called function module. An assignment code that assigns values to L_KUNAG, L_KUNNR, and T_REPAIRITEM, respectively. In the present embodiment, the input assignment code generation module 101 writes the generated input assignment code into the inclusion program ZINP_FUNC_0002.

所述調用代碼生成模組102用於根據被調用功能模組資訊、被調用功能模組參數資訊及變數定義代碼中定義的變數,生成功能模組調用代碼。在本實施例中,根據被調用功能模組名稱和被調用的方式,藉由SAP系統功能模組FUNCTION_STUB_GENERATE生成被調用功能模組的調用代碼模式,再根據獲得的被調用功能模組參數資訊,將相對應的變數填寫為被調用功能模組的實際參數,從而得到可執行的功能模組調用代碼。例如,根據被調用功能模組參數資訊,變數定義代碼定義了兩個importing變數L_KUNAG和L_KUNNR,定義一個exporting變數L_BSTKD,定義一個tables變數T_REPAIRITEW,則把L_KUNAG、L_KUNNR、L_BSTKD和T_REPAIRITEM分別填寫為被調用功能模組相對應的實際參數。在本實施例中,調用代碼生成模組102將生成的功能模組調用代碼寫入包含程式ZINP_FUNC_0003。 The calling code generating module 102 is configured to generate a function module calling code according to the changed function of the called function module information, the called function module parameter information, and the variable definition code. In this embodiment, according to the name of the called function module and the called mode, the calling system code of the called function module is generated by the SAP system function module FUNCTION_STUB_GENERATE, and then according to the obtained parameter information of the called function module, The corresponding variable is filled in as the actual parameter of the called function module, thereby obtaining an executable function module calling code. For example, according to the parameter information of the called function module, the variable definition code defines two importing variables L_KUNAG and L_KUNNR, defines an exporting variable L_BSTKD, defines a tables variable T_REPAIRITEW, and then fills in L_KUNAG, L_KUNNR, L_BSTKD and T_REPAIRITEM respectively. The actual parameters corresponding to the function module. In this embodiment, the calling code generation module 102 writes the generated function module calling code into the containing program ZINP_FUNC_0003.

所述輸出賦值代碼生成模組103用於根據被調用功能模組參數資訊,生成輸出賦值代碼。所述輸出賦值代碼將被調用功能模組藉由輸出變數返回的參數值透過所述統一介面傳出。在本實施例中,將返回的exporting參數值和changing參數值透過統一介面的FIMPORT傳出,將返回的tables參數值透過統一介面的FTABLES傳出。因而,輸出賦值代碼生成模組103生成的輸出賦值代碼將返回的exporting參數值和changing參數值賦值給FIMPORT參數,將返回的tables參數值賦值給FTABLES參數。例如,假設輸出變數包括exporting變數L_BSTKD和tables變數T_REPAIRITEM,則將L_BSTKD賦值給FIMPORT參數,將T_REPAIRITEM賦值給FTABLES參數。在本實施例中,輸出賦值代碼生成模組103將生成的輸出賦值代碼寫入包含程式ZINP_FUNC_0004。 The output assignment code generating module 103 is configured to generate an output assignment code according to the called function module parameter information. The output assignment code is transmitted by the calling function module through the unified interface through the parameter value returned by the output variable. In this embodiment, the returned exporting parameter value and the changing parameter value are transmitted through the FIMPORT of the unified interface, and the returned table parameter value is transmitted through the FTABLES of the unified interface. Therefore, the output assignment code generated by the output assignment code generation module 103 assigns the returned export parameter value and the changing parameter value to the FIMPORT parameter, and assigns the returned table parameter value to the FTABLES parameter. For example, assuming that the output variable includes the exporting variable L_BSTKD and the tables variable T_REPAIRITEM, L_BSTKD is assigned to the FIMPORT parameter, and T_REPAIRITEM is assigned to the FTABLES parameter. In the present embodiment, the output assignment code generation module 103 writes the generated output assignment code to the inclusion program ZINP_FUNC_0004.

所述代碼執行模組104用於依次執行生成的變數定義代碼、輸入賦值代碼、功能模組調用代碼、輸出賦值代碼,以完成功能模組的調用。具體而言,第一步,所述代碼執行模組104執行變數定義代碼生成模組100生成的變數定義代碼,定義被調用功能模組相對應的變數。所述變數包括輸入變數和輸出變數。第二步,所述代碼執行模組104執行輸入賦值代碼生成模組101生成的輸入賦值代碼,為定義的輸入變數賦值。第三步,所述代碼執行模組104執行調用代碼生成模組102生成的功能模組調用代碼,得到該被調用功能模組藉由輸出變數返回的參數值。第四步,所述代碼執行模組104執行輸出賦值代碼生成模組103生成的輸出賦值代碼,將被調用功能模組藉由輸出變數返回的參數值透過所述統一介面傳出。在本實施例中,藉由引用包含程式ZINP_FUNC_0001實現變數定義,藉由引用包含程式ZINP_FUNC_0002實現輸入變數賦值 ,藉由引用包含程式ZINP_FUNC_0003實現功能模組調用,藉由引用包含程式ZINP_FUNC_0004將被調用功能模組藉由輸出變數返回的參數值透過統一介面傳出。 The code execution module 104 is configured to sequentially execute the generated variable definition code, the input assignment code, the function module calling code, and the output assignment code to complete the calling of the function module. Specifically, in the first step, the code execution module 104 executes the variable definition code generated by the variable definition code generation module 100, and defines a variable corresponding to the called function module. The variables include input variables and output variables. In the second step, the code execution module 104 executes the input assignment code generated by the input assignment code generation module 101 to assign a value to the defined input variable. In the third step, the code execution module 104 executes the function module calling code generated by the calling code generation module 102, and obtains the parameter value returned by the called function module by outputting the variable. In the fourth step, the code execution module 104 executes the output assignment code generated by the output assignment code generation module 103, and transmits the parameter value returned by the called function module by the output variable through the unified interface. In this embodiment, the variable definition is implemented by referring to the program ZINP_FUNC_0001, and the input variable assignment is implemented by referring to the inclusion program ZINP_FUNC_0002. The function module call is implemented by referring to the program ZINP_FUNC_0003. By referring to the inclusion program ZINP_FUNC_0004, the parameter value returned by the function module to be called by the output variable is transmitted through the unified interface.

參閱圖5所示,係本發明動態調用功能模組的方法流程圖。 Referring to FIG. 5, it is a flowchart of a method for dynamically calling a function module according to the present invention.

步驟S501,變數定義代碼生成模組100根據從統一介面傳入的被調用功能模組資訊,獲得被調用功能模組參數資訊,並生成變數定義代碼。所述變數定義代碼用於定義被調用功能模組參數相對應的變數,所述變數包括輸入變數和輸出變數。在本實施例中,所述被調用功能模組資訊包括被調用功能模組的名稱、被調用方式及被調用功能模組的參數值。被調用功能模組可以是一個,也可以是多個。例如,被調用功能模組為Func1、Func2和Func3。所述被調用功能模組資訊透過統一介面傳入。在本實施例中,所述統一介面包括三個tables參數:FLIST、FIMPORT和FTABLES。FLIST用來傳送被調用功能模組的名稱及被調用方式,參閱圖2所示,其中SEQNO表示被調用功能模組編號,FNAME表示被調用功能模組名稱,FINDIC表示被調用方式。FIMPORT用來傳送被調用功能模組的importing參數、exporting參數和changing參數,參閱圖3所示,其中PARAMTYPE表示參數類型,I和E分別表示importing類型和exporting類型,PARAMNAME表示參數名稱,PARAMVALUE表示參數值。FTABLES用來傳送被調用功能模組的tables參數,參閱圖4所示,其中TBLNAME表示該tables參數的名稱,TBLROW表示該tables參數的某行,TBLCOL表示該tables參數的某列,FLDNAME表示該tables參數的欄位名,FLDVALUE表示該tables參數某一位置(即某行某列)相對應的數值。參閱圖5所 示,本實施例由TBLROW和FLDNAME確定該tables參數的某一位置,TBLCOL取為0。 In step S501, the variable definition code generation module 100 obtains the called function module parameter information according to the called function module information transmitted from the unified interface, and generates a variable definition code. The variable definition code is used to define a variable corresponding to the called function module parameter, the variable including an input variable and an output variable. In this embodiment, the called function module information includes the name of the called function module, the called mode, and the parameter value of the called function module. The called function module can be one or more. For example, the called function modules are Func1, Func2, and Func3. The called function module information is transmitted through the unified interface. In this embodiment, the unified interface includes three tables parameters: FLIST, FIMPORT, and FTABLES. FLIST is used to transfer the name of the called function module and the called mode. See Figure 2, where SEQNO indicates the called function module number, FNAME indicates the called function module name, and FINDIC indicates the called mode. FIMPORT is used to transfer the importing parameter, exporting parameter and changing parameter of the called function module. See Figure 3, where PARAMTYPE indicates the parameter type, I and E respectively represent the importing type and exporting type, PARAMNAME indicates the parameter name, and PARAMVALUE indicates the parameter. value. FTABLES is used to transfer the table parameters of the called function module. See Figure 4, where TBLNAME indicates the name of the tables parameter, TBLROW indicates a row of the tables parameter, TBLCOL indicates a column of the tables parameter, and FLDNAME indicates the table. The field name of the parameter, FLDVALUE indicates the value corresponding to a certain position of the table parameter (that is, a column of a row). See Figure 5 It is shown that this embodiment determines a certain position of the tables parameter by TBLROW and FLDNAME, and TBLCOL is taken as 0.

具體而言,變數定義代碼生成模組100首先根據傳入的被調用功能模組的名稱獲得被調用功能模組參數資訊。例如,在SAP系統中,藉由系統透明表FUPARAREF獲得被調用功能模組參數資訊。所述被調用功能模組參數資訊包括參數的類型、tables參數的結構等。然後,變數定義代碼生成模組100根據被調用功能模組參數資訊,生成變數定義代碼。所述變數定義代碼為每個被調用功能模組的參數定義一個相同類型的變數。對於tables參數,相對應的tables變數與該tables參數的結構相同。此外,定義的importing變數是輸入變數,定義的exporting變數是輸出變數,定義的changing變數和tables變數既是輸入又是輸出變數。例如,被調用功能模組有兩個importing參數KUNAG和KUNNR,有一個exporting參數BSTKD,有一個tables參數REPAIRITEM,則變數定義代碼定義兩個importing變數L_KUNAG和L_KUNNR,定義一個exporting變數L_BSTKD,定義一個tables變數T_REPAIRITEM,其中,L_KUNAG和L_KUNNR是輸入變數,L_BSTKD是輸出變數,T_REPAIRITEM既是輸入又是輸出變數。在本實施例中,變數定義代碼生成模組100還將生成的變數定義代碼寫入包含程式ZINP_FUNC_0001。 Specifically, the variable definition code generation module 100 first obtains the called function module parameter information according to the name of the incoming called function module. For example, in the SAP system, the called function module parameter information is obtained by the system transparent table FUPARAREF. The parameter information of the called function module includes the type of the parameter, the structure of the tables parameter, and the like. Then, the variable definition code generation module 100 generates a variable definition code according to the called function module parameter information. The variable definition code defines a variable of the same type for each parameter of the called function module. For the tables parameter, the corresponding tables variable has the same structure as the tables parameter. In addition, the defined import variable is the input variable, the defined exporting variable is the output variable, and the defined changing variables and tables variables are both input and output variables. For example, the called function module has two importing parameters KUNAG and KUNNR, one exporting parameter BSTKD, and one table parameter REPAIRITEM. The variable definition code defines two importing variables L_KUNAG and L_KUNNR, defines an exporting variable L_BSTKD, defines a table. The variable T_REPAIRITEM, where L_KUNAG and L_KUNNR are input variables, L_BSTKD is an output variable, and T_REPAIRITEM is both an input and an output variable. In the present embodiment, the variable definition code generation module 100 also writes the generated variable definition code into the inclusion program ZINP_FUNC_0001.

步驟S502,輸入賦值代碼生成模組101根據傳入的被調用功能模組資訊,生成輸入賦值代碼。所述輸入賦值代碼用於根據傳入的被調用功能模組的參數值給相對應的輸入變數賦值。如前所述,假設變數定義代碼用於定義兩個importing變數L_KUNAG和 L_KUNNR,定義一個tables變數T_REPAIRITEM,則所述輸入賦值代碼生成模組101根據傳入的被調用功能模組的參數值生成輸入賦值代碼,該輸入賦值代碼分別給L_KUNAG、L_KUNNR及T_REPAIRITEM賦值。在本實施例中,輸入賦值代碼生成模組101還將生成的輸入賦值代碼寫入包含程式ZINP_FUNC_0002。 Step S502, the input assignment code generation module 101 generates an input assignment code according to the incoming called function module information. The input assignment code is used to assign a value to a corresponding input variable according to a parameter value of the incoming called function module. As mentioned earlier, assume that the variable definition code is used to define two importing variables L_KUNAG and L_KUNNR, defining a table variable T_REPAIRITEM, the input assignment code generation module 101 generates an input assignment code according to the parameter value of the incoming called function module, and the input assignment code assigns values to L_KUNAG, L_KUNNR and T_REPAIRITEM respectively. In the present embodiment, the input assignment code generation module 101 also writes the generated input assignment code to the inclusion program ZINP_FUNC_0002.

步驟S503,調用代碼生成模組102根據被調用功能模組資訊、被調用功能模組參數資訊及定義的變數,生成功能模組調用代碼。在本實施例中,根據被調用功能模組名稱和被調用的方式,藉由SAP系統功能模組FUNCTION_STUB_GENERATE生成被調用功能模組的調用代碼模式,再根據被調用功能模組參數資訊,將相對應的變數填寫為被調用功能模組的實際參數,從而得到可執行的功能模組調用代碼。例如,根據被調用功能模組參數資訊,變數定義代碼定義了兩個importing變數L_KUNAG和L_KUNNR,定義一個exporting變數L_BSTKD,定義一個tables變數T_REPAIRITEM,則把L_KUNAG、L_KUNNR、L_BSTKD和T_REPAIRITEM分別填寫為被調用功能模組相對應的實際參數。在本實施例中,調用代碼生成模組102還將生成的功能模組調用代碼寫入包含程式ZINP_FUNC_0003。 In step S503, the calling code generation module 102 generates a function module calling code according to the called function module information, the called function module parameter information, and the defined variables. In this embodiment, according to the name of the called function module and the called mode, the calling system code of the called function module is generated by the SAP system function module FUNCTION_STUB_GENERATE, and then according to the parameter information of the called function module, The corresponding variable is filled in as the actual parameter of the called function module, thereby obtaining an executable function module calling code. For example, according to the parameter information of the called function module, the variable definition code defines two importing variables L_KUNAG and L_KUNNR, defines an exporting variable L_BSTKD, defines a tables variable T_REPAIRITEM, and then fills in L_KUNAG, L_KUNNR, L_BSTKD and T_REPAIRITEM respectively. The actual parameters corresponding to the function module. In this embodiment, the calling code generation module 102 also writes the generated function module calling code into the containing program ZINP_FUNC_0003.

步驟S504,輸出賦值代碼生成模組103根據被調用功能模組參數資訊,生成輸出賦值代碼。所述輸出賦值代碼將被調用功能模組藉由輸出變數返回的參數值透過所述統一介面傳出。在本實施例中,將返回的exporting參數值和changing參數值透過統一介面的FIMPORT傳出,將返回的tables參數值透過統一介面的FTABLES傳出。因而,輸出賦值代碼生成模組103生成的輸出賦值代碼將 返回的exporting參數值和changing參數值賦值給FIMPORT參數,將返回的tables參數值賦值給FTABLES參數。例如,假設輸出變數包括exporting變數L_BSTKD和tables變數T_REPAIRITEM,則將L_BSTKD賦值給FIMPORT參數,將T_REPAIRITEM賦值給FTABLES參數。在本實施例中,輸出賦值代碼生成模組103還將生成的輸出賦值代碼寫入包含程式ZINP_FUNC_0004。 In step S504, the output assignment code generation module 103 generates an output assignment code according to the called function module parameter information. The output assignment code is transmitted by the calling function module through the unified interface through the parameter value returned by the output variable. In this embodiment, the returned exporting parameter value and the changing parameter value are transmitted through the FIMPORT of the unified interface, and the returned table parameter value is transmitted through the FTABLES of the unified interface. Therefore, the output assignment code generated by the output assignment code generation module 103 will The returned exporting parameter value and the changing parameter value are assigned to the FIMPORT parameter, and the returned tables parameter value is assigned to the FTABLES parameter. For example, assuming that the output variable includes the exporting variable L_BSTKD and the tables variable T_REPAIRITEM, L_BSTKD is assigned to the FIMPORT parameter, and T_REPAIRITEM is assigned to the FTABLES parameter. In the present embodiment, the output assignment code generation module 103 also writes the generated output assignment code to the inclusion program ZINP_FUNC_0004.

步驟S505,代碼執行模組104執行變數定義代碼生成模組100生成的變數定義代碼,定義被調用功能模組相對應的變數,所述變數包括輸入變數和輸出變數。在本實施例中,藉由引用包含程式ZINP_FUNC_0001實現變數定義。 Step S505, the code execution module 104 executes the variable definition code generated by the variable definition code generation module 100, and defines variables corresponding to the called function module, the variables including input variables and output variables. In the present embodiment, the variable definition is implemented by reference to the inclusion program ZINP_FUNC_0001.

步驟S506,代碼執行模組104執行輸入賦值代碼生成模組101生成的輸入賦值代碼,為定義的輸入變數賦值。在本實施例中,藉由引用包含程式ZINP_FUNC_0002實現輸入變數賦值。 In step S506, the code execution module 104 executes the input assignment code generated by the input assignment code generation module 101 to assign a value to the defined input variable. In this embodiment, the input variable assignment is implemented by reference to the include program ZINP_FUNC_0002.

步驟S507,代碼執行模組104執行調用代碼生成模組102生成的功能模組調用代碼,得到該被調用功能模組藉由輸出變數返回的參數值。在本實施例中,藉由引用包含程式ZINP_FUNC_0003實現功能模組調用。 In step S507, the code execution module 104 executes the function module calling code generated by the calling code generating module 102, and obtains the parameter value returned by the called function module by outputting the variable. In this embodiment, the function module call is implemented by referring to the program ZINP_FUNC_0003.

步驟S508,代碼執行模組104執行輸出賦值代碼生成模組103生成的輸出賦值代碼,將被調用功能模組藉由輸出變數返回的參數值透過所述統一介面傳出。在本實施例中,藉由引用包含程式ZINP_FUNC_0004將被調用功能模組藉由輸出變數返回的參數值透過過統一介面傳出。 In step S508, the code execution module 104 executes the output assignment code generated by the output assignment code generation module 103, and transmits the parameter value returned by the called function module by the output variable through the unified interface. In this embodiment, the parameter value returned by the called function module by the output variable is transmitted through the unified interface by referring to the inclusion program ZINP_FUNC_0004.

S501‧‧‧生成變數定義代碼 S501‧‧‧ Generate variable definition code

S502‧‧‧生成輸入賦值代碼 S502‧‧‧ Generate input assignment code

S503‧‧‧生成功能模組調用代碼 S503‧‧‧ Generate function module calling code

S504‧‧‧生成輸出賦值代碼 S504‧‧‧ Generate output assignment code

S505‧‧‧執行變數定義代碼,定義變數 S505‧‧‧Execute variable definition code, define variables

S506‧‧‧執行輸入賦值代碼,為輸入變數賦值 S506‧‧‧Execute the input assignment code to assign values to the input variables

S507‧‧‧執行功能模組調用代碼,得到返回的參數值 S507‧‧‧ Execute the function module calling code to get the returned parameter value

S508‧‧‧執行輸出賦值代碼,傳出返回的參數值 S508‧‧‧Execute the output assignment code and pass the returned parameter value

Claims (8)

一種動態調用功能模組的系統,該系統包括:變數定義代碼生成模組,用於根據傳入的被調用功能模組資訊,獲得被調用功能模組參數資訊,並生成變數定義代碼,所述變數定義代碼用於定義被調用功能模組參數相對應的變數,所述變數包括輸入變數和輸出變數;輸入賦值代碼生成模組,用於根據被調用功能模組資訊,生成輸入賦值代碼,該輸入賦值代碼用於為輸入變數賦值;調用代碼生成模組,用於根據被調用功能模組資訊、被調用功能模組參數資訊及定義的變數,生成功能模組調用代碼;輸出賦值代碼生成模組,用於根據被調用功能模組參數資訊,生成輸出賦值代碼,該輸出賦值代碼用於傳出被調用功能模組藉由輸出變數返回的參數值;及代碼執行模組,用於藉由引用包含程式依次執行生成的變數定義代碼、輸入賦值代碼、功能模組調用代碼及輸出賦值代碼,以完成功能模組的調用,所述包含程式能夠將代碼模組化,並能夠被其他程式所引用,包含程式中的代碼也就是該其他程式的一部分。 A system for dynamically calling a function module, the system comprising: a variable definition code generation module, configured to obtain parameter information of a called function module according to information of an incoming function module, and generate a variable definition code, The variable definition code is used to define a variable corresponding to the called function module parameter, the variable includes an input variable and an output variable, and the input assignment code generating module is configured to generate an input assignment code according to the called function module information, The input assignment code is used to assign a value to the input variable; the code generation module is configured to generate a function module calling code according to the called function module information, the called function module parameter information, and the defined variable; the output assignment code generation module a group, configured to generate an output assignment code according to the called function module parameter information, where the output assignment code is used to transmit a parameter value returned by the called function module by outputting a variable; and a code execution module is used for The reference includes the program to execute the generated variable definition code, the input assignment code, and the function module calling code. Output assignment code to complete the call to the function module comprises a program code capable of modular, and can be used by other programs, other program that is a part of the programs contained in the code. 如申請專利範圍第1項所述之動態調用功能模組的系統,其中所述被調用功能模組資訊透過統一介面傳入。 The system for dynamically invoking a function module according to claim 1, wherein the called function module information is transmitted through a unified interface. 如申請專利範圍第2項所述之動態調用功能模組的系統,其中所述被調用功能模組藉由輸出變數返回的參數值透過所述統一介面傳出。 The system for dynamically invoking a function module according to claim 2, wherein the called function module transmits the parameter value returned by the output variable through the unified interface. 如申請專利範圍第1項所述之動態調用功能模組的系統,該系統應用於SAP系統。 A system for dynamically invoking a function module as described in claim 1 of the patent scope, the system being applied to an SAP system. 一種動態調用功能模組的方法,該方法包括步驟:根據傳入的被調用功能模組資訊,獲得被調用功能模組參數資訊,並生成變數定義代碼,所述變數定義代碼用於定義被調用功能模組參數相對應的變數,所述變數包括輸入變數和輸出變數;根據被調用功能模組資訊,生成輸入賦值代碼,該輸入賦值代碼用於為輸入變數賦值;根據被調用功能模組資訊、被調用功能模組參數資訊及定義的變數,生成功能模組調用代碼;根據被調用功能模組參數資訊,生成輸出賦值代碼,該輸出賦值代碼用於傳出被調用功能模組藉由輸出變數返回的參數值;藉由引用包含程式執行變數定義代碼,定義被調用功能模組相對應的變數,所述變數包括輸入變數及輸出變數;執行輸入賦值代碼,為定義的輸入變數賦值;藉由引用包含程式執行功能模組調用代碼,得到被調用功能模組藉由輸出變數返回的參數值;及藉由引用包含程式執行輸出賦值代碼,傳出被調用功能模組藉由輸出變數返回的參數值,所述包含程式能夠將代碼模組化,並能夠被其他程式所引用,包含程式中的代碼也就是該其他程式的一部分。 A method for dynamically calling a function module, the method comprising the steps of: obtaining information of a called function module parameter according to an incoming function module information, and generating a variable definition code, wherein the variable definition code is used to define a called a variable corresponding to the function module parameter, the variable includes an input variable and an output variable; and an input assignment code is generated according to the called function module information, the input assignment code is used to assign an input variable; according to the called function module information The function module parameter information and the defined variable are called to generate a function module calling code; according to the called function module parameter information, an output assignment code is generated, and the output assignment code is used for transmitting the called function module by outputting The parameter value returned by the variable; defining a variable corresponding to the called function module by referring to the program execution variable definition code, the variable including the input variable and the output variable; executing the input assignment code to assign a value to the defined input variable; Calling code by reference to the program execution function module to get the called function The parameter value returned by the output variable; and the output assignment code is executed by referring to the inclusion program, and the parameter value returned by the called function module by the output variable is transmitted, and the inclusion program can modularize the code and can Referenced by other programs, the code contained in the program is part of the other program. 如申請專利範圍第5項所述之動態調用功能模組的方法,其中所述被調用功能模組資訊透過統一介面傳入。 The method for dynamically calling a function module according to claim 5, wherein the called function module information is transmitted through a unified interface. 如申請專利範圍第6項所述之動態調用功能模組的方法,其中所述被調用功能模組藉由輸出變數返回的參數值透過所述統一介面傳出。 The method of dynamically calling a function module according to claim 6, wherein the called function module transmits the parameter value returned by the output variable through the unified interface. 如申請專利範圍第5項所述之動態調用功能模組的方法,該方法應用於SAP系統。 The method for dynamically calling a function module as described in claim 5 of the patent scope is applied to an SAP system.
TW097132135A 2008-08-22 2008-08-22 System and method for dynamically calling function modules TWI459295B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW097132135A TWI459295B (en) 2008-08-22 2008-08-22 System and method for dynamically calling function modules

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW097132135A TWI459295B (en) 2008-08-22 2008-08-22 System and method for dynamically calling function modules

Publications (2)

Publication Number Publication Date
TW201009711A TW201009711A (en) 2010-03-01
TWI459295B true TWI459295B (en) 2014-11-01

Family

ID=44827943

Family Applications (1)

Application Number Title Priority Date Filing Date
TW097132135A TWI459295B (en) 2008-08-22 2008-08-22 System and method for dynamically calling function modules

Country Status (1)

Country Link
TW (1) TWI459295B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030208743A1 (en) * 2002-01-18 2003-11-06 Kelvin Chong Workflow code generator
CN1801081A (en) * 2005-01-04 2006-07-12 凌阳科技股份有限公司 Programmable control device method thereof
TW200634568A (en) * 2005-03-14 2006-10-01 Seiko Epson Corp Software authentication system, recording medium recording software authentication program, and software authentication method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030208743A1 (en) * 2002-01-18 2003-11-06 Kelvin Chong Workflow code generator
CN1801081A (en) * 2005-01-04 2006-07-12 凌阳科技股份有限公司 Programmable control device method thereof
TW200634568A (en) * 2005-03-14 2006-10-01 Seiko Epson Corp Software authentication system, recording medium recording software authentication program, and software authentication method

Also Published As

Publication number Publication date
TW201009711A (en) 2010-03-01

Similar Documents

Publication Publication Date Title
US8949807B2 (en) Saving and loading graphical processing unit (GPU) arrays providing high computational capabilities in a computing environment
JP2012527054A5 (en)
CN102222017B (en) Methods and systems to implement non-ABI conforming features across unseen interfaces
SG146613A1 (en) System and method for applying development patterns for component based applications
CN101630274B (en) Method for dividing cycle task by means of software and hardware and device thereof
US20070101316A1 (en) Software Architecture and Program for the Concurrent Execution of Finite State Machine-Encoded Processes, on Single or Multiple-Processor-Based Embedded Systems
CN101650648A (en) System and method for dynamically calling functional module
CN109460237A (en) The Compilation Method and device of code
US8387004B2 (en) Compositional application programming interface and literal syntax
CN113434147B (en) Method and device for analyzing message based on ProtoBuf protocol
TWI459295B (en) System and method for dynamically calling function modules
Odendahl et al. Split-cost communication model for improved MPSoC application mapping
CN101470591A (en) Page control layout method and apparatus
CN103051728A (en) Remote-procedure calling method
CN111803950B (en) Data processing method and device for web game, electronic equipment and storage medium
Meijer et al. Combining process splitting and merging transformations for polyhedral process networks
KR20100032778A (en) Multi-processing system for including a large number of heterogeneous processor and driving method of the same
CN115809051A (en) Interpreter of reconfigurable cryptographic algorithm based on customized high-level C language
CN102063308B (en) Method for controlling processing flow of seismic prospecting data
Jiang et al. Synthesizing distributed pipelining systems with timing constraints via optimal functional unit assignment and communication selection
WO2022032476A1 (en) Data processing method and apparatus for web game, and electronic device and computer readable storage medium
CN110427210A (en) A kind of fast construction method and device of storm topology task
Merten et al. ALOMA, an auto-parallelization tool for seismic processing
Worrall et al. Towards a Data Sonification Design Framework
Thornley Integrating functional and imperative parallel programming: CC++ solutions to the Salishan problems

Legal Events

Date Code Title Description
MM4A Annulment or lapse of patent due to non-payment of fees