cancel
Showing results for 
Search instead for 
Did you mean: 

SMARTFORM generated function module / changing style

Former Member
0 Kudos

I copied an existing style used by a SMARTFORM that was also copied from /smb40/ for invoice. I genrated the SMARTFORM and it thus created it's function module as viewed by Environment tab. I then replaced the standard style with the new style at form level and at some table, template, and text nodes.

My problem is that when I transported thinking all was OK there was still a reference to the old standard node. SMARTFORM will NOT work on target client.

I searched the function module and found where the old style is reference BUT it does not readily correspond to anything in the SMARTFORM.

Does anybody have any idea how to correct this error. I really need a better way to make sense of the function module list to the actual SMARTFORM. I did see sections with begin/end but this one reference is eluding me.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

hi michael,

u just call first your smartforms function module to 'SSF_FUNCTION_MODULE_NAME' then u can transport this driver program to target client.

then it works properly if i think right.

see the below for the sample code,

&----


*& Report ZINV_FORM

*&

&----


*&

*&

&----


report zinv_form.

tables: vbrk,vbrp.

*TYPES: BEGIN OF t_itab,

  • vbeln TYPE vbeln_vf,

  • fkdat TYPE fkdat,

  • name1 TYPE name1_gp,

  • addr TYPE c.

*TYPES: END OF t_itab.

types : begin of ty_binary,

binary_field(1000) type c,

end of ty_binary.

data: g_name_itab type standard table of zinv_name.

data: g_name_wa type line of zinv_namet.

data: g_head_itab type standard table of zinv_str_head.

data: g_head_wa type line of zinv_ttype_head.

data: g_item_itab type standard table of zinv_str_item.

data: g_item_wa type line of zinv_ttype_item.

data: g_tot_tab type standard table of zinv_str.

data: g_tot_wa type line of zinv_ttype.

data: g_pay_tab type standard table of zinv_pay_str.

data: g_pay_wa type line of zinv_pay_tab.

data: l_index type i.

data: sf_name type rs38l_fnam.

data: ssfcrescl type ssfcrescl,

final_ssfcrescl type ssfcrescl,

xstring type xstring,

l_data_tab type standard table of ty_binary,

tline type table of tline with header line,

ls_out_opt type ssfcompop,

filesize type i,

l_pac_list type standard table of sopcklsti1,

  • l_pac_list LIKE sodocchgi1,

  • l_docu_data LIKE sodocchgi1-doc_size,

l_doc_chng type sodocchgi1,

l_receivers type standard table of somlreci1.

select-options: s_inv for vbrk-vbeln.

*PARAMETERS: p_inv LIKE vbrk-vbeln default '90005298'.

*PARAMETERS: p_email1 LIKE somlreci1-receiver.

start-of-selection.

perform get_header.

perform get_item.

perform get_name.

perform call_form.

  • PERFORM send_email.

&----


*& Form get_header

&----


  • text

----


form get_header.

select vbeln fkdat kunag zterm from vbrk into corresponding fields of table

g_head_itab where vbeln in s_inv.

loop at g_head_itab into g_head_wa.

select zterm text1 spras from t052u into table g_pay_tab where zterm = g_head_wa-zterm

and spras = sy-langu.

l_index = sy-tabix.

read table g_pay_tab into g_pay_wa index l_index.

move: g_pay_wa-text1 to g_tot_wa-text1.

move-corresponding g_head_wa to g_tot_wa.

append g_tot_wa to g_tot_tab.

endloop.

endform. "get_header

&----


*& Form get_item

&----


  • text

----


form get_item.

select vbeln posnr arktx fkimg netwr mwsbp from vbrp into corresponding fields of table g_item_itab

for all entries in g_head_itab where vbeln eq g_head_itab-vbeln.

loop at g_head_itab into g_head_wa.

  • l_index = sy-tabix.

  • g_item_wa-tot = g_item_wa-fkimg * g_item_wa-netwr.

  • MODIFY g_item_itab FROM g_item_wa INDEX l_index.

data: l_tab_item type standard table of zex_struct.

data: l_wa_item like line of l_tab_item.

clear l_tab_item[].

call function 'ZAPR_GET_COND_DETAILS'

exporting

i_vbeln = g_head_wa-vbeln

  • I_POSNR =

  • I_KSCHL =

tables

export_tab = l_tab_item.

  • EXCEPTIONS

  • INCORRECT_INV_NUMBER = 1

  • COND_REC_NOT_FOUND = 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.

