2013 Apr 18 10:35 AM
Dear All,
I want to pass data from driver program to smart form.For that i have create program like this.....and in smartform i have created form interface like this..
Smart Form
Form interface
ITAB TYPE TABLE OF ZTEST
WA_ITAB TYPE ZTEST.
Driver Program
*&---------------------------------------------------------------------*
*& Report ZPO_DATA
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZPO_DATA.
TABLES : EKKO.
TYPES : BEGIN OF TY_EKKO,
EBELN TYPE EBELN,
AEDAT TYPE AEDAT,
LIFNR TYPE LIFNR,
END OF TY_EKKO.
DATA : IT_EKKO TYPE STANDARD TABLE OF TY_EKKO,
WA_EKKO TYPE TY_EKKO.
DATA : FM_NAME TYPE RS38L_FNAM.
SELECTION-SCREEN : BEGIN OF BLOCK V1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : EBELN FOR EKKO-EBELN.
SELECT-OPTIONS : AEDAT FOR EKKO-AEDAT.
SELECTION-SCREEN : END OF BLOCK V1.
PERFORM FETCH_PO_DATA.
PERFORM FETCH_SMARTFORM.
*&---------------------------------------------------------------------*
*& Form FETCH_SMARTFORM
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FETCH_SMARTFORM .
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZALTERNATIVE'
IMPORTING
FM_NAME = FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION FM_NAME
EXPORTING
ITAB = IT_EKKO
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.
ENDFORM. " FETCH_SMARTFORM
*&---------------------------------------------------------------------*
*& Form FETCH_PO_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FETCH_PO_DATA .
SELECT EBELN AEDAT LIFNR FROM EKKO INTO TABLE
IT_EKKO WHERE EBELN IN EBELN
AND AEDAT IN AEDAT.
ENDFORM. " FETCH_PO_DATA
But when i execute the program it terminates..Please suggest what to do?
Thanx
Vaneet
2013 Apr 18 11:21 AM
2013 Apr 18 12:56 PM
The function module interface allows you to specify only
fields of a particular type under "ITAB".
The field "IT_EKKO" specified here is a different
field type.....
2013 Apr 18 1:18 PM
Hi,
Create a table type of ztest in se11.
like zabcd ,then in form interface pass wa_itab type ztest .
pass itab type zabcd in tables tab (form interface).
Also read nick's reply carefully.
Thanks
Gourav.
2013 Apr 18 11:44 AM
I agree the error in the termination would help, but also what is the structure of ZTEST? If it is not the same as TY_EKKO in your program you're going to have problems. If it is the same structure you would be better defining IT_EKKO on ZTEST rather than defining a local type.
Regards,
Nick
2013 Apr 18 12:58 PM
I have the same structure but still it is showing me the below error...
The function module interface allows you to specify only
fields of a particular type under "ITAB".
The field "IT_EKKO" specified here is a different
field type
2013 Apr 18 12:06 PM
Hi Vaneet,
In the form interface try giving a table type rather than a table name.......i hope this will resolve your issue........
thanks and regards,
narayan
2013 Apr 18 1:44 PM
Hi,
READ IT ALL!!
in debugger you can see the function module name after calling FUNCTION 'SSF_FUNCTION_MODULE_NAME'. You can also edit/display you form and use menu environment - function module name.
Check the function in function builder (SE80 or SE37), in the Import tab look what the definition of ITAB is. Your parameter passed should be the same type. If you still work with standard tables with header line, then pass IT_EKKO[]. Square brackets mean you pass the table not the header line, a very common error we must live with.
Regards
Clemens
2013 Apr 18 3:40 PM
as it is defined ITAB in your smartforms?
DEFINE IN SE11 THE STRUCTURE WITH THIS FIELDS: (EXAMPLE ZSTRUCTURE)
EBELN TYPE EBELN,
AEDAT TYPE AEDAT,
LIFNR TYPE LIFNR,
after define in module interface
ITAB TYPE TABLE OF ZSTRUCTURE.
THIS STRUCTURE YOU CAN ALSO USE IT TO DEFINE IT_EKKO.