cancel
Showing results for 
Search instead for 
Did you mean: 

Smartform to PDF file format

Former Member
0 Kudos

Hi All,

i have a requirement to convert the smartform into a PDF file.

So far this is what I have

w_cparam-no_dialog = 'X'.

W_CPARAM-PREVIEW = SPACE. "

W_CPARAM-GETOTF = 'X'.

w_outoptions-tddest = 'LP01'.

CALL FUNCTION W_FMODULE

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

CONTROL_PARAMETERS = W_CPARAM

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

OUTPUT_OPTIONS = W_OUTOPTIONS

  • USER_SETTINGS = 'X'

IMPORTING

  • DOCUMENT_OUTPUT_INFO =

JOB_OUTPUT_INFO = T_OTF_FROM_FM

  • JOB_OUTPUT_OPTIONS =

TABLES

TBL_AMT = FINAL_TAB

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

USER_CANCELED = 4

OTHERS = 5

and then i have the convert OTF func module and GUI download to download the pdf.

The smartform is getting downloaded in pdf format BUT

i want to be able to do a print preview also. With the code above, I am not able to do it.

i am also unable to print the smartform. When the print screen popup comes up, i hit the print button but immediately, the file dialog box came up and asked me for the destination of the file.

The only way I am able to print is by opening the pdf file and hitting the print button.

Cn you please suggest me some modifications so as to be able to get a print preview and print option.

Thanks!

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

when you give for printing prit preview will not available, And when you give for print preview you will not get spool n umber and you can't down,lolad the attachment. If you want to see the preview when you give for printing then agian call the FM immediately after downloded the form by passing print preview = 'X' and W_CPARAM-GETOTF = ' '..

Reward points if useful.

Regards,

Nageswar

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Suresh,

This is what i have so far (modified ur code a little bit).

I am gettign the pop-up with the adobe acrobat reader and I can see a preview window inside, but it is empty. the smartform is not appearing inside the preview window.

Can you please suggest an alternative?

gst_output_options-tddest = 'FRNT_End_Print'. "Frontend printer

gst_output_options-tdnewid = sy-prnew.

gst_output_options-tdimmed = 'X'.

gst_output_options-tddelete = sy-prrel.

clear gst_control_parameters.

gst_control_parameters-no_dialog = 'X'.

gst_control_parameters-getotf = 'X'.

gst_control_parameters-preview = 'X'. "Deactivate preview!

*Call the original function module.

call function w_fmodule

exporting

control_parameters = gst_control_parameters

output_options = gst_output_options

importing

job_output_info = gt_job_output_info

job_output_options = gt_output_options

tables

tbl_amt = final_tab

exceptions

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4.

if sy-subrc ne 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

call function 'SSFCOMP_PDF_PREVIEW'

exporting

i_otf = gt_job_output_info-otfdata

exceptions

convert_otf_to_pdf_error = 1

cntl_error = 2

others = 3.

if sy-subrc ne 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

Former Member
0 Kudos

Thanks for the replies guys. i have awarded points to Bhupal and Nageswar.

however, I would still like to know if there is a way to print/print preview and download at the same time, without using the radiobuttons, which would be hassle free.

Thanks!

Sandeep

Edited by: sandeep reddy on Mar 26, 2008 8:21 PM

Former Member
0 Kudos

Hi Sandeep

Look This program it will help view normal and aswell as PDF display .in Pdf display ucan save/ download form into ur drive...

if u have doubts reply me . if it useful reward me .

report zpsr3m_invoice_coversheet no standard page heading

message-id zps.

- -


tables: proj,

prps,

vbrk,

vbrp,

bseg,

likp,

pa0105,

pa0002,

t001,

adrc,

konv,

tvzbt.

-{ Type Definitions } -


types: begin of typ_prps,

pspnr like prps-pspnr,

end of typ_prps,

begin of typ_aufnr,

aufnr like afko-aufnr,

end of typ_aufnr,

begin of typ_vbeln,

vbeln like vbrk-vbeln,

end of typ_vbeln,

begin of typ_konv,

