SAP BPS 變數完美級聯 - Variables in web interaces
在前一篇中,我們實現了級聯的設計,但是存在缺陷,因為之前的設計沒有把下一級本身的許可權考慮進去,所以有可能會把使用者沒有的許可權顯示出來,所以在新的設計中,加入了非有效下級的剔除功能。
FUNCTION z_variable_user_exit_attr.
*"----------------------------------------------------------------------
*"*"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
*"----------------------------------------------------------------------
* -------------------------------------------------------------------
* 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.
DATA l_eto_charsel_wa TYPE upc_ys_charsel.
DATA: l_month(2).
DATA:
l_source_var TYPE upc_y_variable VALUE '',
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 ''.
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_comp(4) TYPE c,
l_entries TYPE i.
DATA:
l_error TYPE c,
ls_hiesel TYPE upc_ys_api_hiesel,
ls_cha TYPE upc_ys_cha,
lt_cha TYPE STANDARD TABLE OF upc_ys_cha,
ls_varsel_all TYPE upc_ys_api_varsel,
lt_varsel_all TYPE STANDARD TABLE OF upc_ys_api_varsel,
lt_return TYPE STANDARD TABLE OF bapiret2.
CASE i_variable .
WHEN 'ZORGEX'.
* read source value
l_source_var = 'ZCOMPANY'.
l_source_area = i_area .
"這裡把使用者的原始許可權抓取過來
CALL FUNCTION 'API_SEMBPS_VARIABLE_GETDETAIL'
EXPORTING
i_area = i_area
i_variable = 'ZSALESOG' "AUTHORIZATION VARIABLE
IMPORTING
e_subrc = l_subrc
es_return = ls_return
e_type = l_type
es_hiesel = ls_hiesel
TABLES
etk_cha = lt_cha
etk_varsel_all = lt_varsel_all.
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_comp = ls_varsel-low.
CLEAR:l_eto_charsel_wa.
l_eto_charsel_wa-chanm = i_chanm.
l_eto_charsel_wa-seqno = '0000'.
l_eto_charsel_wa-sign = 'I'.
l_eto_charsel_wa-opt = 'EQ'.
* l_eto_charsel_wa-low = l_comp .
SELECT salesorg INTO l_eto_charsel_wa-low
FROM /bi0/msalesorg
WHERE comp_code = l_comp.
l_eto_charsel_wa-seqno = l_eto_charsel_wa-seqno + 1.
"把下級值和使用者的原始變數值作對比,剔除無效的值
READ TABLE lt_varsel_all TRANSPORTING NO FIELDS
WITH KEY low = l_eto_charsel_wa-low.
IF sy-subrc EQ 0.
INSERT l_eto_charsel_wa INTO TABLE eto_charsel.
ENDIF.
ENDSELECT.
WHEN 'ZOFFEX'.
......
ENDCASE.
ENDFUNCTION.
通過以上,可以做到動態重新整理取值,並且做到下級值的有效性檢查。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/554557/viewspace-696452/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- SAP BPS 變數出口變數
- SAP BPS : 一變數多特徵變數特徵
- SAP BPS 巧用Page設變數變數
- Variables in Java 變數Java變數
- activiti變數variables變數
- SAP BPS:Web 許可權實現新思路Web
- TensorFlow入門 - 變數(Variables)變數
- SAP BPS: 物件的傳輸物件
- SAP BPS : Exit Function 實現版本鎖定Function
- 概率論與梳理統計-隨機變數random variables隨機變數random
- SAP BPS: 用Javascript實現資料下載JavaScript
- FastAPI(64)- Settings and Environment Variables 配置項和環境變數ASTAPI變數
- 1.2 C++變數和資料型別 (Variables and Data types )C++變數資料型別
- Dependencies for Variables of Type Customer Exit [SAP Help]
- what are bit, bps Byte and Bps?
- SAP系統常用變數變數
- variables_order引數詳解
- web前端-js變數提升Web前端JS變數
- SAP Report 變數的值傳遞變數
- PHP 超級全域性變數PHP變數
- Web_Bugku_WriteUp | 變數1Web變數
- Clouse Variables as Inputs
- [Bash] Environment variables
- 如何實現引數級聯查詢
- 【Web前端培訓】預解析(變數提升)Web前端變數
- 關於web應用的static變數Web變數
- [轉]Updating Session Variables from Dashboards using Presentation VariablesSession
- flutter 裡面的全域性變數(給web開發者)Flutter變數Web
- 複變函式與積分變換 洛朗級數函式
- 完美世界:變革進行時
- SQL*Plus Substitution VariablesSQL
- 關於SAP ABAP字元變數和字串變數字元個數的一個知識點,和一個血案字元變數字串
- 完美世界蕭泓:以“科技+文化”迎接數字娛樂產業新變革產業
- 【深入淺出ES6】塊級變數變數
- Oracle繫結變數分級(Bind Graduation)Oracle變數
- 92-10g升級與降級_環境變數_PFILE變數
- SAP變革-下月將釋出基於Web的企業軟體(轉)Web
- MYSQL SHOW VARIABLES簡介MySql