delete l_tab_item where kschl ne 'PR00'.

loop at l_tab_item into l_wa_item.

l_index = sy-tabix.

move l_wa_item-kbetr to g_item_wa-kbetr.

modify g_item_itab from g_item_wa transporting kbetr where posnr = l_wa_item-posnr

and vbeln = g_head_wa-vbeln.

endloop.

endloop.

endform. "get_item

&----


*& Form get_name

&----


  • text

----


form get_name.

select name1 kunnr from kna1 into corresponding fields of table g_name_itab

for all entries in g_head_itab where kunnr = g_head_itab-kunag.

if sy-subrc = 0.

loop at g_name_itab into g_name_wa .

l_index = sy-tabix.

call function 'Z_DR_GET_CUSTOMER_ADDRESS'

exporting

customerno = g_name_wa-kunnr

importing

customer_city = g_name_wa-ort01

customer_street = g_name_wa-stras

customer_country = g_name_wa-landx

customer_zipcode = g_name_wa-pstlz.

modify g_name_itab from g_name_wa index l_index.

endloop.

loop at g_name_itab into g_name_wa .

move-corresponding g_name_wa to g_tot_wa.

modify g_tot_tab from g_tot_wa

transporting ort01 stras landx name1 pstlz where kunag = g_name_wa-kunnr.

endloop.

endif.

endform. "get_name

end-of-selection.

&----


*& Form call_form

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form call_form .

data: wa_output type zinv_str,

gt_header type table of zinv_str_head,

gt_temp type table of zinv_str_item,

wa_header type zinv_str_head,

l_lines type i,

l_tabix type sy-tabix,

l_ssfctrlop type ssfctrlop.

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = 'ZINV_FORM1'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

importing

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

  • CLEAR g_tot_tab[].

  • g_tot_tab[] = gt_output[].

  • gt_temp[] = gt_output[].

  • DELETE ADJACENT DUPLICATES FROM gt_header COMPARING order_number.

describe table g_head_itab lines l_lines.

gt_temp[] = g_item_itab[].

*

  • l_ssfctrlop-no_dialog = 'X'.

  • l_ssfctrlop-preview = 'X'.

  • l_ssfctrlop-getotf = 'X'.

  • ls_out_opt-tdnoprev = 'X'.

  • ls_out_opt-tddest = 'locl'.

*

*

loop at g_tot_tab into g_tot_wa.

g_item_itab[] = gt_temp[].

delete g_item_itab where vbeln ne g_tot_wa-vbeln.

loop at g_item_itab into g_item_wa.

move: sy-tabix to g_item_wa-sino.

modify g_item_itab from g_item_wa.

endloop.

add 1 to l_tabix.

if l_tabix gt 1 and l_tabix le l_lines.

l_ssfctrlop-no_open = 'X'.

endif.

if l_tabix eq l_lines.

l_ssfctrlop-no_close = space.

else.

l_ssfctrlop-no_close = 'X'.

endif.

call function sf_name

exporting

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

control_parameters = l_ssfctrlop

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

output_options = ls_out_opt

  • USER_SETTINGS = 'X'

is_inv_header = g_tot_wa

importing

  • DOCUMENT_OUTPUT_INFO =

job_output_info = ssfcrescl

  • JOB_OUTPUT_OPTIONS =

tables

l_itab = g_item_itab

  • 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.

  • APPEND LINES OF ssfcrescl-otfdata TO final_ssfcrescl-otfdata.

endloop.

call function 'CONVERT_OTF'

exporting

format = 'PDF'

  • MAX_LINEWIDTH = 132

  • ARCHIVE_INDEX = ' '

  • COPYNUMBER = 0

  • ASCII_BIDI_VIS2LOG = ' '

importing

bin_filesize = filesize

bin_file = xstring

tables

otf = final_ssfcrescl-otfdata

lines = tline

  • 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.

call function 'SCMS_XSTRING_TO_BINARY'

exporting

buffer = xstring

  • APPEND_TO_TABLE = ' '

  • IMPORTING

  • OUTPUT_LENGTH =

tables

binary_tab = l_data_tab.

call function 'GUI_DOWNLOAD'

exporting

  • BIN_FILESIZE =

filename = 'C:\invoice.pdf'

filetype = 'BIN'

  • APPEND = ' '

  • WRITE_FIELD_SEPARATOR = ' '

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

  • IMPORTING

  • FILELENGTH =

