liangziyisheng的专栏

原创博文谢绝转载,浏览博文请给评,请自觉遵守本博主的规则。

Context对象

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.

阅读更多
文章标签: c header table
个人分类: 01 ABAP 基础
上一篇OPEN SQL 和 native sql技巧
下一篇ABAP 面向对象之继承
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