abap 中 select 语句 s_month(选择屏幕输入,列如:201612(年度加上期间)) A IN S_MONTH(前四位值),
1个回答
展开全部
另外定义两个选择变量。
RANGES:S_A FOR BKPF-GJAHR,
S_B FOR BKPF-MONAT.
根据输入信息给两个选择变量赋值
LOOP AT s_month.
S_A-SIGN = S_MONTH-SIGN.
S_A-OPTION = S_MONTH-OPTION.
S_A-LOW = S_MONTH-LOW+0(4).
S_A-HIGH = S_MONTH-HIGH+0(4).
APPEND S_A.
S_B-SIGN = S_MONTH-SIGN.
S_B-OPTION = S_MONTH-OPTION.
S_B-LOW = S_MONTH-LOW+4(2).
S_B-HIGH = S_MONTH-HIGH+4(2).
APPEND S_B.
ENDLOOP.
然后得到的选择变量取值
A IN S_A
B IN S_B
RANGES:S_A FOR BKPF-GJAHR,
S_B FOR BKPF-MONAT.
根据输入信息给两个选择变量赋值
LOOP AT s_month.
S_A-SIGN = S_MONTH-SIGN.
S_A-OPTION = S_MONTH-OPTION.
S_A-LOW = S_MONTH-LOW+0(4).
S_A-HIGH = S_MONTH-HIGH+0(4).
APPEND S_A.
S_B-SIGN = S_MONTH-SIGN.
S_B-OPTION = S_MONTH-OPTION.
S_B-LOW = S_MONTH-LOW+4(2).
S_B-HIGH = S_MONTH-HIGH+4(2).
APPEND S_B.
ENDLOOP.
然后得到的选择变量取值
A IN S_A
B IN S_B
追问
你这种方法是因为s_monat 的长度已近固定了吧,要是它的长度不固定呢?比如 S_MONAT可以为 (年月)或者(年月日),这样该怎么做呢,用哪种方法?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询