knumv like konv-knumv,

kposn like konv-kposn,

kwert like konv-kwert,

end of typ_konv.

-{ Internal Tables } -


data: gt_invitems like standard table of zpss_rrbinv_items

with header line,

gt_pspnr type standard table of typ_prps

with header line,

gt_aufnr type standard table of typ_aufnr

with header line,

gt_vbeln type standard table of typ_vbeln

with header line,

gt_konv type standard table of typ_konv

with header line.

data: gt_mess_att like solisti1 occurs 0 with header line.

-{ Work Areas } -


data: gst_invheader like zpss_rrbinv_header,

begin of gwa_bseg,

bukrs like bseg-bukrs,

belnr like bseg-belnr,

gjahr like bseg-gjahr,

txdat like bseg-txdat,

filkd like bseg-filkd,

end of gwa_bseg.

data: gst_control_parameters type ssfctrlop,

gst_output_options type ssfcompop,

gt_job_output_info type ssfcrescl,

gt_output_options type ssfcresop.

- -


constants: gc_formname type tdsfname value 'ZPS_INVOICE_COVERSHEET1',

gc_usrty like pa0105-usrty value '0001'.

- -


data: gv_fm_name type rs38l_fnam,

gv_pernr like pa0105-pernr,

gv_uname like sy-uname.

- -


ranges: gr_pspnr for prps-pspnr,

gr_aufnr for afko-aufnr.

-{ Selection - Screen } -


selection-screen begin of block blk1 with frame title text-001.

parameters: gp_pspid like proj-pspid memory id psp,

gp_vbeln like vbrk-vbeln.

selection-screen end of block blk1.

selection-screen begin of block blk2 with frame title text-002.

parameters: gp_layut type tdsfname , "LIKE vbrp-arktx , "DEVK933900

gp_logo like rstxt-tdname default 'RRB_KBR_COLOR' .

selection-screen end of block blk2.

selection-screen begin of block blk3 with frame title text-009.

parameters: gp_norm radiobutton group r1 default 'X',

gp_pdf radiobutton group r1 .

selection-screen end of block blk3.

-{AT SELECTION-SCREEN } -


at selection-screen on gp_pspid.

if gp_pspid is not initial.

perform f_validate_project.

  • ELSE.

  • MESSAGE E000 WITH

  • 'Enter any Project definition...'(006).

endif.

at selection-screen on gp_vbeln.

if gp_vbeln is not initial.

perform f_validate_billing_doc.

else.

message e000 with

'Enter Invoice Number.....'(005).

endif.

at selection-screen output.

gp_pspid = gp_pspid.

at selection-screen on value-request for gp_logo.

perform f_get_logo changing gp_logo.

at selection-screen on value-request for gp_vbeln.

perform f_get_invoice changing gp_vbeln.

-{ START-OF-SELECTION } -


start-of-selection.

  • Get the other data for the form.

perform f_get_other_invoice_details.

  • Call the SMART FORM to print the invoice.

perform f_print_invoice_covsheet.

&----


*& Form F_GET_LOGO

&----


  • To get the Invoice LOGO to print in the SMART FORMS

----


  • <--EV_LOGO text

----


form f_get_logo changing ev_logo.

ev_logo = 'RRB_KBR_COLOR'.

endform. " F_GET_LOGO

&----


*& Form F_VALIDATE_PROJECT

&----


  • To validate the project definition entered

----


form f_validate_project .

select single *

from proj

where pspid = gp_pspid.

if sy-subrc ne 0.

message e000 with

'Project definition not found..........'(003).

endif.

endform. " F_VALIDATE_PROJECT

&----


*& Form f_validate_billing_doc

&----


  • To validate the Billing document

----


form f_validate_billing_doc .

  • Get all the project elements

perform f_get_project_data.

if gp_pspid is not initial.

if gr_pspnr[] is not initial or

gr_aufnr[] is not initial.

  • Check the billing document is from the current project only.

select mvgr1 mvgr2 mvgr3 mvgr4 mvgr5 matnr arktx vbeln posnr netwr

