Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Coding In Driver program for smart forms.

former_member1716
Active Contributor
0 Likes
6,680

Hello Experts,

I have a following Requirement, So this is my smart form main window display(Enclosed in black rectangle).

This is the table to fill the line items for a particular contract document,Here the first three columns are taken from a table say VBRP, and 4th and 6th column are taken form the table say KONV and 5 th coloumn is multiplication of 3 and 4. Now am passing an internal table say GT_XXX(eg: it has five rows.) from driver program to the smartform which has a similar structured table say GT_YYY to fill the main window.

1) Can you please help me on the code that i can use in driver program.

2)Also how can i link that table in driver program to smartform.

25 REPLIES 25
Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
5,300

Hi satish

First of all create a staructure and its table type in SE11 for all the fields you want in output.

Then in your driver read data from VBRP, KONV table. LOOP at VBRP and combine data into output table which is of the type you created in SE11.

Call samrtform and pass it.

Nabheet

Read only

0 Likes
5,300

Hi nabheet,

Its all already done.

My question is when i code can i code like this,in driver program.

Lets assume i have got all values form the database table to an internal table like GT_VBRP and GT_KONV.

Loop at GT_vbrp into wa_vbrp.

wa_ita-posnr = wa_vbrp-posnr.

wa_itab-xxx = wa_vbrp-xxx.

append wa_itab into gt_itab.

endloop.

Loop at GT_konv into wa_konv.

wa_itab-posnr = wa_konv-posnr.

wa_itab-xxx = wa_konv-xxx.

append wa_itab into gt_itab.

endloop.

Now lets say my table has 5 entries. Now i have passe it to smartforms through interface. Now how will make this linked to the table that i created in main window could you please explain with images.

Read only

0 Likes
5,300

Hi,

In smartform , form interface - > table tab, declare your table gt_itab.

gt_itab type should be table type created in SE11. ( create structure and table type in SE11 for internal table).

Now in driver program, when you call function module to trigger smartform, you could pass the internal table gt_itab in table paramters.

Hope this is clear for you.

Best Regards,

Abirami

Read only

0 Likes
5,300

basically you main winow table will also loop on these internal table. there you can specify which table data you want to loop on

Read only

venkat_aileni
Contributor
0 Likes
5,300

Hi-

To link a table from driver program to Smart Form you need declare that table under Tables tab in Form Interface of smart form.

For displaying table contents: Create a table under Main Window and code according to your logic.

-Venkat

Read only

0 Likes
5,300

Hi Venkat,

I have already done as you told, My question how to link the internal from driver pgm to the table in smart form. Is there anything i have to do in  data tab of main window?

Read only

0 Likes
5,300

Hi-

In your driver program are you calling FM 'SSF_FUNCTION_MODULE_NAME' ? If not write logic something like below:

*---call smartforms function module

call function 'SSF_FUNCTION_MODULE_NAME'

   exporting

     formname                 = '<Your Form Name>'

   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

     p_aufnr                    = p_aufnr

     wa_aufk                    = wa_aufk

     wa_afko                    = wa_afko

   tables

     it_line                    it_line

  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.

Create a structure in SE11 with fields as in your final internal table.

Now in your Smart Form under Tables tab in Form Interface declare a internal table with associated type as your global structure created in SE11 for your final internal table.

-Venkat

Read only

0 Likes
5,300

Hi,

In main window, you could create table and in data tab, you can specify like this:

check the internal table check box and give:

GT_ITAB INTO GS_ITAB.

Now you can use GS_ITAB-field 1.... in text field to display.

Best Regards,

Abirami

Read only

0 Likes
5,299

Hi Satish,

To export the internal table data from driver program to smartform and display it use the below steps.

1) Pass the Internal table to the Smartform Interface as -

-> Here IT_PRINT_VBPLK is populated in driver and via a SE11 structure(Z8CCTY_VBPLK) i pass the internal table value to smartform.

2) Link the obtained table in 'data tab' of 'main window' as -

Please ask further if not clear.

BR.

Read only

0 Likes
5,299

Hi Ankit,

thanks for the information ,i was looking for this only, Thank you soo much let me do this and get back to you for any issues

Read only

0 Likes
5,299

Hi Ankit,

That solved my problem too... but will I be able to read the same in the header window? My requirement is something like this. Based upon the language key I need to print the text on form. And in the header form I need to get the customer number and overdue amount. Please help.

