我觉得好用的语法
...
我觉得好用的语法
内容
1. 获取字段的值的值
可以少用点if 😸
DATA: LT_FIELDS TYPE TABLE OF CHAR32,
LS_FIELD LIKE LINE OF LT_FIELDS.
*公司名称及地址
SELECT SINGLE * INTO @DATA(GS_T001W) FROM T001W WHERE WERKS = @ES_HEAD-BUKRS.
ES_HEAD-NAME1 = GS_T001W-NAME1.
* ES_HEAD-STRAS = GS_T001W-ORT01 && ` ` && GS_T001W-REGIO && ` ` && GS_T001W-LAND1.
CLEAR LT_FIELDS.
REFRESH LT_FIELDS.
LT_FIELDS = VALUE #(
( 'GS_T001W-ORT01' ) ( 'GS_T001W-REGIO' ) ( 'GS_T001W-LAND1' ) ).
*遍历字段数组
LOOP AT LT_FIELDS INTO LS_FIELD.
ASSIGN (LS_FIELD) TO <FLV_SYMBOL>.
IF <FLV_SYMBOL> IS NOT INITIAL.
IF ES_HEAD-STRAS IS INITIAL.
ES_HEAD-STRAS = <FLV_SYMBOL>.
ELSE.
IF <FLV_SYMBOL> = 'US'.
ES_HEAD-STRAS = ES_HEAD-STRAS && ` `&& 'UNITED STATES'.
ELSE.
ES_HEAD-STRAS = ES_HEAD-STRAS && ` `&& <FLV_SYMBOL>.
ENDIF.
ENDIF.
ENDIF.
ENDLOOP.
2. 分组处理LOOP GROUP取代at end of啥的
SORT GT_DATA1 BY RCNTR RACCT.
LOOP AT GT_DATA1 INTO DATA(GS_DATA1)
GROUP BY ( RCNTR = GS_DATA1-RCNTR RACCT = GS_DATA1-RACCT )."按括号里的条件进行分组
GS_ITEM = CORRESPONDING #( GS_DATA1
EXCEPT HSL
).
LOOP AT GROUP GS_DATA1 INTO DATA(MEMBER)."按分组后进行组员的访问
* GS_DATA1-HSL = P_MENGE + MEMBER-WKURS."这里就是对同一组的进行某个字段的汇总
GS_ITEM-HSL = GS_ITEM-HSL + MEMBER-HSL.
ENDLOOP.
APPEND GS_ITEM TO GT_ITEM1[].
ENDLOOP.
3. 前导0,OUT转换为外围,IN转换为SAP
LS_G_AFP-AUFNR = |{ LS_G_AFP-AUFNR ALPHA = OUT }|.
4. 赋值内表
LT_E_MAILDATANONADDRESS = VALUE #( (
STD_NO = 'X' "表中的部分字段
E_MAIL = PS_ALV-SMTP_ADDR2 ) ). "独立通讯E-mail
5. 能将程序中的内表和工作区传递给另一个程序还是啥?
这是我看到的一个smartforms的应用方式,实际我还没操作过
参考文献
感谢我大慈大悲的猫哥提供的帮助
你认为这篇文章怎么样?
- 0
- 0
- 0
- 0
- 0
- 0