vrkme

into table gt_invitems

from vbrp

where vbeln eq gp_vbeln

and ( ps_psp_pnr in gr_pspnr or

aufnr in gr_aufnr ).

if sy-subrc eq 0.

select single vbeln bstnk_vf zterm stceg

bukrs waerk belnr gjahr

ernam knumv kunrg fkdat

into (gst_invheader-vbeln,

gst_invheader-bstnk_vf,

gst_invheader-zterm,

gst_invheader-stceg,

gwa_bseg-bukrs,

gst_invheader-waerk,

gwa_bseg-belnr,

gwa_bseg-gjahr,

vbrk-ernam,

vbrk-knumv,

gst_invheader-kunrg,

vbrk-fkdat)

from vbrk

where vbeln = gp_vbeln.

else.

message e037 with gp_pspid.

  • Invoice does not belong to any WBS/Netowrk of the project:

endif.

endif.

else.

select single vbeln bstnk_vf zterm stceg

bukrs waerk belnr gjahr

ernam knumv kunrg fkdat

into (gst_invheader-vbeln,

gst_invheader-bstnk_vf,

gst_invheader-zterm,

gst_invheader-stceg,

gwa_bseg-bukrs,

gst_invheader-waerk,

gwa_bseg-belnr,

gwa_bseg-gjahr,

vbrk-ernam,

vbrk-knumv,

gst_invheader-kunrg,

vbrk-fkdat)

from vbrk

where vbeln = gp_vbeln.

endif.

endform. " f_validate_billing_doc

&----


*& Form f_get_project_data

&----


  • text

----


form f_get_project_data .

clear: gt_pspnr, gt_pspnr[],

gt_aufnr, gt_aufnr[],

gr_pspnr, gr_pspnr[],

gr_aufnr, gr_aufnr[].

  • Get the project

if gp_pspid is initial.

get parameter id 'PSP' field gp_pspid.

endif.

check gp_pspid is not initial.

select single *

from proj

where pspid = gp_pspid.

  • First get all the wbs elements of the project

select pspnr

into table gt_pspnr

from prps

where psphi = proj-pspnr.

if sy-subrc eq 0.

loop at gt_pspnr.

gr_pspnr-sign = 'I'.

gr_pspnr-option = 'EQ'.

gr_pspnr-low = gt_pspnr-pspnr.

append gr_pspnr.

endloop.

endif.

  • Get all the networks.

select distinct aufnr

into table gt_aufnr

from caufv

where pronr eq proj-pspnr.

if sy-subrc eq 0.

loop at gt_aufnr.

gr_aufnr-sign = 'I'.

gr_aufnr-option = 'EQ'.

gr_aufnr-low = gt_aufnr-aufnr.

append gr_aufnr.

endloop.

endif.

endform. " f_get_project_data

&----


*& Form f_get_invoice

&----


  • text

----


  • <--EV_VBELN text

----


form f_get_invoice changing ev_vbeln.

data: lv_fieldname like help_info-fieldname,

lv_tabname like help_info-tabname,

lv_value like help_info-fldvalue,

lv_index like sy-tabix.

data: lt_fields like help_value occurs 0 with header line,

lt_dynpread like dynpread occurs 0 with header line.

lt_dynpread-fieldname = 'GP_PSPID'.

append lt_dynpread.

  • Read the screen input first.

call function 'DYNP_VALUES_READ'

exporting

dyname = sy-repid

dynumb = sy-dynnr

tables

dynpfields = lt_dynpread

exceptions

invalid_abapworkarea = 1

invalid_dynprofield = 2

invalid_dynproname = 3

invalid_dynpronummer = 4

invalid_request = 5

no_fielddescription = 6

invalid_parameter = 7

undefind_error = 8

double_conversion = 9

stepl_not_found = 10

others = 11.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

else.

read table lt_dynpread with key fieldname = 'GP_PSPID'.

if sy-subrc eq 0.

gp_pspid = lt_dynpread-fieldvalue.

endif.

endif.

if gp_pspid is not initial.

  • Get the project data first

