Skip to Content
0
Former Member
Jul 01, 2011 at 03:28 AM

Get z table data to internal table

95 Views

hi friends,

when i'm trying to get ztable data to an internal table and run the smartform it's giving a runtime error saying

"In the function module interface, you can specify only fields of a specific type and length under "ITAB".

Although the currently specified field "IT_ZPPR2" is the correct type, its length is incorrect."

here is my se38 code

REPORT  ZPPR_2.

TYPE-POOLS: SLIS.
TABLES : MAST, STPO, ZPPR2.

DATA ITAB LIKE ZPPR2 OCCURS 0 WITH HEADER LINE.

TYPES : BEGIN OF TY_FINAL,

  WERKS TYPE ZPPR2-WERKS, "PLANT
  MATNR TYPE ZPPR2-MATNR, "MATERIAL
  MENGE TYPE ZPPR2-MENGE, "QTY

END OF TY_FINAL.
DATA : IT_ZPPR2 TYPE TABLE OF TY_FINAL WITH HEADER LINE,
       WA_ZPPR2 TYPE TY_FINAL.


START-OF-SELECTION.

SELECT * FROM ZPPR2
  INTO CORRESPONDING FIELDS OF TABLE IT_ZPPR2.

CALL FUNCTION '/1BCDWB/SF00000081'
* EXPORTING
*   ARCHIVE_INDEX              =
*   ARCHIVE_INDEX_TAB          =
*   ARCHIVE_PARAMETERS         =
*   CONTROL_PARAMETERS         =
*   MAIL_APPL_OBJ              =
*   MAIL_RECIPIENT             =
*   MAIL_SENDER                =
*   OUTPUT_OPTIONS             =
*   USER_SETTINGS              = 'X'
* IMPORTING
*   DOCUMENT_OUTPUT_INFO       =
*   JOB_OUTPUT_INFO            =
*   JOB_OUTPUT_OPTIONS         =
  TABLES
    ITAB                       = IT_ZPPR2
* EXCEPTIONS
*   FORMATTING_ERROR           = 1
*   INTERNAL_ERROR             = 2
*   SEND_ERROR                 = 3
*   USER_CANCELED              = 4
*   OTHERS                     = 5
          .
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.