cancel
Showing results for 
Search instead for 
Did you mean: 

One Smartform - Multiple PERNRs - Output is Single PDF

Former Member
0 Kudos

Hi Gurus,

Scenario:

100 Employees receive Appraisals.

Out of which -

50 receive Bonus

30 receive Variable Pay

20 receive Other Incentives

The Forms for Bonus / variable pay and other incentives are different.

Smartform 1: Bonus

Smartform 2: Variable Pay

Smartform 3: Other Incentives

The output that i need is when the Form Generation Program is executed, i should be able to club into one Single PDF File for each

a. 50 PERNRs who receive bonuses with Smartform 1;

b. 30 Variable Pay PERNRs with Smartform 2; and

c. 20 Other Incentive PERNRs with Smartform 3.

Currently, when the Form Gen. program is executed, it is creating one smartform for one PERNR....thereby, creating 100 PDF files.....

Kindly help.

Kumarpal Jain.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Kumarpal,

It would be better if you combine the OTF output of all the smartforms into a single otf table and download that into a pdf file.

to combine the output from multiple smartforms into a single file check the below link, it has all the relevant data for you.

http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/62ae7fcd-0b01-0010-3e9d-a54f26944450&override...

using the method explained by the above url,

a. combine each output from all the 50 PERNRs who receive bonuses with Smartform 1 into one PDF file

b. combine each output from all the 30 Variable Pay PERNRs with Smartform 2 into second pdf file and

c. combine each output from all the 20 Other Incentive PERNRs with Smartform 3 into third one. or if you want all to be in a single PDF also u can achieve.

Former Member
0 Kudos

Can u tell me where is that i am going wrong in the below code...

FORM GETTOB .

WA_TAB-NSALARY1 = WA_TAB-NSALARY.

W_FILE_PATH = L_FNAME2.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

FORMNAME = P_FORM

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = PM_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 PM_NAME

EXPORTING

CONTROL_PARAMETERS = WG_CPARAM

OUTPUT_OPTIONS = WG_OUTOPTIONS

USER_SETTINGS = ' '

ANRED = WA_TAB-ATEXT

FNAME = WA_TAB-VORNA

SNAME = WA_TAB-NACHN

ACCOUNTNUMB = WA_TAB-PERNR

POSTXT = WA_TAB-PLSTX

COCTXT = WA_TAB-LTEXT

COSTCEN = WA_TAB-KOSTL

NSALARY = WA_TAB-NSALARY1

EDATE = WA_TAB-EDATE

IMPORTING

  • DOCUMENT_OUTPUT_INFO =

JOB_OUTPUT_INFO = T_OTF_FORM_FM1

  • JOB_OUTPUT_OPTIONS =

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.

CONCATENATE WA_TAB-PERNR'_TOB_'WA_TAB-BEGDA'_'WA_TAB-ENDDA'.pdf'

INTO W_FILE_NAME.

PERFORM PDF_CONVERSION.

ENDFORM. " gettob

FORM PDF_CONVERSION .

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

FORMAT = 'PDF'

MAX_LINEWIDTH = 132

IMPORTING

BIN_FILESIZE = W_BIN_FILESIZE

  • BIN_FILE =

TABLES

OTF = T_OTF_FORM_FM1-OTFDATA

LINES = T_PDF_TAB

EXCEPTIONS

ERR_MAX_LINEWIDTH = 1

ERR_FORMAT = 2

ERR_CONV_NOT_POSSIBLE = 3

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

CONCATENATE W_FILE_PATH'\'W_FILE_NAME INTO W_FILE_PATH.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

FILENAME = W_FILE_PATH

FILETYPE = 'BIN'

TABLES

DATA_TAB = T_PDF_TAB.

ENDFORM. " PDF_CONVERSION

Edited by: Kumarpal Jain on Sep 9, 2009 2:34 PM

Edited by: Kumarpal Jain on Sep 9, 2009 2:35 PM

Former Member
0 Kudos

Hi,

here you are not combining the otf tables for all the outputs.

for eg:

1. In the form getmerit, delete the otf table T_OTF_FORM_FM1 where T_OTF_FORM_FM1-otfdata tdprintcom = '//'. and append the table content T_OTF_FORM_FM1 into a final otf table say for eg.otf_final.

and after the loop insert otf_final table with the value tdprintcom = '//'. in the first and last line

then call the perform PDF_CONVERSION. this will give you single pdf for all the merit pernr, similarly do for other two cases.

hope this helps you.

Former Member
0 Kudos

Hi,

Any progress with this?

Former Member
0 Kudos

Not yet Venkatesh. I have sent you an email on your Ya-hoo ID.......can u check and reply......it would be great help.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Take all employees in one internal table like employees.

loop at employees.

if emp_typr = 'bonous'.

call smartform 1.

endif.

if emp_type = 'variabl pay'.

call smartform 2

endif.

if emp_type = 'Incentive'.

call smartform 3

endif.

endloop.

By this logic you can get the one pdf document.

Regards,

Jagadeesh.

jayanthi_jayaraman
Active Contributor
0 Kudos

Hi,

Design the form and then do the logic in the driver program for finding the employees receiving bonus, varaible pay and incentive and put it in 3 internal tables accordingly.

Pass the internal tables to smartform and then use loop/table to populate data in smartform.

Check this link.Here I am explaining how to pass select-option to smartform. You can follow the similar logic for passing internal table to smartform.

http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/abap/abap-code-samp...