perform f_get_project_data.

  • Get the invoice list now.

if gr_pspnr[] is not initial.

select distinct vbeln

into table gt_vbeln

from vbrp

where ps_psp_pnr in gr_pspnr.

endif.

if gr_aufnr[] is not initial.

select distinct vbeln

appending table gt_vbeln

from vbrp

where aufnr in gr_aufnr .

endif.

else.

select vbeln

into table gt_vbeln

from vbrk.

endif.

if gt_vbeln[] is not initial.

lt_fields-tabname = lv_tabname = 'VBRK'.

lt_fields-fieldname = lv_fieldname = 'VBELN'.

lt_fields-selectflag = 'X'.

append lt_fields.

call function 'HELP_VALUES_GET_NO_DD_NAME'

exporting

cucol = '5'

curow = '5'

selectfield = lv_fieldname

titel = text-008 "'Select Any Value'

importing

ind = lv_index

select_value = lv_value

tables

fields = lt_fields

full_table = gt_vbeln

exceptions

full_table_empty = 1

no_tablestructure_given = 2

no_tablefields_in_dictionary = 3

more_then_one_selectfield = 4

no_selectfield = 5

others = 6.

if sy-subrc <> 0.

message s000 with

'No Invoices found for the project definition..'(007).

else.

clear gt_vbeln.

read table gt_vbeln index lv_index.

ev_vbeln = gt_vbeln-vbeln.

endif.

else.

message s000 with

'No Invoices found for the project definition..'(007).

endif.

endform. " f_get_invoice

&----


*& Form F_PRINT_INVOICE_COVSHEET

&----


  • text

----


form f_print_invoice_covsheet .

  • Call the function module to get the name of the

  • function module name which will be generated dynamically for

  • the layout

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

  • formname = gc_formname

formname = gp_layut

importing

fm_name = gv_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.

  • ----------------------------------------------------------------*

  • Set up the output options for the smart form

clear gst_output_options.

  • GST_OUTPUT_OPTIONS-tddest = sy-pdest.

gst_output_options-tddest = 'FWIN'. "Frontend printer

gst_output_options-tdnewid = sy-prnew.

gst_output_options-tdimmed = 'X'.

gst_output_options-tddelete = sy-prrel.

clear gst_control_parameters.

  • Setup to generate OTF internal table

gst_control_parameters-no_dialog = 'X'.

gst_control_parameters-getotf = 'X'.

gst_control_parameters-preview = 'X'. "Deactivate preview!

if gp_norm is not initial.

  • Call the original function module.

call function gv_fm_name

exporting

inv_header = gst_invheader

tables

inv_data = gt_invitems

exceptions

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

else.

  • Call the original function module.

call function gv_fm_name

exporting

control_parameters = gst_control_parameters

output_options = gst_output_options

inv_header = gst_invheader

importing

job_output_info = gt_job_output_info

job_output_options = gt_output_options

tables

inv_data = gt_invitems

exceptions

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4.

if sy-subrc <> 0.

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

*----


  • Display PDF Preview Screen

perform pdf_preview using gt_job_output_info-otfdata.

endif.

endform. " F_PRINT_INVOICE_COVSHEET

&----


*& Form f_get_other_invoice_details

&----


  • text

----


form f_get_other_invoice_details .

data: lv_index like sy-tabix,

lwa_invitems like gt_invitems.

data: lt_invitems like gt_invitems occurs 0 with header line,

lt_invitems1 like gt_invitems occurs 0 with header line.

  • Get the prepared by person name.

if gst_invheader-ernam is not initial.

select single pernr

into pa0105-pernr

from pa0105

where usrty = gc_usrty

and usrid = gst_invheader-ernam.

select nachn vorna

up to 1 rows

into (pa0002-nachn, pa0002-vorna)

from pa0002

where pernr = pa0105-pernr.

endselect.

condense: pa0002-nachn, pa0002-vorna.

concatenate pa0002-nachn pa0002-vorna

into gst_invheader-ernam

separated by space.

endif.

  • Get logo