tables

data_tab = l_data_tab

  • FIELDNAMES =

  • EXCEPTIONS

  • FILE_WRITE_ERROR = 1

  • NO_BATCH = 2

  • GUI_REFUSE_FILETRANSFER = 3

  • INVALID_TYPE = 4

  • NO_AUTHORITY = 5

  • UNKNOWN_ERROR = 6

  • HEADER_NOT_ALLOWED = 7

  • SEPARATOR_NOT_ALLOWED = 8

  • FILESIZE_NOT_ALLOWED = 9

  • HEADER_TOO_LONG = 10

  • DP_ERROR_CREATE = 11

  • DP_ERROR_SEND = 12

  • DP_ERROR_WRITE = 13

  • UNKNOWN_DP_ERROR = 14

  • ACCESS_DENIED = 15

  • DP_OUT_OF_MEMORY = 16

  • DISK_FULL = 17

  • DP_TIMEOUT = 18

  • FILE_NOT_FOUND = 19

  • DATAPROVIDER_EXCEPTION = 20

  • CONTROL_FLUSH_ERROR = 21

  • OTHERS = 22

.

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. "call_form

*

*&----


**& Form send_email

*&----


    • text

*----


*FORM send_email.

*

      • Document information.

**wa_doc_chng-obj_name = 'Smartform'.

**wa_doc_chng-expiry_dat = sy-datum + 10.

**wa_doc_chng-obj_descr = 'Smart form output'.

**wa_doc_chng-sensitivty = 'F'. "Functional object

**wa_doc_chng-doc_size = v_lines_txt * 255.

**data:i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,

**

**

**

**

  • CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

  • EXPORTING

  • document_data = l_doc_chng

  • put_in_outbox = 'X'

    • sender_address = sder_add

  • sender_address_type = 'U'

  • commit_work = 'X'

    • IMPORTING

    • SENT_TO_ALL =

    • NEW_OBJECT_ID =

    • SENDER_ID =

  • TABLES

  • packing_list = l_pac_list

    • OBJECT_HEADER =

    • CONTENTS_BIN =

    • CONTENTS_TXT =

    • CONTENTS_HEX =

    • OBJECT_PARA =

    • OBJECT_PARB =

  • receivers = l_receivers

    • EXCEPTIONS

    • TOO_MANY_RECEIVERS = 1

    • DOCUMENT_NOT_SENT = 2

    • DOCUMENT_TYPE_NOT_EXIST = 3

    • OPERATION_NO_AUTHORIZATION = 4

    • PARAMETER_ERROR = 5

    • X_ERROR = 6

    • ENQUEUE_ERROR = 7

    • OTHERS = 8

  • .

  • 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. "send_email

regards,

seshu.

Former Member
0 Kudos

I copied an existing style used by a SMARTFORMfrom /smb40/ for invoice. I genrated the SMARTFORM thus created it's function module as viewed by Environment tab. I then replaced the standard style with that style at form level and at some table, template, and text nodes. My problem is that when I transported thinking all was OK there was still a reference to the old style SMARTFORM will NOT work on target client now. I searched the function module and found where the old style is reference BUT it does not readily correspond to anything in the SMARTFORM. Does anybody have any idea how to correct this error. I really need a better way to make sense of the function module list to the actual SMARTFORM. In the function I saw "sections" with begin/end but this one reference to the old style is eluding me.

any ideas???

Former Member
0 Kudos

Hi,

i think the problem is with the table, template area. the old style has been used for particular area of the form. since the old style and new style are same, it is not showing any error.

try to check all the folder, tables for the style and change the same

Regards

Shiva

Former Member
0 Kudos

Hi Micheal,

I feel you are doing the steps in a incorrect way.

First you should do all changes you want in smartform, i mean changing styles and all.

Then generate the function module for smartform.

Revert back if it does not solve your problem.

Regards

Indrajit.

Former Member
0 Kudos

Guys! The bottom line is that the very first time I wrongly activated the SMARTFORM before changing all output option styles to the new transportable style I had copied...the SAP generated function traps the original form style and nothing (it appears) can be done other than having BASIS transport the SAP styles.

I do appreciate the efforts. I am sure there is some genius that knows an elegant solution but for now I will be careful to avoid this terrible situation.

Former Member
0 Kudos

i think they use so many styles for old smartform..

look at each page ,each window - somewhere you did not copy the style..