cancel
Showing results for 
Search instead for 
Did you mean: 

extracting data through fn module to smartforms

Former Member
0 Kudos

i am writing a select statement to extract the data from a table and that table i have to export to the smart form

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

HI,

Create a structure like the internal table which you are goin' to pass to smartfomrs.

In the Form Interface node, enter the structure name in the tables tab.

Since the tables tab is declared in the form interface, when you call the Smartforms function module you will have the option to pass the internal table to smartforms.

In the smartforms, you can use this table in a Loop..

Regards

Subramanian

Former Member
0 Kudos

in addition to Subramanian,

if u want to pass the internal table to smart form ... u have to create Table type..

1. first create structure..in se11 as smae structure as internal table which u want to pass example str u have created is ZSTRITAB

2. then create table type..---> goto se11 select radiobutton DATA TYPE then give zname i.e exaple ZTABITAB. then press Create button.

3.then in the screen Click on the Radio Button TABLE TYPE then press enter.

4.give discription>select the LINE TYPE> here enter the structure name ZSTRITAB(u have created in 1st step) then activete it.

use this as Subramanian said in the FORM INTERFACE of the Smartform TABLES tAb

Former Member
0 Kudos

See the following ex:

REPORT zfi_credit_note MESSAGE-ID 00.

*--- Table declaration

TABLES: bseg,

t001,

bkpf.

TYPES: BEGIN OF TY_DOC.

INCLUDE STRUCTURE ZFI_CREDIT_NOTE.

TYPES: END OF TY_DOC.

*--- Data declaration

DATA: t_ssfcrescl TYPE ssfcrescl,

t_ssfctrlop TYPE ssfctrlop,

g_subrc LIKE sy-subrc,

fname TYPE rs38l_fnam.

DATA: IT_DOC TYPE STANDARD TABLE OF TY_DOC WITH HEADER LINE.

----


  • SELECTION-SCREEN

----


SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

PARAMETERS: p_bukrs LIKE bkpf-bukrs OBLIGATORY.

SELECT-OPTIONS: S_belnr FOR bkpf-belnr OBLIGATORY MATCHCODE OBJECT fmcj_fi_reference_debi.

PARAMETERS: p_gjahr LIKE bkpf-gjahr OBLIGATORY.

SELECTION-SCREEN END OF BLOCK b1.

----


  • AT SELECTION-SCREEN

----


  • Validate Company code

AT SELECTION-SCREEN ON p_bukrs.

SELECT SINGLE * FROM t001 INTO t001

WHERE bukrs EQ p_bukrs.

IF sy-subrc NE 0.

MESSAGE e368 WITH text-003.

ENDIF.

  • Validate Document number

AT SELECTION-SCREEN ON S_belnr.

SELECT SINGLE * FROM BKPF INTO BKPF

WHERE bukrs EQ p_bukrs

AND belnr IN S_belnr

AND ( BLART = 'DG' or

BLART = 'ZN' ).

IF sy-subrc NE 0.

MESSAGE e368 WITH S_belnr ' ' text-002.

ENDIF.

  • Validate Fiscal year

AT SELECTION-SCREEN ON p_gjahr.

SELECT SINGLE * FROM bseg INTO bseg

WHERE gjahr EQ p_gjahr.

IF sy-subrc NE 0.

MESSAGE e368 WITH text-004.

ENDIF.

----


  • START-OF-SELECTION

----


START-OF-SELECTION.

SELECT BELNR FROM BKPF INTO CORRESPONDING FIELDS OF TABLE IT_DOC WHERE BELNR IN S_BELNR.

  • Call Smart form

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZCREDIT_NOTE'

IMPORTING

fm_name = fname

EXCEPTIONS

no_form = 1

no_function_module = 2

OTHERS = 3.

IF sy-subrc <> 0.

MOVE sy-subrc TO g_subrc.

CASE g_subrc.

WHEN 1.

MESSAGE e368 WITH 'No form exist'.

WHEN 2.

MESSAGE e368 WITH 'No Function Module'.

WHEN OTHERS.

" Do nothing.

ENDCASE.

EXIT.

ENDIF.

CALL FUNCTION fname

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

CONTROL_PARAMETERS = t_ssfctrlop

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

G_BUKRS = P_BUKRS

G_GJAHR = P_GJAHR

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

JOB_OUTPUT_INFO = t_ssfcrescl

  • JOB_OUTPUT_OPTIONS =

TABLES

IT_DOC = IT_DOC

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.