cancel
Showing results for 
Search instead for 
Did you mean: 

How to create smartforms by passing data from internal table thru s38

UmaArjunan
Active Participant
0 Kudos

In se38

select matnr mtart from mara into table it_mara.

I have two field values populated in the internal table.

I want to use smart forms and to display the table.

Please wat are all the settings to be done in the smartforms for these two fields from the internal table.

help me witthe the sample codes

thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

This is the sample code.

Here I am displaying it_ekpo and It_ekko data.

Instead of that, you can use it_mara table.

In the smart form,

you need to define the internal table in the form interface as IMPORT parameter.

In the text editor, you can display that internal table fields.

REPORT z50871mm_smartform.

----


  • INTERNAL TABLE DECLARATIONS

  • WORKAREA DECLARATIONS

----


DATA : it_ekpo TYPE z50871_ekpo_t.

DATA : wa_ekko TYPE z50871_ekko_s,

wa_lfa1 TYPE z50871_lfa1_s.

*Variable Declarations

DATA : v_funcname TYPE rs38l_fnam, "Function Module Name

v_ebeln TYPE ebeln. "Purchase Document Number

----


  • SELECTION-SCREEN

----


SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE tit1.

PARAMETERS : p_ebeln TYPE ekko-ebeln OBLIGATORY.

SELECTION-SCREEN END OF BLOCK b1.

----


  • INITIALIZATION

----


INITIALIZATION.

tit1 = text-001.

----


  • AT SELECTION-SCREEN

----


AT SELECTION-SCREEN ON p_ebeln.

PERFORM validate_ebeln.

----


  • START-OF-SELECTION

----


START-OF-SELECTION.

PERFORM get_headerdata.

PERFORM get_itemdata.

PERFORM get_vendordata.

PERFORM call_smartform.

&----


*& Form get_headerdata

&----


FORM get_headerdata.

SELECT SINGLE ebeln bstyp bsart aedat ernam

INTO wa_ekko

FROM ekko

WHERE ebeln = p_ebeln.

ENDFORM. "get_headerdata

&----


*& Form get_vendordata

&----


FORM get_vendordata.

SELECT SINGLE lflifnr lfname1 lfort01 lfland1 lf~adrnr

INTO wa_lfa1

FROM lfa1 AS lf INNER JOIN ekko AS ek

ON lflifnr = eklifnr

WHERE ek~ebeln = p_ebeln.

ENDFORM. "get_vendordata

&----


*& Form get_itemdata

&----


FORM get_itemdata.

SELECT ebelp ematn matkl netpr

INTO TABLE it_ekpo

FROM ekpo

WHERE ebeln = p_ebeln.

ENDFORM. "get_itemdata

&----


*& Form validate_ebeln

&----


FORM validate_ebeln.

SELECT SINGLE ebeln

FROM ekko

INTO v_ebeln

WHERE ebeln = p_ebeln.

IF sy-subrc NE 0.

MESSAGE e020(z50871msg) WITH 'Purchase Document Number Is Invalid'(002).

EXIT.

ENDIF.

ENDFORM. "VALIDATE_EBELN

&----


*& Form CALL_SMARTFORM

&----


FORM call_smartform.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'Z50871MM_SMARTFORM'

IMPORTING

fm_name = v_funcname

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.

****/1BCDWB/SF00000721

CALL FUNCTION v_funcname

EXPORTING

wa_lfa1 = wa_lfa1

wa_ekko = wa_ekko

TABLES

it_ekpo = it_ekpo[]

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. "CALL_SMARTFORM

Regards

Sandeep reddy

UmaArjunan
Active Participant
0 Kudos

The issue is,

I retrieve the data from the function moudle based upon various condittions in the sleelctioin criterira and finally i populate in the internal table.

Now i want to display the internal table data in the smartform with some borders similar to the table format. I need to put the data in the page at different places

and finally i convert it into pdf format. thi is my requirement..