move gp_logo to gst_invheader-logo.

  • Write the date as required.

if vbrk-fkdat is not initial and

vbrk-fkdat ne '00000000'.

perform f_write_date changing gst_invheader-txdat.

endif.

  • Get the description for Payment terms

select single *

from tvzbt

where spras eq sy-langu

and zterm eq gst_invheader-zterm.

if sy-subrc eq 0.

condense: tvzbt-vtext, gst_invheader-zterm.

concatenate gst_invheader-zterm '-' tvzbt-vtext

into gst_invheader-zterm.

endif.

  • Get the billing address.

select adrnr

up to 1 rows

into gst_invheader-adrnr

from vbpa

where vbeln = gst_invheader-vbeln

and parvw = 'RE'.

endselect.

if sy-subrc ne 0.

message i000 with

'Billing Party address of Customer is not maintained..'(009).

stop.

endif.

  • Get the company code address (Registered Address).

select single adrnr

into t001-adrnr

from t001

where bukrs = gwa_bseg-bukrs.

if sy-subrc eq 0.

select name1 street city1 post_code1

region country

up to 1 rows

into (adrc-name1, adrc-street, adrc-city1, adrc-post_code1,

adrc-region, adrc-country)

from adrc

where addrnumber = t001-adrnr

and date_from le sy-datum.

endselect.

if sy-subrc eq 0.

condense: adrc-name1, adrc-street, adrc-city1,

adrc-post_code1, adrc-region, adrc-country.

concatenate adrc-name1 ', ' adrc-street

into gst_invheader-zzregoff_line1.

concatenate adrc-city1 ', ' adrc-region ', '

adrc-country ' ' adrc-post_code1

into gst_invheader-zzregoff_line2.

endif.

endif.

gv_uname = vbrk-ernam.

  • Get the Prepared by Person name.

call function 'CRIF_GET_EMPLOYEE_FOR_USER'

exporting

user_name = gv_uname

begindate = sy-datum

enddate = sy-datum

importing

employeenumber = gv_pernr

exceptions

no_employeenumber_found = 1

subtype_not_available = 2

others = 3.

if sy-subrc eq 0.

select single *

from pa0002

where pernr = gv_pernr

and begda le sy-datum

and endda ge sy-datum.

concatenate pa0002-vorna pa0002-nachn into

gst_invheader-ernam separated by space.

endif.

  • Get the Invoice items

if gt_invitems[] is initial.

select mvgr1 mvgr2 mvgr3 mvgr4 mvgr5 matnr arktx vbeln posnr netwr

into table gt_invitems

from vbrp

where vbeln eq gp_vbeln.

if sy-subrc eq 0.

sort gt_invitems by mvgr1 mvgr2 mvgr3 mvgr4 mvgr5 arktx matnr.

endif.

endif.

  • Get the VAT on the billing items through condition

  • type 'MWST'.

if gt_invitems[] is not initial.

select knumv kposn kwert

into table gt_konv

from konv

for all entries in gt_invitems

where knumv = vbrk-knumv

and kposn = gt_invitems-posnr

and kschl = 'MWST'.

if sy-subrc eq 0.

  • Now loop through the condition value table and modify the invoice item

  • table.

sort gt_konv by knumv kposn.

loop at gt_invitems.

lv_index = sy-tabix.

read table gt_konv with key knumv = vbrk-knumv

kposn = gt_invitems-posnr

binary search.

if sy-subrc eq 0.

gt_invitems-kwert = gt_konv-kwert.

modify gt_invitems index lv_index transporting kwert.

endif.

lt_invitems = gt_invitems.

at end of arktx.

sum.

move: gt_invitems-netwr to lt_invitems-netwr,

gt_invitems-kwert to lt_invitems-kwert.

collect lt_invitems.

endat.

endloop.

  • Take the summarized table for display in the output.

clear gt_invitems[].

gt_invitems[] = lt_invitems[].

clear lt_invitems[].

free lt_invitems[].

else.

loop at gt_invitems.

lt_invitems = gt_invitems.