Thanks,

Kumudwini.

Read only

0 Likes
5,299

Hi Kumudwini,

Yes you can do your requirement. You have to create a logic and dynamically code for that.

Thanks,

Satish

Read only

0 Likes
5,299

Hi Satish,

Thanks for the inputs. But I had created a Z structure and passed 2 internal tables for both the languages to the samrtform and there I had put conditions and reading the header.

Regards,

Kumudwini.

Read only

0 Likes
5,299

Hi Kumudwini,

I think you have two internal tables, based on the language key you want the respective table to get triggered, If i understood your issue properly please do the below steps,

1)Assign some constant values like &constant& to the text elements.

2)For filling this constant use the desired internal table work area by using if condition as below,

if language key eq XX

constant = wa_internal_table_XXX.

elseif language key eq yy

constant = wa_internal_table_yyy..

endif.

Please revert if you have any issues.

Regards,

Satish

Read only

0 Likes
5,299

Hi Satish,

Thanks for the info. Will try it and let u know...

Regards,

Kumudwini.

Read only

sivaganesh_krishnan
Contributor
0 Likes
5,299

HI satish ,

First of all create a structure of the internal table that you are using in the se11 and then create a table type for that structure. Then open your smartform in the Form Interface -> under import table -> create a local internal table of type table type that has been created.

Then inside the main window , create a table -> draw a layout first and add the import parameters inside each cell .

Refer link to draw table in smartforms :http://scn.sap.com/message/3551682

Then inside the driver program write the SSF_Function_Module_name FM . refer the link

http://scn.sap.com/message/3915481

before writing the driver program , first activate the smartform and use the above FM to call the smartform. You can pass the internal table to the import parameter that u have created earlier.

Regards,

Sivaganesh

Read only

0 Likes
5,299

Hi siva,

Thanks for the reply i have already done all the steps that u told, My question is differnt, Please go through the my replies above to nabheet and venkat.

Read only

0 Likes
5,299

Hi satish,

Are u asking for how to connect the driver internal table to smartform internal table .. ? please be specific

if that is your question then , after you create a table in smartform double click on it ..

you can write the internal table name and the work area as mentioned in the box. then you could use it as

Regards,

Sivaganesh

Read only

0 Likes
5,299

Hi Siva,

Ya this is wat the information i was looking, Thank you soo much let me do this and get back to you for any issues

Read only

Former Member
0 Likes
5,299

Hi Satish ,

Step 1. create a structure and table type based to the fields you need to fill in the smart form table

step 2 . Declare an internal table inside the form interface ,type has to be the table type created by you.

step 3 . Inside global definition of the  smartform declare the workarea for the already declared internal                table

Step4  :create a report program and fetch all the neccessary data into the internal table .

step5  :Execute smartform ,at that time you wil get a function module name,copy the function name

step6   : call that function name inside the report program using the call function .

Step7 : execute the report program .

Read only

0 Likes
5,299

Hi Junned,

Thanks for the reply i have already done all the steps that u told, My question is differnt, Please go through the my replies above to nabheet and venkat.

Read only

Former Member
0 Likes
5,299

Hi,

1. Declare table type in SE11 with all required fields(vbrp and konv)

2. Declare internal table with reference to Table type in driver program and smart form.

3. Populate internal table data from VBRP and KONV

4. pass the internal table to smartform table parameters

5. create table in main window in smartform

6. use table loop to process all fields.

The link between VBRK/VBRP and KONV:

vbrk-knumv = konv-knumv

and pass condition type to konv-kschl

Read only

VijayCR
Active Contributor
0 Likes
5,299

Hello Satish,

Pass the import parameters to the smart form and then pass the same in the print program for ssf function module.

Thanks,

Vijay.

Read only

0 Likes
5,299

Hi Vijay,

I had done this already, had few doubts in data tab of the table. Now i got that too from few experts, let me try that and get back for any issues.

Read only

rosenberg_eitan
Active Contributor
0 Likes
5,299

Hi,

Have a look at:

Container class to define the deep structure (Instead of SE11)
http://scn.sap.com/community/abap/blog/2013/10/09/deeper-dive-into-deep-structure

Printing using SmartForm
http://scn.sap.com/community/abap/blog/2013/10/22/deeper-dive-into-deep-structure--part-3

This blog entries demonstrate a technic that allow you to create complex hierarchical data elements.

If I understand correctly this is the case at hand.

Regards.