say

Product No: Address:

Description : City:

etc..

as far as the code which is given it will be helful for passsing the data into the function module.

But i need a clear understanding, and what are all the things i have to declare in smart form is a big question mark. I m not clear in that.

Please help me about the connectivity of smartform to abap

all the examples in the net are related to declaring the table name exactly in the smartform. In my case i hv not used any specific table. Datas are collectively stored in an internal table.

which is having specific structure defined in the program

Kindly help me out

my id auma.official at gmail dot com

Thanks

Former Member
0 Kudos

I will develop a sample smartform of your requirement and send it. ill let u no once im done.

Swetha

Former Member
0 Kudos

good day. As I read this thread, you are still puzzled and confused with your question raised herein.

So before anything else, i would like to RESTATE your question for me to have the correct understanding regarding on your problem on the connection of smartforms and ABAP (passing of data from internal table [ABAP] to smartform).

So here are your Questions:

A. From the Application Program (ABAP side)

1. How to "EXPORT" the data/records stored on the internal tables based on different criterias on the application program(abap) to the smartform?

note: "EXPORT" means to transfer the record FROM the internal table of the application program TO the smartform.

B. From the Smartform

2. How to display the records "IMPORTED" from the application program(ABAP)?

3. What are the things to set/configure on the smartforms for you to display the records?

note: "IMPORT" means to retrieve the records FROM the internal table of the application program TO the smartform.

Please reply if these three(3) questions I restate here are your QUESTIONS...

UmaArjunan
Active Participant
0 Kudos

datas are in internal table collected from function module based on various condtions, the final output structure is different from the one which is defined in DDIc

say my final output strucuture

types : Begin of st_out,

prod_no type OBJECT_ID,

description TYPE TXZ01,

item_no type bbp-_item_no,

quantity type bbp_mng,

....

end of st_out,

data: it_out type table of st_out,

wa_out like line of st_out.

now my datas are in the internal table it_out

which is of structure st_out

Now i need to pass this internal table to the smart forms

wat are all the things i need to decalre it in smartforms

say under

Form Interface.

Import tab.

ParmeterName Type assignment Associated_type

it_out type ????

Export

ParmeterName Type assignment Associated_type

? ?

Under Global Definitions,

Global Data

UmaArjunan
Active Participant
0 Kudos

Yes . the three questions are correct. I dont know how to give the settings in Smartforms.

I know how to make refrenece to tables(DDIC) and not to the internal table

Thanks

christine_evans
Active Contributor
0 Kudos

>

> I know how to make refrenece to tables(DDIC) and not to the internal table

If you know how to do what you want using a Data Dictionary table type, then why not do that? When you are dealing with a function module interface, which is the case when calling a SmartForm, it is always better to declare a single structure in the DDic and use it in both the calling and the called programs.

It might be a good idea for you to read the SmartForms help on http://help.sap.com eg http://help.sap.com/saphelp_47x200/helpdata/en/9b/e3b0dcc2a711d3b558006094192fe3/frameset.htm

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi,

first you have to create a structure in your data dictionary which contains your tow columns.

define an internal table of that structure using ( table type ). then pass the internal table with the same fields from program. then it is available in ur smart form.

based on that if u wants to do some calculations u can define variables or write code in global definitions.

use table for display your table values in a window.

Former Member
0 Kudos

Hi

Please Check your id.

Thankyou

Swetha.

UmaArjunan
Active Participant
0 Kudos

hi swetha,

I have received your screen shots in my gmail account,the same id. thank you for your effort. i will try with your scrren shot and and i wiill come back if there is any doubts further

I will reward as useful answer.

Once my problem is solved again i ll never forge tto reward u points

Thanks

Former Member
0 Kudos

Already entire code is provided by two guys.....

Since in SE38 u have two fields and both are from MARA table.

In Smartform, u define a table in FORM Interface tab like:

IT_MATA TYPE MARA.

