cancel
Showing results for 
Search instead for 
Did you mean: 

PASSING INTERNAL TABLE IN SMARTFORM

Former Member
0 Kudos

HI' I M NEW TO SMARTFORMS, MY PROBLEM IS =THAT

I'VE CREATED A NEW TYPE(SAY TY_BKPF) IN THE DRIVER PROGRAM.

THEN I'VE DECLARED AN INTERNAL TABLE OF THIS TYPE.

TO PASS THIS INTERNAL TABLE INTO MY SMARTFORM I'VE PASSED THE INTERNAL TABLE'S NAME INTO THE FUNCTION MODULE UNDER THE TABLES PARAMETER.

BUT I'M NOT ABLE TO UNDERSTAND AS TO WHAT TYPE SHOULD I GIVE IT IN THE FORM INTERFACE IN THE TABLES TAB.

PLZ HELP.

Accepted Solutions (0)

Answers (6)

Answers (6)

0 Kudos

Hi avoid  using tables option in smartforms/ subroutines, instead of create a new Custom structure& table in se11 or define the types whatever you want in global definitions in your  Smartform.

thangam_perumal
Contributor
0 Kudos

Hi Priya,

                have you resolved your problem or what? if you not solved mean use perform statement in smartforms and call to your driver program . it will fetch your internal table value to smart forms.

revert back still have any doubt.

Regards,

Thangam.P

Former Member
0 Kudos

Hi,

You need to remember that, You cannot pass locally created data types in your driver program to the smartform directly.

What you can do is,

Create a Z-structure globally via SE11 i.e. ZSTRUCT. Inside your driver program create an internal table of this type. You can easily pass this internal table now to your smartform. Inside your smartform declare the same internal table using IT TYPE TABLE OF ZSTRUCT.

OR

You must do the entire coding inside your smartforms. Just pass the unique fields like PO Number etc to your smartform.

Regards,

Danish.

Former Member
0 Kudos

Hi Danish,

I had tried in the same way as u suggested... but still I am getting error saying "Only table types may be used as the reference type for a table parameter". Please help.

Regards,

Kumudwini.

former_member758034
Participant
0 Kudos

Hi,

Make a structure in SE11 which is the same type as you table in your program. Use this in your type in the smartform.

The second way is to go to the types in your smart form and copy paste the type from your program here. You can then use this type when defining your table in global data or tables.

Hope this helps.

Edited by: krudra on Mar 5, 2012 7:42 AM

raguraman_c
Active Contributor
0 Kudos

Hi,

This is how you need to do.

Define table in smartforms

Global settings :

Form interface

Variable name Type assignment Reference type

ITAB1 TYPE Table Structure

Global definitions

Variable name Type assignment Reference type

ITAB2 TYPE Table Structure

Feel Free to revert back.

--Ragu

former_member215542
Active Participant
0 Kudos

Hi,

If its an internal table whose strucutre is not available in the ABAP dictionary. Then go to SE11 and create a structure for your internal table.

Use this structure in your driver program and the smartform.

I dont think there is any other way to tackle this issue.

Hope this helps.

Regards,

Pulkit

Former Member
0 Kudos

Define table in smartforms

Global settings :

Form interface

Variable name Type assignment Reference type

ITAB1 TYPE Table Structure

Global definitions

Variable name Type assignment Reference type

ITAB2 TYPE Table Structure

Also have a look at below sample code. It will give you idea abt the same.

REPORT ZSMARTFORM.

  • Calling SMARTFORMS from your ABAP program.

  • Collecting all the table data in your program, and pass once to SMARTFORMS

  • SMARTFORMS

  • Declare your table type in :-

  • Global Settings -> Form Interface

  • Global Definintions -> Global Data

  • Main Window -> Table -> DATA

TABLES: MKPF.

DATA: FM_NAME TYPE RS38L_FNAM.

DATA: BEGIN OF INT_MKPF OCCURS 0.

INCLUDE STRUCTURE MKPF.

DATA: END OF INT_MKPF.

SELECT-OPTIONS S_MBLNR FOR MKPF-MBLNR MEMORY ID 001.

SELECT * FROM MKPF WHERE MBLNR IN S_MBLNR.

MOVE-CORRESPONDING MKPF TO INT_MKPF.

APPEND INT_MKPF.

ENDSELECT.

  • At the end of your program.

  • Passing data to SMARTFORMS

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = 'ZSMARTFORM'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = FM_NAME

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3.

if sy-subrc <> 0.

WRITE: / 'ERROR 1'.

  • 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

  • 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

GS_MKPF = INT_MKPF

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.

Have a look at below link for more help on smart forms.

http://sap.ionelburlacu.ro/sap0/sapsf001.htm

http://help.sap.com/saphelp_erp2004/helpdata/en/a9/de6838abce021ae10000009b38f842/frameset.htm

I hope it helps.

Best Regards,

Vibha

*Please mark all the helpful answers