关闭

Context对象

728人阅读 评论(0) 收藏 举报

instance 1

 

CONTEXTS demo_travel.

TYPES fields TYPE context_t_demo_travel.

DATA: carrier    TYPE fields-carrid,
      connection TYPE fields-connid,
      c_from     TYPE fields-cityfrom,
      c_to       TYPE fields-cityto,
      c_time     TYPE fields-fltime.

DATA: demo_travel_inst1 TYPE context_demo_travel,
      demo_travel_inst2 TYPE context_demo_travel.

carrier = 'LH'.
connection = '400'.

SUPPLY carrid = carrier
       connid = connection
       TO CONTEXT demo_travel_inst1.

carrier = 'AA'.
connection = '017'.

SUPPLY carrid = carrier
       connid = connection
       TO CONTEXT demo_travel_inst2.

DEMAND cityfrom = c_from
       cityto   = c_to
       fltime   = c_time
       FROM CONTEXT demo_travel_inst1.

WRITE: / c_from, c_to, c_time.

DEMAND cityfrom = c_from
       cityto   = c_to
       fltime   = c_time
       FROM CONTEXT demo_travel_inst2.

WRITE: / c_from, c_to, c_time.

 

 

 

instance 2

DATA: percentage TYPE i.

CONTEXTS docu_test4.

DATA: context_inst TYPE context_docu_test4.

DATA itab TYPE TABLE OF symsg WITH HEADER LINE.

SUPPLY max = 00
       occ = 20
       TO CONTEXT context_inst.

DEMAND percent = percentage
       FROM CONTEXT context_inst MESSAGES INTO itab.

WRITE: / 'Percentage: ', percentage.   "#EC NOTEXT

IF sy-subrc NE 0.
  LOOP AT itab.
    WRITE: / itab-msgty, / itab-msgid, / itab-msgno,
           / itab-msgv1, / itab-msgv2.
  ENDLOOP.
ENDIF.

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:555847次
    • 积分:8250
    • 等级:
    • 排名:第2514名
    • 原创:272篇
    • 转载:64篇
    • 译文:4篇
    • 评论:44条
    最新评论