2011 Jul 01 4:28 AM
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.
2011 Jul 01 4:32 AM
did you declare the ztable in smartforms? (if it is a driver program)
2011 Jul 01 4:33 AM
yes, like this
ITAB LIKE ZPPR2
under Tables tab in Form Interface
2011 Jul 01 5:17 AM
Hi,
In smartform you have declared as below,
yes, like this
ITAB LIKE ZPPR2
under Tables tab in Form InterfaceThen why in program,
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.declare IT_ZPPR2 same in program and smartform both.
declare in program as,
DATA : IT_ZPPR2 type table of ZPPR2 ,
WA_ZPPR2 TYPE zpr2.Hope above will solve your problem.
2011 Jul 01 5:25 AM
Hi,
IT_ZPPR2 TYPE TABLE OF TY_FINAL WITH HEADER LINE,
Although the currently specified field "IT_ZPPR2" is the correct type, its length is incorrect
As the error mentions that the length is incorrect, but the type is correct, try passing IT_ZPPR2[], as you have declared IT_ZPPR with header line without the brackets it would just be the header line that is being passed..
Regards,
Chen
2011 Jul 01 5:32 AM
Hi,
Does the table ZPPR2 have any extra fields other than the 3 in ty_final..( even MANDT )? In that case, this can cause an error.
Also when u pass the internal table to the Smartform you are now passing only the header line. It should be it_ppr2[].
Also to make sure the length is correct, declare it_ppr2 as
data: it_zppr2 type table of zppr2. and ZPPR2 structure can be assigned in the smartform too
Regards,
Suzie
Edited by: Suzie on Jul 1, 2011 10:03 AM