The values will be passed to smartform's internal table using the Fun Mod given ...

Now if you want to print these values on smartform, use the concept of LOOP in table and print the same..

UmaArjunan
Active Participant
0 Kudos

In form interface there are many tabs import export and tables and exception where i have to define it could u explain more clearly wat are all the things to be carried out in smartforms

Former Member
0 Kudos

Hi ,

In import parameter u need to define your variables.

Don worry please give me appropriate id i shall send them.

Swetha

Former Member
0 Kudos

Follow this code and steps ull understand how to proceed.

this is a example code.

select mandt

carrid

connid

fldate

price

into table i_sflight

from sflight.

data: V_FUNCTION type TDSFNAME,

wa_param type ssfctrlop,

wa_otf type ssfcrescl,

i_otfdata type table of itcoo,

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'Zpractice'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = v_FUNCTION

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.

*-- managing print parameters for the PDF output

wa_param-langu = sy-langu.

wa_param-no_dialog = 'X'.

wa_param-getotf = 'X'.

  • call generated function module.

CALL FUNCTION C_FUNCTION

EXPORTING

sflight = i_sflight

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.

refresh i_otfdata.

i_otfdata[] = wa_otf-otfdata[].

*To get PDF Output

call function 'SSFCOMP_PDF_PREVIEW'

EXPORTING

i_otf = i_otfdata

EXCEPTIONS

CONVERT_OTF_TO_PDF_ERROR = 1

CNTL_ERROR = 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.

Now in your program jus change field names that must be displayed.

In smartforms

1)goto form attributes and set your output options

page format usually DINA4

2)goto form interface and set

parameter name:sflight

type: type

associated type: filghttab

3)in global data set wa_fight type sfilght.

4)Create a page

5) create a template and pass those fields in respective cells

Hope this is clear

Regards

Swetha

Former Member
0 Kudos

hi,

after fetching the data into the internal table.

go to smartform and define an internal table in form interface of that type.

now define a table in the main window and spilt it into required number of cells.

in each cell define a text and in that text define the field that u want to display the data.

by this way ucan display the data.

before that u need to define the sample code as like this.

TABLES : MARA .

DATA : INT_MARA LIKE STANDARD TABLE OF MARA.

DATA : W_NAME(14) TYPE C .

SELECT MATNR MEINS MTART FROM MARA INTO

CORRESPONDING FIELDS OF TABLE INT_MARA UP TO 5 ROWS .

W_NAME = 'SMARTFORM EX'.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'your form name'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

  • IMPORTING

  • 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 '/1BCDWB/SF00000020'

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

  • CONTROL_PARAMETERS =

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

NAME = W_NAME

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

TABLES

INT_MARA = INT_MARA

  • 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.

i hope it will help u

reward me if helpful.

UmaArjunan
Active Participant
0 Kudos

Could you please point out and where wat exactly in the smartforms the tables are declared. give me step by step details and as well as the information..

Sure i will reward points for you both

Former Member
0 Kudos

Hi,

I have taken snapshots for answering u step by step but i am not able to attach them here.

send me ur id ill attach it so that it would be clear.

Regards

Swetha

UmaArjunan
Active Participant
0 Kudos

auma.official at gmail dot com is my id

Former Member
0 Kudos

Meanwhile jus follow this

Give your variable that u have to use in smartform to dispaly here

goto form interface your parameter name will be say v_sample

type say type and associated type will be your table from which extraction carried out.

and in global defination

Incase u want to give any variable inside smartform u give it here.

so if u are creating a template or table in your main window then there u click insert field( one with + icon) &v_sample-matnr&(any field name that u extract)

This inserts field. Now when u activate your form and run your interface se38 program u can actually see output in pdf.

Hope this is clear. Let me no if u need more help please provide ur id.

Regards

Swetha

Former Member
0 Kudos

Hi,

I am receiving failure notice while sending them Please provide any other id.

Sorry

Swetha.