cancel
Showing results for 
Search instead for 
Did you mean: 

working with loop via smartforms

Former Member
0 Kudos

hi....

Im new to smartforms... and i need help regarding this matter.

currently im modifying a program via smartforms... in my drivers program i pass all the data that i need

in a data field. I have created a form and pass all the data inorder for me display it. My problem is it only display 1 entry but when u debug the drives program it contains multiply entry... how can i loop all the data in my smartforms so i can display all the data?

details:

I transfer all the data in Internal table LT_OUTTAB2 like this.

S_RMNTH = LT_OUTTAB2-RMNTH.

S_RYEAR = LT_OUTTAB2-RYEAR.

S_ISSDATE = LT_OUTTAB2-ISSDATE.

S_REC = LT_OUTTAB2-RECEIPT.

S_EECTB = LT_OUTTAB2-EECTB.

S_ERCTB = LT_OUTTAB2-ERCTB.

S_ECCTB = LT_OUTTAB2-ECCTB.

S_TOT = LT_OUTTAB2-TOTAL.

S_GTOT3 = S_TOT + S_GTOT3.

S_GTOT2 = S_ERCTB + S_GTOT2.

S_GTOT1 = S_EECTB + S_GTOT1.

then call the function name:

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'ZHRPYHPHRSBR0_V2'

IMPORTING

FM_NAME = FNAME.

IF SY-SUBRC EQ 0.

ENDIF.

CALL FUNCTION FNAME

EXPORTING

OUTPUT_OPTIONS = GS_SSFCOMPOP

S_TEXT1 = S_TEXT1

S_TXT = S_TXT

S_NAME = S_NAME

S_SSS = S_SSS

S_RYEAR = S_RYEAR

S_RMNTH = S_RMNTH

S_ISSDATE = S_ISSDATE

S_REC = S_REC

S_EECTB = S_EECTB

S_ERCTB = S_ERCTB

S_TOT = S_TOT

S_GTOT3 = S_GTOT3

S_GTOT2 = S_GTOT2

S_GTOT1 = S_GTOT1

S_ECCTB = S_ECCTB.

IF SY-SUBRC EQ 0.

ENDIF.

In my form I add LOOP in the Main Area of my Table... But i dont know what will be the next step...

please help

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi...

On the basis of info you have provided I guess you are heading to a serious mistake. Please fing the steps below that may rectify your SF.

Step1: Pass the internal table LT_OUTTAB2 from Driver Program to the SF interface as

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = 'ZHRPYHPHRSBR0_V2'

IMPORTING

FM_NAME = FNAME.

IF SY-SUBRC EQ 0.

ENDIF.

CALL FUNCTION FNAME

EXPORTING

OUTPUT_OPTIONS = GS_SSFCOMPOP

LT_OUTTAB2 = LT_OUTTAB2

IF SY-SUBRC EQ 0.

ENDIF.

*Note:You must also change the interface under the tab IMPORT in SF accordingly.

Step2: Now under Main area add a node called TABLE(you can do that by right click on the Main window).

Step3: Under the tab DATA of the TABLE node you can now loop on the internal table LT_OUTTAB2.

Step4:Do all the calculation logic in the PROGRAM LINES node with in the Table node.

Regards,

Dinker Bajpai

Former Member
0 Kudos

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = gv_formname "smartform name

IMPORTING

fm_name = gv_fname "fm name which automatically gets generated

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 gv_fname "fm name which automatically gets generated

EXPORTING

control_parameters = ga_ssfctrlop

output_options = ga_ssfcompop

user_settings = gv_user

g_vbeln = gv_vbeln "Quotation no

g_kschl = gv_kschl

IMPORTING

document_output_info = ga_document_output_info

job_output_info = ga_job_output_info

job_output_options = ga_job_output_options

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

in the above FM pass the table whatever you want to pass

smartforms.

in the mainarea create the loop

give the internal table name and the workarea name

then create the table line and add the text and fetch the data from workarea.

Former Member
0 Kudos

Hi,

Try this..

Loop at LT_OUTTAB2 into wa.

S_RMNTH = wa-RMNTH.

S_RYEAR = wa-RYEAR.

S_ISSDATE = wa-ISSDATE.

S_REC = wa-RECEIPT.

S_EECTB = wa-EECTB.

S_ERCTB = wa-ERCTB.

S_ECCTB = wa-ECCTB.

S_TOT = wa-TOTAL.

S_GTOT3 = S_TOT + S_GTOT3.

S_GTOT2 = S_ERCTB + S_GTOT2.

S_GTOT1 = S_EECTB + S_GTOT1.

endloop.

Regards,

Raghu

Answers (1)

Answers (1)

Former Member
0 Kudos

Pass the whole table to smartfor ...in the same way as you pass to function module see following eg.

CALL FUNCTION lf_fm_name

EXPORTING

archive_index = toa_dara

archive_parameters = arc_params

control_parameters = ls_control_param

mail_recipient = ls_recipient

mail_sender = ls_sender

output_options = ls_composer_param

user_settings = ' '

is_nast = nast

is_vbdka = vbdka

is_addres = addr_key

IMPORTING

document_output_info = document_output_info

job_output_info = job_output_info

job_output_options = job_output_options

TABLES

it_vbdpa = tvbdpa "Item information

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

In smartform go to global interface and declare you table ....similar to the way we do it in function modules. If you table is not standard table ...you might need to create a table type for the table delcration.

Where ever you have created the table in smartform. double click on table name -> DATA tab...there you will find the loop statement...just give your internal table name and work area. Now inside the main area define your columns that need to be printed by using &work area-fieldname&.