clear: lt_invitems-vbeln, lt_invitems-posnr.

at end of arktx.

sum.

move: gt_invitems-netwr to lt_invitems-netwr,

gt_invitems-kwert to lt_invitems-kwert.

collect lt_invitems.

endat.

endloop.

  • Take the summarized table for display in the output.

clear gt_invitems[].

gt_invitems[] = lt_invitems[].

clear lt_invitems[].

free lt_invitems[].

endif.

  • sort the table.

lt_invitems1[] = gt_invitems[].

delete lt_invitems1 where mvgr1 ne space or

mvgr2 ne space or

mvgr3 ne space or

mvgr4 ne space or

mvgr5 ne space.

delete gt_invitems where mvgr1 = space and

mvgr2 = space and

mvgr3 = space and

mvgr4 = space and

mvgr5 = space.

sort gt_invitems by mvgr1 mvgr2 mvgr3 mvgr4 mvgr5.

  • Now, construct the output table with mat grp descriptions

loop at gt_invitems.

lwa_invitems = gt_invitems.

clear: lt_invitems-arktx,

lt_invitems-netwr,

lt_invitems-kwert.

  • Material group 1

at new mvgr1.

if lwa_invitems-mvgr1 is not initial.

select single bezei from tvm1t into lt_invitems-arktx

where spras = sy-langu

and mvgr1 = lwa_invitems-mvgr1.

append lt_invitems.

endif.

endat.

  • Material group 2

clear: lt_invitems-arktx,

lt_invitems-netwr,

lt_invitems-kwert.

at end of mvgr2.

if lwa_invitems-mvgr2 is not initial.

select single bezei from tvm2t into lt_invitems-arktx

where spras = sy-langu

and mvgr2 = lwa_invitems-mvgr2.

if lt_invitems-mvgr3 is initial and

lt_invitems-mvgr4 is initial and

lt_invitems-mvgr5 is initial.

sum.

move: gt_invitems-netwr to lt_invitems-netwr,

gt_invitems-kwert to lt_invitems-kwert.

endif.

concatenate '->' lt_invitems-arktx into lt_invitems-arktx.

append lt_invitems.

endif.

endat.

  • Material group 3

clear: lt_invitems-arktx,

lt_invitems-netwr,

lt_invitems-kwert.

at end of mvgr3.

if lwa_invitems-mvgr3 is not initial.

select single bezei from tvm3t into lt_invitems-arktx

where spras = sy-langu

and mvgr3 = lwa_invitems-mvgr3.

if lt_invitems-mvgr4 is initial and

lt_invitems-mvgr5 is initial.

sum.

move: gt_invitems-netwr to lt_invitems-netwr,

gt_invitems-kwert to lt_invitems-kwert.

endif.

concatenate '-->' lt_invitems-arktx into lt_invitems-arktx.

append lt_invitems.

endif.

endat.

  • Material group 4

clear: lt_invitems-arktx,

lt_invitems-netwr,

lt_invitems-kwert.

at end of mvgr4.

if lwa_invitems-mvgr4 is not initial.

select single bezei from tvm4t into lt_invitems-arktx

where spras = sy-langu

and mvgr4 = lwa_invitems-mvgr4.

if lt_invitems-mvgr5 is initial.

sum.

move: gt_invitems-netwr to lt_invitems-netwr,

gt_invitems-kwert to lt_invitems-kwert.

endif.

concatenate '--->' lt_invitems-arktx into lt_invitems-arktx.

append lt_invitems.

endif.

endat.

  • Material group 5

clear: lt_invitems-arktx,

lt_invitems-netwr,

lt_invitems-kwert.

at end of mvgr5.

if lwa_invitems-mvgr5 is not initial.

select single bezei from tvm5t into lt_invitems-arktx

where spras = sy-langu

and mvgr5 = lwa_invitems-mvgr5.

sum.

move: gt_invitems-netwr to lt_invitems-netwr,

gt_invitems-kwert to lt_invitems-kwert.

concatenate '---->' lt_invitems-arktx into lt_invitems-arktx.

