cancel
Showing results for 
Search instead for 
Did you mean: 

working with loop in smartforms

Former Member
0 Kudos

hi...

what i did is i gather all the data in my drivers program then pass it to smartforms. now what i want to do is add LOOP in my smartform. but i dont know how to do it since i did not create the logic in smartform but in my drivers program.

please help me...

Part of my drivers program where i gather all the data then pass it to smartforms:

IF P_CTYP EQ 'SS'.

LOOP AT GT_OUTTAB INTO GS_OUTTAB .

GV_TABIX = SY-TABIX.

MOVE-CORRESPONDING GS_OUTTAB TO LT_OUTTAB2.

APPEND LT_OUTTAB2.

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.

SELECT SNAME INTO S_NAME FROM PA0001

WHERE PERNR = LT_OUTTAB2-PERNR.

ENDSELECT.

SELECT SSSNO INTO S_SSS FROM PA0422

WHERE PERNR = LT_OUTTAB2-PERNR.

ENDSELECT.

IF P_CTYP = 'SS'.

S_TEXT1 = 'CERTIFICATE OF SSS PREMIUM CONTRIBUTION'.

S_TXT = 'SSS# :'.

ENDIF.

AT END OF PERNR.

GV_PERNR = GS_OUTTAB-PERNR.

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.

IF SY-SUBRC EQ 0.

ENDIF.

ENDAT.

ENDLOOP.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

very honestly i did not get ur question..... u have done all of ur logic in driver program is fine...no issues.....

but what do you mean by that you cannot creta a loop in smartform.....

see you must have gathered all your data into an internal table.....

within the smartform you define a table and add your internal table name in the data section of the table...you would also need a work arrea...define line type etc.....you dont need to create a loop statement manually...

Former Member
0 Kudos

hi...

sorry it seems my query confuse you....

what i mean in my query is... i created a drivers program that display employees contributions example loan payment via smartforms. in order for me to generate smartform display i pass all the data in itab 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 i call CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'.

But when i execute the program i only generate 1 data entry thats why i need to add LOOP in my smartform in case i have gather multiply entry in order for me to display them all.

Former Member
0 Kudos

Hi,

You have to use tables options in the smartform there you can loop on the internal table into a workarea and then write the details using workarea.

You van create a table in the smartform by left clicking on the hierchy and choosing to create a table. I would suggest you should some more about how to use tables in smartform before you start your changes.

Regards,

Himanshu

Answers (0)