‎2006 Aug 23 12:39 PM
hi evrybody,
using the following code i need to fetch equipment number and display that in smartform.
if have to get multiple equipment numbers and display them in smartform the how i have to pass parameters in the from interface of smartform .
plz suggest me how to do this.
DATA:BEGIN OF GT_EQUI OCCURS 0,
EQUNR LIKE EQUI-EQUNR,
END OF GT_EQUI.
DATA:LF_FMNAME TYPE RS38L_FNAM VALUE '/1BCDWB/SF00000108'.
PARAMETERS: p_equnr TYPE equi-equnr
SELECT EQUNR
FROM EQUI
INTO TABLE GT_EQUI
WHERE EQUNR EQ p_EQUNR.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZSAMPLE1'
IMPORTING
FM_NAME = LF_FMNAME
regards
hridhayanjili
‎2006 Aug 23 12:42 PM
hi,
u have to declare <b>Table</b> in smartform. call
smartform FM in driver program you have to pass the table values. there using loop u can print.
check sample code ::
REPORT ZSMARTFORMS .
TABLES:MARA,MARC.
DATA:BEGIN OF ITAB OCCURS 2,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
END OF ITAB.
DATA:BEGIN OF IT_MARC OCCURS 2,
MATNR TYPE MARC-MATNR,
WERKS TYPE MARC-WERKS,
PSTAT TYPE MARC-PSTAT,
LVORM TYPE MARC-LVORM,
END OF IT_MARC.
DATA:BEGIN OF IT_FINAL OCCURS 0.
matnr type mara-matnr,
werks type marc-werks,
ersda type mara-ersda,
ernam type mara-ernam,
pstat type marc-pstat,
lvorm type marc-lvorm,
DATA:END OF IT_FINAL.
DATA : FNAME TYPE RS38L_FNAM .
SELECT-OPTIONS:S_MATNR FOR MARA-MATNR.
START-OF-SELECTION.
SELECT MATNR
ERSDA
ERNAM
INTO TABLE ITAB
FROM MARA
WHERE MATNR IN S_MATNR.
IF SY-SUBRC NE 0.
MESSAGE E001(ZZ) WITH 'No data'.
ENDIF.
IF NOT ITAB[] IS INITIAL.
SELECT MATNR
WERKS
PSTAT
LVORM
FROM MARC
INTO TABLE IT_MARC
FOR ALL ENTRIES IN ITAB
WHERE MATNR = ITAB-MATNR.
ENDIF.
CHECK IT_MARC[] IS NOT INITIAL.
LOOP AT IT_MARC.
READ TABLE ITAB WITH KEY MATNR = IT_MARC-MATNR.
IF SY-SUBRC = 0.
IT_FINAL-MATNR = ITAB-MATNR.
IT_FINAL-WERKS = IT_MARC-WERKS.
IT_FINAL-ERSDA = ITAB-ERSDA.
IT_FINAL-ERNAM = ITAB-ERNAM.
IT_FINAL-PSTAT = IT_MARC-PSTAT.
IT_FINAL-LVORM = IT_MARC-LVORM.
APPEND IT_FINAL.
CLEAR IT_FINAL.
ENDIF.
ENDLOOP.
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
FORMNAME = 'ZWARUN1'
* VARIANT = ' '
* DIRECT_CALL = ' '
IMPORTING
FM_NAME = FNAME
* 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 FNAME
* 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
<b> IT_FINAL = IT_FINAL</b>
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.Regards
Ashok P
Message was edited by: Ashok Parupalli
‎2006 Aug 23 1:27 PM
hi Ashok,
how to define the internal table in the fomr interface of the smartform.
this internal table contains only one field.
when i try to define this internal table in the form interface as follows
gt_eqi like equi.
if give it like above its showing runtime error.
my ijnternal table is gt_equi which contains the field fetching from table equi.
how to correct this error.
regards
hridhayanjili.
‎2006 Aug 23 12:43 PM
1) Go to se37 and give the generated function module name.
2) Note down what are the Importing /exporting/ tables parameters.
3) call that function module passing values that you have in your internal table
call function lf_fmname
exporting
i_val = value1
tables
it_item = gt_equi. "Assuming that the interface parameters are i_val and it_item
Regards,
ravi
‎2006 Aug 23 12:57 PM
In the smart form, there are global setitngs. There in the TABLE tab, specify your internal table you created in the program.
Thus you will get the data populated in the internal table in the smartform.