ABAP:传递一些变量,但程序给出了错误 - 为什么?

时间:2014-03-21 16:12:58

标签: abap

**********the data that i am using************

DATA: BEGIN OF morada,

    gpart         LIKE fkkvkp-gpart,
    vkont         LIKE fkkvkp-vkont,
    vertrag       LIKE ever-vertrag,
    name1         TYPE c LENGTH 100,
    full_address  TYPE c LENGTH 255,
    address_1_1   TYPE c LENGTH 60,
    address_1_2   TYPE c LENGTH 60,
    address_1_3   TYPE c LENGTH 60,
    postal_code_1 TYPE c LENGTH 60,
    local_1       TYPE c LENGTH 60.

DATA END OF morada.

DATA: BEGIN OF istab,                                       "OCCURS 0,

*aninhamos as tabelas.

        color(4) TYPE c,
        gpart    TYPE fkkvkp-gpart,
        vkont    TYPE fkkvkp-vkont,
        vertrag  TYPE ever-vertrag,
        vkonto   TYPE ever-vkonto.

DATA END OF istab.

DATA:  itab     LIKE TABLE OF istab  WITH HEADER LINE,

      p_istab  LIKE TABLE OF istab  WITH HEADER LINE,

      p_morada LIKE TABLE OF morada WITH HEADER LINE.

然后在其他包括。

PERFORM map_data 
USING itab
CHANGING p_morada.

FORM map_data  USING    pt_istab  TYPE itab
               CHANGING pt_morada TYPE morada.

Endform

在形式上,他不会认识到'itab'既没有'输入morada' ...为什么

2 个答案:

答案 0 :(得分:3)

您正在使用DATA语句声明名为itabmorada变量。然后,您尝试使用USING … TYPE …添加来引用同名的数据类型。这不行。尝试查找TYPE的关键字文档,然后使用该文档而不是DATA

答案 1 :(得分:1)

我会投票给vwegert回答,但没有这样做的声誉。

下面键入代码,以及使用这些类型所需的数据和表单更改。你的命名约定也可以使用一些工作,但我会把它留给你!

 TYPES: BEGIN OF morada,
  gpart         LIKE fkkvkp-gpart,
  vkont         LIKE fkkvkp-vkont,
  vertrag       LIKE ever-vertrag,
  name1         TYPE c LENGTH 100,
  full_address  TYPE c LENGTH 255,
  address_1_1   TYPE c LENGTH 60,
  address_1_2   TYPE c LENGTH 60,
  address_1_3   TYPE c LENGTH 60,
  postal_code_1 TYPE c LENGTH 60,
  local_1       TYPE c LENGTH 60,
  END OF morada.

 TYPES: BEGIN OF istab,
      color(4) TYPE c,
      gpart    TYPE fkkvkp-gpart,
      vkont    TYPE fkkvkp-vkont,
      vertrag  TYPE ever-vertrag,
      vkonto   TYPE ever-vkonto,
  END OF istab.

 DATA:  itab TYPE TABLE OF istab,

   p_istab  TYPE TABLE OF istab,

   p_morada TYPE TABLE OF morada.


PERFORM map_data
USING itab
CHANGING p_morada.


 FORM map_data  USING    pt_itab
            CHANGING pt_morada.

 ENDFORM .