现在的位置: 首页 > 综合 > 正文

abap little tips

2013年05月16日 ⁄ 综合 ⁄ 共 895字 ⁄ 字号 评论关闭

1.function中调用函数

写在function中的form调用觉得sap设计的不好,如果form里的参数是内表,一直没发现怎样声明变量类型比较好,如果在program中我用like,function中一般用type any table,或者再form中在声明一个变量类型为内表,在使用like去用它。如下:

DATA lt_zpp_002 LIKE STANDARD TABLE OF zpp_002.

此时再在form中使用

FORM frm_get_result  USING ut_save LIKE lt_zpp_002.

2.debug

4.6以后的系统debug的界面还是手段都进步很多!可以跟踪某个变量,某个语句,某个function,method,还可以跟踪某个变量到某个值的时候状态,如图,就是让l_index = 41的时候在让程序停止。

image

3.BKK_DOMAIN_TEXTS_READ中export的类型可以是table!

之前没注意到的一个东西,function中export类型可以是一个table。如下是代码:

type-pool bkkdc .

types:
begin of bkkdc_s_domain_text,
    key  type domvalue_l,
    text type ddtext,
  end of bkkdc_s_domain_text.

types:
   begin of bkkdc_s_decline_text,
     decline_key    type bkk_decline_key,
     decline_text   type bkk_decline_text,
  end of bkkdc_s_decline_text.

types:
   bkkdc_t_domain_text type standard table of bkkdc_s_domain_text,
   bkkdc_t_decline_text type standard table of bkkdc_s_decline_text.

放进了一个type-pool中,type-pool的创建在se11中如图:

image

或者输入TYPE-POOLS: NAME在双击name。

抱歉!评论已关闭.