SAP BPS 變數出口
使用者需要用到rolling forcast ,所以 不得不定義一個變數是User Exit ,因為使用者輸入的是一個預算編制月份,而我們要的是預算月份。
先上一個Sample:(SE80->函式組->UPFX)
SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S31 {
font-style. italic;
color: #808080;
}
.L0S33 {
color: #4DA619;
}
.L0S52 {
color: #0000FF;
}
FUNCTION upf_variable_user_exit_char.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(I_AREA) TYPE UPC_Y_AREA
*" VALUE(I_VARIABLE) TYPE UPC_Y_VARIABLE
*" VALUE(I_CHANM) TYPE UPC_Y_CHANM OPTIONAL
*" VALUE(ITO_CHANM) TYPE UPC_YTO_CHA
*" EXPORTING
*" REFERENCE(ETO_CHARSEL) TYPE UPC_YTO_CHARSEL
*" EXCEPTIONS
*" FAILED
*"----------------------------------------------------------------------
* this example shows how the function module for variables of
* type User-Exit should look like
* this example shows variable of type CHAR - characteristic values
* input parameters:
* i_area : Planning area, in which the variable is defined.
* i_variable : The name of the variable.
* i_chanm : From the release 3.0B variables have been enhanced
* and can contain more than one characteristic (in release
* 3.0A they could contain only one char.).
* To keep all already written user-exits properly running,
* in the case that variable contains only one char. the
* parameter i_chanm is filled with that characteristic.
* ito_chanm : The table of characteristics, for that variable is
* defined. It's always filled regardless of number of
* characteristics.
* export parameters :
* eto_charsel : selection table for the variable in the form of
* structure upc_ys_charsel
* exceptions:
* when it's necessary to raise an exception within exit function module,
* it's possible by the statement message ... raising
* name_of_the_exception. Every exception can be used and the error will
* be handled
* -------------------------------------------------------------------
* fill export table eto_charsel of structure UPC_YS_CHARSEL
* fields: CHANM - Characteristic
* SEQNO - Sequence Number
* SIGN - +/- Sign of Selection Criterion
* OPT - Selection Condition (EQ, BT, ...)
* LOW - Lower Limit of the Selection Conditions
* HIGH - Upper Limit of Selection Conditions
* --------------------------------------------------------------------
* clear export table
CLEAR eto_charsel.
*----------------------------------------------------------------------
* Example: This example is based on the infoobject 0D_COUNTRY of the
* SAP DEMO Cubes. The export table is filled with the selection
* 'DE' (Germany) to GB (Great Britain).
*----------------------------------------------------------------------
DATA l_eto_charsel_wa TYPE upc_ys_charsel.
* fill selection table with 'DE' BT (between) 'GB'
l_eto_charsel_wa-chanm = i_chanm.
l_eto_charsel_wa-seqno = '0001'.
l_eto_charsel_wa-sign = 'I'.
l_eto_charsel_wa-opt = 'BT'.
l_eto_charsel_wa-low = 'DE'.
l_eto_charsel_wa-high = 'GB'.
INSERT l_eto_charsel_wa INTO TABLE eto_charsel.
* check correct infoobject
IF i_chanm IS INITIAL OR i_chanm NE '0D_COUNTRY'.
* Fehler in User-Exit für Variablen aufgetreten
* Add your own error message here
Message e538(upc) raising FAILED.
ENDIF.
ENDFUNCTION.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" IMPORTING
*" VALUE(I_AREA) TYPE UPC_Y_AREA
*" VALUE(I_VARIABLE) TYPE UPC_Y_VARIABLE
*" VALUE(I_CHANM) TYPE UPC_Y_CHANM OPTIONAL
*" VALUE(ITO_CHANM) TYPE UPC_YTO_CHA
*" EXPORTING
*" REFERENCE(ETO_CHARSEL) TYPE UPC_YTO_CHARSEL
*" EXCEPTIONS
*" FAILED
*"----------------------------------------------------------------------
* this example shows how the function module for variables of
* type User-Exit should look like
* this example shows variable of type CHAR - characteristic values
* input parameters:
* i_area : Planning area, in which the variable is defined.
* i_variable : The name of the variable.
* i_chanm : From the release 3.0B variables have been enhanced
* and can contain more than one characteristic (in release
* 3.0A they could contain only one char.).
* To keep all already written user-exits properly running,
* in the case that variable contains only one char. the
* parameter i_chanm is filled with that characteristic.
* ito_chanm : The table of characteristics, for that variable is
* defined. It's always filled regardless of number of
* characteristics.
* export parameters :
* eto_charsel : selection table for the variable in the form of
* structure upc_ys_charsel
* exceptions:
* when it's necessary to raise an exception within exit function module,
* it's possible by the statement message ... raising
* name_of_the_exception. Every exception can be used and the error will
* be handled
* -------------------------------------------------------------------
* fill export table eto_charsel of structure UPC_YS_CHARSEL
* fields: CHANM - Characteristic
* SEQNO - Sequence Number
* SIGN - +/- Sign of Selection Criterion
* OPT - Selection Condition (EQ, BT, ...)
* LOW - Lower Limit of the Selection Conditions
* HIGH - Upper Limit of Selection Conditions
* --------------------------------------------------------------------
* clear export table
CLEAR eto_charsel.
*----------------------------------------------------------------------
* Example: This example is based on the infoobject 0D_COUNTRY of the
* SAP DEMO Cubes. The export table is filled with the selection
* 'DE' (Germany) to GB (Great Britain).
*----------------------------------------------------------------------
DATA l_eto_charsel_wa TYPE upc_ys_charsel.
* fill selection table with 'DE' BT (between) 'GB'
l_eto_charsel_wa-chanm = i_chanm.
l_eto_charsel_wa-seqno = '0001'.
l_eto_charsel_wa-sign = 'I'.
l_eto_charsel_wa-opt = 'BT'.
l_eto_charsel_wa-low = 'DE'.
l_eto_charsel_wa-high = 'GB'.
INSERT l_eto_charsel_wa INTO TABLE eto_charsel.
* check correct infoobject
IF i_chanm IS INITIAL OR i_chanm NE '0D_COUNTRY'.
* Fehler in User-Exit für Variablen aufgetreten
* Add your own error message here
Message e538(upc) raising FAILED.
ENDIF.
ENDFUNCTION.
這個函式比較簡單,直接賦值。
那我們的實際情況是需要先獲取另外一個變數的值,這裡需要使用另外一個函式去獲取變數值
獲取系統已有變數值:
SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S31 {
font-style. italic;
color: #808080;
}
.L0S32 {
color: #3399FF;
}
.L0S33 {
color: #4DA619;
}
.L0S52 {
color: #0000FF;
}
FUNCTION z_variable_get_detail.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_AREA) TYPE UPC_VAR-AREA
*" REFERENCE(I_VARIABLE) TYPE UPC_VAR-VAR
*" VALUE(I_BUFFER) TYPE BOOLE-BOOLE
*" EXPORTING
*" VALUE(E_SUBRC) TYPE SY-SUBRC
*" VALUE(ES_RETURN) TYPE BAPIRET2
*" VALUE(E_TYPE) TYPE UPC_VAR-VARTYPE
*" REFERENCE(ETO_VARSEL_ALL) TYPE UPC_YTO_CHARSEL
*" REFERENCE(ETO_VARSEL) TYPE UPC_YTO_CHARSEL
*" REFERENCE(ETO_CHANM) TYPE UPC_YTO_CHA
*"----------------------------------------------------------------------
TYPES:
BEGIN OF ys_buffer,
area TYPE upc_var-area,
variable TYPE upc_var-var,
subrc LIKE sy-subrc,
s_return LIKE bapiret2,
type LIKE upc_var-vartype,
to_varsel_all TYPE upc_yto_charsel,
to_varsel TYPE upc_yto_charsel,
to_chanm TYPE upc_yto_cha,
END OF ys_buffer.
STATICS:
st_buffer TYPE SORTED TABLE OF ys_buffer
WITH UNIQUE KEY area variable.
DATA:
ls_buffer TYPE ys_buffer,
lr_variable TYPE REF TO cl_sem_variable.
* Check buffer
READ TABLE st_buffer INTO ls_buffer WITH TABLE KEY
area = i_area
variable = i_variable.
* Found :-)
IF sy-subrc = 0 AND i_buffer = 'X'.
e_subrc = ls_buffer-subrc.
es_return = ls_buffer-s_return.
e_type = ls_buffer-type.
eto_varsel_all = ls_buffer-to_varsel_all.
eto_varsel = ls_buffer-to_varsel.
eto_chanm = ls_buffer-to_chanm.
EXIT.
ENDIF.
* Not found :-(
CLEAR: e_subrc, es_return, e_type, eto_chanm, eto_varsel_all, eto_varsel.
CALL METHOD cl_sem_variable=>get_instance
EXPORTING
i_area = i_area
i_variable = i_variable
RECEIVING
rr_variable = lr_variable
EXCEPTIONS
not_existing = 1
OTHERS = 2.
IF sy-subrc <> 0.
e_subrc = 4.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
type = sy-msgty
cl = sy-msgid
number = sy-msgno
par1 = sy-msgv1
par2 = sy-msgv2
par3 = sy-msgv3
par4 = sy-msgv4
IMPORTING
return = es_return.
EXIT.
ENDIF.
* read details of variable
CALL METHOD lr_variable->get_attributes
IMPORTING
e_type = e_type
eto_chanm = eto_chanm.
* read restricted values
CALL METHOD lr_variable->get_value
EXPORTING
i_user = sy-uname
i_restrict = 'X'
RECEIVING
rto_value = eto_varsel
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc <> 0.
e_subrc = 4.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
type = sy-msgty
cl = sy-msgid
number = sy-msgno
par1 = sy-msgv1
par2 = sy-msgv2
par3 = sy-msgv3
par4 = sy-msgv4
IMPORTING
return = es_return.
EXIT.
ENDIF.
* read all values
CALL METHOD lr_variable->get_value
EXPORTING
i_user = sy-uname
i_restrict = ' '
RECEIVING
rto_value = eto_varsel_all
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc <> 0.
e_subrc = 4.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
type = sy-msgty
cl = sy-msgid
number = sy-msgno
par1 = sy-msgv1
par2 = sy-msgv2
par3 = sy-msgv3
par4 = sy-msgv4
IMPORTING
return = es_return.
EXIT.
ENDIF.
* -- no error occured => store results to buffer
IF i_buffer = 'X'.
CLEAR ls_buffer.
ls_buffer-area = i_area.
ls_buffer-variable = i_variable.
ls_buffer-subrc = e_subrc.
ls_buffer-s_return = es_return.
ls_buffer-type = e_type.
ls_buffer-to_varsel_all = eto_varsel_all.
ls_buffer-to_varsel = eto_varsel.
ls_buffer-to_chanm = eto_chanm.
INSERT ls_buffer INTO TABLE st_buffer.
ENDIF.
ENDFUNCTION.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" REFERENCE(I_AREA) TYPE UPC_VAR-AREA
*" REFERENCE(I_VARIABLE) TYPE UPC_VAR-VAR
*" VALUE(I_BUFFER) TYPE BOOLE-BOOLE
*" EXPORTING
*" VALUE(E_SUBRC) TYPE SY-SUBRC
*" VALUE(ES_RETURN) TYPE BAPIRET2
*" VALUE(E_TYPE) TYPE UPC_VAR-VARTYPE
*" REFERENCE(ETO_VARSEL_ALL) TYPE UPC_YTO_CHARSEL
*" REFERENCE(ETO_VARSEL) TYPE UPC_YTO_CHARSEL
*" REFERENCE(ETO_CHANM) TYPE UPC_YTO_CHA
*"----------------------------------------------------------------------
TYPES:
BEGIN OF ys_buffer,
area TYPE upc_var-area,
variable TYPE upc_var-var,
subrc LIKE sy-subrc,
s_return LIKE bapiret2,
type LIKE upc_var-vartype,
to_varsel_all TYPE upc_yto_charsel,
to_varsel TYPE upc_yto_charsel,
to_chanm TYPE upc_yto_cha,
END OF ys_buffer.
STATICS:
st_buffer TYPE SORTED TABLE OF ys_buffer
WITH UNIQUE KEY area variable.
DATA:
ls_buffer TYPE ys_buffer,
lr_variable TYPE REF TO cl_sem_variable.
* Check buffer
READ TABLE st_buffer INTO ls_buffer WITH TABLE KEY
area = i_area
variable = i_variable.
* Found :-)
IF sy-subrc = 0 AND i_buffer = 'X'.
e_subrc = ls_buffer-subrc.
es_return = ls_buffer-s_return.
e_type = ls_buffer-type.
eto_varsel_all = ls_buffer-to_varsel_all.
eto_varsel = ls_buffer-to_varsel.
eto_chanm = ls_buffer-to_chanm.
EXIT.
ENDIF.
* Not found :-(
CLEAR: e_subrc, es_return, e_type, eto_chanm, eto_varsel_all, eto_varsel.
CALL METHOD cl_sem_variable=>get_instance
EXPORTING
i_area = i_area
i_variable = i_variable
RECEIVING
rr_variable = lr_variable
EXCEPTIONS
not_existing = 1
OTHERS = 2.
IF sy-subrc <> 0.
e_subrc = 4.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
type = sy-msgty
cl = sy-msgid
number = sy-msgno
par1 = sy-msgv1
par2 = sy-msgv2
par3 = sy-msgv3
par4 = sy-msgv4
IMPORTING
return = es_return.
EXIT.
ENDIF.
* read details of variable
CALL METHOD lr_variable->get_attributes
IMPORTING
e_type = e_type
eto_chanm = eto_chanm.
* read restricted values
CALL METHOD lr_variable->get_value
EXPORTING
i_user = sy-uname
i_restrict = 'X'
RECEIVING
rto_value = eto_varsel
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc <> 0.
e_subrc = 4.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
type = sy-msgty
cl = sy-msgid
number = sy-msgno
par1 = sy-msgv1
par2 = sy-msgv2
par3 = sy-msgv3
par4 = sy-msgv4
IMPORTING
return = es_return.
EXIT.
ENDIF.
* read all values
CALL METHOD lr_variable->get_value
EXPORTING
i_user = sy-uname
i_restrict = ' '
RECEIVING
rto_value = eto_varsel_all
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc <> 0.
e_subrc = 4.
CALL FUNCTION 'BALW_BAPIRETURN_GET2'
EXPORTING
type = sy-msgty
cl = sy-msgid
number = sy-msgno
par1 = sy-msgv1
par2 = sy-msgv2
par3 = sy-msgv3
par4 = sy-msgv4
IMPORTING
return = es_return.
EXIT.
ENDIF.
* -- no error occured => store results to buffer
IF i_buffer = 'X'.
CLEAR ls_buffer.
ls_buffer-area = i_area.
ls_buffer-variable = i_variable.
ls_buffer-subrc = e_subrc.
ls_buffer-s_return = es_return.
ls_buffer-type = e_type.
ls_buffer-to_varsel_all = eto_varsel_all.
ls_buffer-to_varsel = eto_varsel.
ls_buffer-to_chanm = eto_chanm.
INSERT ls_buffer INTO TABLE st_buffer.
ENDIF.
ENDFUNCTION.
先設定一個變數 ZMONTH1,型別為Fixed Value , 1-12 個單值。
在設計Web Interface 時,將ZMONTH1定義在第一個變數頁 , 通過跳轉Page進入到預算Page。
預算的Planning Level 使用第二個變數 ZMONTH2 ,型別為UserExit , Function:Z_VARIABLE_USER_EXIT_MONTH。
SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S31 {
font-style. italic;
color: #808080;
}
.L0S32 {
color: #3399FF;
}
.L0S33 {
color: #4DA619;
}
.L0S52 {
color: #0000FF;
}
FUNCTION z_variable_user_exit_month.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(I_AREA) TYPE UPC_Y_AREA
*" VALUE(I_VARIABLE) TYPE UPC_Y_VARIABLE
*" VALUE(I_CHANM) TYPE UPC_Y_CHANM OPTIONAL
*" VALUE(ITO_CHANM) TYPE UPC_YTO_CHA
*" EXPORTING
*" REFERENCE(ETO_CHARSEL) TYPE UPC_YTO_CHARSEL
*" EXCEPTIONS
*" FAILED
*"----------------------------------------------------------------------
* clear export table
CLEAR eto_charsel.
*----------------------------------------------------------------------
* Example: This example is based on the infoobject 0D_COUNTRY of the
* SAP DEMO Cubes. The export table is filled with the selection
* 'DE' (Germany) to GB (Great Britain).
*----------------------------------------------------------------------
DATA l_eto_charsel_wa TYPE upc_ys_charsel.
DATA: l_month(2).
*
DATA:
l_source_var TYPE upc_y_variable VALUE 'ZMONTH1',
l_source_area TYPE upc_y_area VALUE 'ZSDPLAN1',
l_use_restricted_values TYPE boole-boole VALUE 'X',
l_buffer_call TYPE boole-boole VALUE 'X'.
DATA:
l_subrc LIKE sy-subrc,
ls_return LIKE bapiret2,
l_type LIKE upc_var-vartype,
lto_varsel_all TYPE upc_yto_charsel,
lto_varsel TYPE upc_yto_charsel,
lto_var TYPE upc_yto_charsel,
lto_chanm TYPE upc_yto_cha.
DATA: ls_varsel TYPE upc_ys_charsel,
l_next_month(2) TYPE n,
l_entries TYPE i.
CASE i_variable .
WHEN 'ZMONTH2'.
* read source value
l_source_var = 'ZMONTH1'.
l_source_area = i_area .
CALL FUNCTION 'Z_VARIABLE_GET_DETAIL'
EXPORTING
i_area = l_source_area
i_variable = l_source_var
i_buffer = l_buffer_call
IMPORTING
e_subrc = l_subrc
es_return = ls_return
e_type = l_type
eto_varsel_all = lto_varsel_all
eto_varsel = lto_varsel
eto_chanm = lto_chanm.
IF l_subrc <> 0.
MESSAGE i136(upc_fw) WITH l_source_var.
* Values of variable &1 cannot be determined
EXIT.
ENDIF.
* We have a single value for the year and only one characteristic
* => our value is stored in the first line
IF l_use_restricted_values IS INITIAL.
lto_var = lto_varsel_all.
ELSE.
lto_var = lto_varsel.
ENDIF.
READ TABLE lto_var INTO ls_varsel INDEX 1.
* check prerequisites:
* - record found?
IF sy-subrc <> 0.
MESSAGE i147(upc_fw) WITH l_source_var.
* Variable &1 does not contain any values
EXIT.
ENDIF.
* - exactly one record and characteristic?
DESCRIBE TABLE lto_var LINES l_entries.
IF l_entries <> 1.
MESSAGE i534(upc) WITH l_source_var.
* Variable &1 must be restricted to a value
EXIT.
ENDIF.
* is there a next year?
l_next_month = ls_varsel-low.
IF l_next_month 12 .
l_next_month = l_next_month + 1.
CLEAR:l_eto_charsel_wa.
l_eto_charsel_wa-chanm = i_chanm.
l_eto_charsel_wa-seqno = '0001'.
l_eto_charsel_wa-sign = 'I'.
l_eto_charsel_wa-opt = 'EQ'.
IF l_next_month 10.
CONCATENATE '0' l_next_month INTO l_eto_charsel_wa-low .
ELSE.
l_eto_charsel_wa-low = l_next_month.
ENDIF.
INSERT l_eto_charsel_wa INTO TABLE eto_charsel.
ENDIF.
IF l_next_month 12 .
l_next_month = l_next_month + 1.
l_eto_charsel_wa-seqno = '0002'.
IF l_next_month 10.
CONCATENATE '0' l_next_month INTO l_eto_charsel_wa-low .
ELSE.
l_eto_charsel_wa-low = l_next_month .
ENDIF.
INSERT l_eto_charsel_wa INTO TABLE eto_charsel.
ENDIF.
IF l_next_month 12 .
l_next_month = l_next_month + 1.
l_eto_charsel_wa-seqno = '0003'.
IF l_next_month 10.
CONCATENATE '0' l_next_month INTO l_eto_charsel_wa-low .
ELSE.
l_eto_charsel_wa-low = l_next_month .
ENDIF.
INSERT l_eto_charsel_wa INTO TABLE eto_charsel.
ENDIF.
** check correct infoobject
IF i_chanm IS INITIAL OR i_chanm NE '0CALMONTH2'.
* Fehler in User-Exit für Variablen aufgetreten
* Add your own error message here
MESSAGE e538(upc) RAISING failed.
ENDIF.
ENDCASE.
ENDFUNCTION.
*"----------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(I_AREA) TYPE UPC_Y_AREA
*" VALUE(I_VARIABLE) TYPE UPC_Y_VARIABLE
*" VALUE(I_CHANM) TYPE UPC_Y_CHANM OPTIONAL
*" VALUE(ITO_CHANM) TYPE UPC_YTO_CHA
*" EXPORTING
*" REFERENCE(ETO_CHARSEL) TYPE UPC_YTO_CHARSEL
*" EXCEPTIONS
*" FAILED
*"----------------------------------------------------------------------
* clear export table
CLEAR eto_charsel.
*----------------------------------------------------------------------
* Example: This example is based on the infoobject 0D_COUNTRY of the
* SAP DEMO Cubes. The export table is filled with the selection
* 'DE' (Germany) to GB (Great Britain).
*----------------------------------------------------------------------
DATA l_eto_charsel_wa TYPE upc_ys_charsel.
DATA: l_month(2).
*
DATA:
l_source_var TYPE upc_y_variable VALUE 'ZMONTH1',
l_source_area TYPE upc_y_area VALUE 'ZSDPLAN1',
l_use_restricted_values TYPE boole-boole VALUE 'X',
l_buffer_call TYPE boole-boole VALUE 'X'.
DATA:
l_subrc LIKE sy-subrc,
ls_return LIKE bapiret2,
l_type LIKE upc_var-vartype,
lto_varsel_all TYPE upc_yto_charsel,
lto_varsel TYPE upc_yto_charsel,
lto_var TYPE upc_yto_charsel,
lto_chanm TYPE upc_yto_cha.
DATA: ls_varsel TYPE upc_ys_charsel,
l_next_month(2) TYPE n,
l_entries TYPE i.
CASE i_variable .
WHEN 'ZMONTH2'.
* read source value
l_source_var = 'ZMONTH1'.
l_source_area = i_area .
CALL FUNCTION 'Z_VARIABLE_GET_DETAIL'
EXPORTING
i_area = l_source_area
i_variable = l_source_var
i_buffer = l_buffer_call
IMPORTING
e_subrc = l_subrc
es_return = ls_return
e_type = l_type
eto_varsel_all = lto_varsel_all
eto_varsel = lto_varsel
eto_chanm = lto_chanm.
IF l_subrc <> 0.
MESSAGE i136(upc_fw) WITH l_source_var.
* Values of variable &1 cannot be determined
EXIT.
ENDIF.
* We have a single value for the year and only one characteristic
* => our value is stored in the first line
IF l_use_restricted_values IS INITIAL.
lto_var = lto_varsel_all.
ELSE.
lto_var = lto_varsel.
ENDIF.
READ TABLE lto_var INTO ls_varsel INDEX 1.
* check prerequisites:
* - record found?
IF sy-subrc <> 0.
MESSAGE i147(upc_fw) WITH l_source_var.
* Variable &1 does not contain any values
EXIT.
ENDIF.
* - exactly one record and characteristic?
DESCRIBE TABLE lto_var LINES l_entries.
IF l_entries <> 1.
MESSAGE i534(upc) WITH l_source_var.
* Variable &1 must be restricted to a value
EXIT.
ENDIF.
* is there a next year?
l_next_month = ls_varsel-low.
IF l_next_month 12 .
l_next_month = l_next_month + 1.
CLEAR:l_eto_charsel_wa.
l_eto_charsel_wa-chanm = i_chanm.
l_eto_charsel_wa-seqno = '0001'.
l_eto_charsel_wa-sign = 'I'.
l_eto_charsel_wa-opt = 'EQ'.
IF l_next_month 10.
CONCATENATE '0' l_next_month INTO l_eto_charsel_wa-low .
ELSE.
l_eto_charsel_wa-low = l_next_month.
ENDIF.
INSERT l_eto_charsel_wa INTO TABLE eto_charsel.
ENDIF.
IF l_next_month 12 .
l_next_month = l_next_month + 1.
l_eto_charsel_wa-seqno = '0002'.
IF l_next_month 10.
CONCATENATE '0' l_next_month INTO l_eto_charsel_wa-low .
ELSE.
l_eto_charsel_wa-low = l_next_month .
ENDIF.
INSERT l_eto_charsel_wa INTO TABLE eto_charsel.
ENDIF.
IF l_next_month 12 .
l_next_month = l_next_month + 1.
l_eto_charsel_wa-seqno = '0003'.
IF l_next_month 10.
CONCATENATE '0' l_next_month INTO l_eto_charsel_wa-low .
ELSE.
l_eto_charsel_wa-low = l_next_month .
ENDIF.
INSERT l_eto_charsel_wa INTO TABLE eto_charsel.
ENDIF.
** check correct infoobject
IF i_chanm IS INITIAL OR i_chanm NE '0CALMONTH2'.
* Fehler in User-Exit für Variablen aufgetreten
* Add your own error message here
MESSAGE e538(upc) RAISING failed.
ENDIF.
ENDCASE.
ENDFUNCTION.
通過以上的樣例可以實現獲取後三個月的值。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/554557/viewspace-693849/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- SAP BPS : 一變數多特徵變數特徵
- SAP BPS 巧用Page設變數變數
- SAP BPS 變數完美級聯 - Variables in web interaces變數Web
- SAP BPS: 物件的傳輸物件
- SAP BPS : Exit Function 實現版本鎖定Function
- SAP BPS: 用Javascript實現資料下載JavaScript
- SAP BPS:Web 許可權實現新思路Web
- what are bit, bps Byte and Bps?
- SAP系統常用變數變數
- SAP的使用者出口(User Exits)
- SAP 尋找使用者出口Exit
- SAP Report 變數的值傳遞變數
- 關於SAP ABAP字元變數和字串變數字元個數的一個知識點,和一個血案字元變數字串
- SAP使用者出口(exit)問題--資料來源增強
- SAP有四種基本使用者出口的型別(user exits)型別
- 關於 SAP Spartacus scss 處理邏輯裡的變數 $useLatestStylesCSS變數
- 成員變數、全域性變數、例項變數、類變數、靜態變數和區域性變數的區別變數
- 變數的分類(臨時(本地)變數、環境變數、全域性變數和系統變數)變數
- iOS 靜變數static、全域性變數extern、區域性變數、例項變數iOS變數
- SAP方丈:整理的SAP引數檔案
- sap入門--sap配置引數詳解
- 出口商貿易融資工具:出口保理
- 變數變數
- SAP引數檔案
- Oracle中的替換變數,&變數名,&&變數名說明Oracle變數
- linux基礎——shell變數(本地變數和環境變數)Linux變數
- 進出口軟體(進出口貿易管理軟體)
- 出口路由器升級時出口流量異常路由器
- python變數與變數作用域Python變數
- ODI第7節-變數(一):變數變數
- Ansible fact變數與魔法變數變數
- SAP S/4 HANA新變化-CO技術變化
- 引數和變數變數
- 全域性變數與區域性變數變數
- 靜態變數和非靜態變數變數
- ODI第10節-變數(四):變數使用變數
- 成員變數和區域性變數變數
- 區域性變數和全域性變數變數