append lt_invitems.

endif.

endat.

  • Material group 1

at end of mvgr1.

if lwa_invitems-mvgr1 is not initial.

select single bezei from tvm1t into lt_invitems-arktx

where spras = sy-langu

and mvgr1 = lwa_invitems-mvgr1.

concatenate 'Total ' lt_invitems-arktx into lt_invitems-arktx

separated by space.

if lt_invitems-mvgr2 is initial and

lt_invitems-mvgr3 is initial and

lt_invitems-mvgr4 is initial and

lt_invitems-mvgr5 is initial.

sum.

move: gt_invitems-netwr to lt_invitems-netwr,

gt_invitems-kwert to lt_invitems-kwert.

endif.

append lt_invitems.

endif.

endat.

endloop.

  • Now keep all the records with non material groups.

sort lt_invitems1 by arktx.

loop at lt_invitems1.

lwa_invitems = lt_invitems1.

at end of arktx.

lt_invitems = lwa_invitems.

sum.

move: lt_invitems1-netwr to lt_invitems-netwr,

lt_invitems1-kwert to lt_invitems-kwert.

append lt_invitems.

endat.

endloop.

endif.

  • Take the summarized table for display in the output.

if gp_layut <> 'ZPS_INVOICE_COVERSHEET3'.

clear gt_invitems[].

gt_invitems[] = lt_invitems[].

clear lt_invitems[].

free lt_invitems[].

endif.

endform. " f_get_other_invoice_details

----


  • Form: pdf_preview

----


  • Desc: Preview PDF Debit/Credit memo

----


form pdf_preview using iv_otfdata type tsfotf.

  • PREVIEW PDF Credit Memo

call function 'SSFCOMP_PDF_PREVIEW'

exporting

i_otf = iv_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.

endform. "pdf_preview

&----


*& Form f_write_date

&----


  • To write the date in format

----


  • <--CV_date date

----


form f_write_date changing cv_date.

data: lv_date like sy-datum.

lv_date = vbrk-fkdat.

clear cv_date.

case lv_date+4(2).

when '01'.

write '-Jan-' to cv_date.

when '02'.

write '-Feb-' to cv_date.

when '03'.

write '-Mar-' to cv_date.

when '04'.

write '-Apr-' to cv_date.

when '05'.

write '-May-' to cv_date.

when '06'.

write '-Jun-' to cv_date.

when '07'.

write '-Jul-' to cv_date.

when '08'.

write '-Aug-' to cv_date.

when '09'.

write '-Sep-' to cv_date.

when '10'.

write '-Oct-' to cv_date.

when '11'.

write '-Nov-' to cv_date.

when '12'.

write '-Dec-' to cv_date.

endcase.

condense cv_date.

concatenate lv_date6(2) cv_date lv_date0(4)

into cv_date.

endform. " f_write_date

Former Member
0 Kudos

Hi Sandeep,

Thnx for the points.

There is no direct method to Preview and Download as PDF at the same time. But I can suggest one way.

Call the smartform twice. First call the smartform without setting the GETOTF = 'X' which shows u the preview and after that call set GETOTF = 'X' and call the smartform again. This download the Form as PDF.

awrd points if useful

Bhupal

Former Member
0 Kudos

Hi,

When W_CPARAM-GETOTF = 'X'. is set u cannot see the preview of the smartform.

So u can do onething. Put Radio buttons on ur selection screen:

1) PDF

2) Preview

if pdf = 'X'.

W_CPARAM-GETOTF = 'X'.

else.

W_CPARAM-GETOTF = space.

endif.

If u actually dont want that radio buttons. U can just commenet the line W_CPARAM-GETOTF = 'X'. and execute.

awrd points if helpful

Bhupal

Former Member
0 Kudos

Sandeep,

change :

w_outoptions-tddest = space.

then

we should have dialog and print preview hence

W_CPARAM-PREVIEW = 'X'.

W_CPARAM-NO_DIALOG = SPACE.

REWARD POINTS IF U FIND IT USEFUL

-Sapsurfer