2007 Aug 23 4:09 AM
There are always some exceptions jump out when I called my smartforms from another program. It must because of the way I passed the parameter of a Interanl table because when I deleted it, this smartform ran well.
the following is the simple pragram.
&----
*& Report Z_PRACTICE_GUODD
*&
&----
*& practice how to use smart_form
*&
&----
REPORT Z_PRACTICE_GUODD.
TABLES: EKPO, EKKO.
TYPES: BEGIN OF ITAB,
EBELN LIKE EKPO-EBELN,
MATNR LIKE EKPO-MATNR,
AEDAT LIKE EKKO-AEDAT,
END OF ITAB.
*TYPES ITAB TYPE TABLE OF ITAB_LINE.
DATA: ITAB_TEMP_PRACTICE TYPE ITAB OCCURS 0 with header line.
DATA: P_ITAB TYPE ITAB OCCURS 0 with header line.
DATA: SMARTFORM(30) TYPE C.
DATA: FM_NAME TYPE RS38L_FNAM.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE T1.
SELECT-OPTIONS : S_EBELN FOR EKPO-EBELN no intervals no-extension.
SELECTION-SCREEN END OF BLOCK B1.
INITIALIZATION.
T1 = 'Machine Query Conditions'.
AT SELECTION-SCREEN.
SELECT AEBELN AMATNR B~AEDAT
INTO CORRESPONDING FIELDS OF TABLE ITAB_TEMP_PRACTICE
FROM EKPO as A
INNER JOIN EKKO as B ON AEBELN = BEBELN
WHERE A~EBELN = S_EBELN.
APPEND ITAB_TEMP_PRACTICE.
DATA: LINE TYPE I.
DESCRIBE TABLE ITAB_TEMP_PRACTICE LINES LINE.
DATA : JZRQ TYPE C.
SMARTFORM = 'Z_GUODD_SHEET2'.
IF LINE = 0.
STOP.
ELSE.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = SMARTFORM
IMPORTING
FM_NAME = FM_NAME
EXCEPTIONS
NO_FORM = 1
NO_FUNCTION_MODULE = 2
OTHERS = 3 .
TABLES
P_ITAB = ITAB_TEMP_PRACTICE
CALL FUNCTION FM_NAME
EXPORTING
P_JZRQ = JZRQ
TABLES:
P_ITAB = ITAB_TEMP_PRACTICE
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
ENDIF.
***********************end of the program*************************************************
In the smartforms, I made the following configuration.
Global definition ---> Types , I added
TYPES: BEGIN OF ITAB_LINE,
EBELN LIKE EKPO-EBELN,
MATNR LIKE EKPO-MATNR,
AEDAT LIKE EKKO-AEDAT,
END OF ITAB_LINE.
TYPES ITAB TYPE TABLE OF ITAB_LINE.
FORM INTERFACE -
> IMPORT , I SPECIFY
1 P_JZRQ type c
2 P_ITAB type ITAB
THE EXCEPTIONS ARE AS FOLLOWING:
one of the parameters needed according to the interface description was not specified. this parameter was "P_ITAB" .
please give me a hand, everybody.. ......cound't thank you more.
2007 Aug 23 4:49 AM
Hi,
1. Please write the select query at start of selection event.
2. 'SSF_FUNCTION_MODULE_NAME' is used to find the FM module. hence you should not use this module to call the smart form.
goto your smart form and press execute. you will get an FM name. (eg /1BCDWB/SF00000175)
Copy this FM name and goto ur report program and click on pattern and give this name and press ok.
you will get a list of import and export parameter. Now pass the input values to this FM.
Please test it and check if it works.
once its working then, delete the FM name (/1BCDWB/SF00000175) and give the variable name FM_NAME.
Regards,
Niyaz
*reward points if usefull
2007 Aug 23 4:49 AM
Hi,
1. Please write the select query at start of selection event.
2. 'SSF_FUNCTION_MODULE_NAME' is used to find the FM module. hence you should not use this module to call the smart form.
goto your smart form and press execute. you will get an FM name. (eg /1BCDWB/SF00000175)
Copy this FM name and goto ur report program and click on pattern and give this name and press ok.
you will get a list of import and export parameter. Now pass the input values to this FM.
Please test it and check if it works.
once its working then, delete the FM name (/1BCDWB/SF00000175) and give the variable name FM_NAME.
Regards,
Niyaz
*reward points if usefull
2007 Aug 23 5:30 AM
Hi Guo.
The Problem is You are defining the Internal Table in the Smartform under IMPORT parameters.
But while calling the Smartform FM you are passing it Under TABLES parameters.
So You have to Pass it Under IMPORT only.
To Avoid this kind of a Probelm always call this FM using the PATTERN button in ABAP Editor.
Make this Change .. It will work for u..
<b>Reward if Helpful</b>
2007 Aug 23 8:05 AM
hello, mate, I have passed it -
under IMPORT PARAMETERS LIKE THE FOLLOWING
but another exception jumped out.........
************************************
CALL FUNCTION FM_NAME
EXPORTING
P_JZRQ = JZRQ
P_ITAB = ITAB_TEMP_PRACTICE
EXCEPTIONS
FORMATTING_ERROR = 1
INTERNAL_ERROR = 2
SEND_ERROR = 3
USER_CANCELED = 4
OTHERS = 5.
ENDIF.
**********************************
the exception says that the fomal parameter "P_ITAB " can accept only fields of type "h", The field "P_ITAB" has the type "u".......
thank you all for your help. .....