Documente Academic
Documente Profesional
Documente Cultură
Here are few of DOs and DONTs when working and designing a Smart Forms.
Few reasons, you should NOT slam code lines node within the Smart Forms.
Very small Editor: When you open the ABAP Editor to maintain the Code Lines, you would notice a very
small window. If you are using a normal screen, you would run into double scrollbar issue as well. Since it
is having double scroll bar and small editor, it would be difficult to write a code within it.
Difficult to find: Since Code lines can exist at any node level, it would be very difficult to navigate when
required to find a specific code lines
Commented Code: Commented code in the beginning of the program lines, makes it more difficult to
determine if there is any code or not.
Code Lines Node Usage: Use it only to do formatting on the data Code lines should be used for very few
lines of code.
Segregation of the Logic: Try to wrap the logic in an Object or a FM which can be easily called in more
than one places. This would give you an opportunity to re-factor your code, write an ABAP Unit test case,
Inherit existing functionality (if ABAP Objects is used)
Unclear Purpose: If you dont rename difficult to navigate and understand the purpose of the node. Its
difficult to find relevant node and locate it. You can search the text in the FM by if the node is not renamed
properly it wont find it
Properly documented node will help you and others to understand the purpose of the node:
Translation in SE63: Without proper name of the text node, it will appear like a TEXT01 TEXT02 etc. You
would need to pay lot of extra attention to make sure you put the correct translation to correct node.
Without proper name, you will see this in SE63 while translating the SmartForms
With Proper Name, you would see nicely named text symbols in SE63:
Inactive Nodes
Many a times developers use 1=2 in condition to make that element Inactive from the form. This technique is fine
as you want to retain that node and relevant logic within it. But, not maintaining proper documentation would make
maintenance difficult. So, Make sure you update the description with phrase like COMMENTED, NOT USED,
INACTIVE, etc.
Eventually in subsequent changes, these inactive nodes must be removed from the form. Too many inactive nodes
will take long time for From to process.
Without Properly commented node, would be lost in the node tree of the Smartforms:
Error Handling
After each generated FM call, make sure you get the errors as well whenever there is any exception. Call FM
SSF_READ_ERRORS to retrieve the error message. Pass these message back to the NAST protocol if the
SmartForm is being called from the Output control.
= toa_dara
= arc_params
= ls_control_param
mail_recipient
mail_sender
output_options
user_settings
=
=
=
=
ls_recipient
ls_sender
ls_composer_param
SPACE
IMPORTING job_output_info
= ls_job_info
EXCEPTIONS formatting_error
= 1
internal_error
= 2
send_error
= 3
user_canceled
= 4
OTHERS
= 5.
IF sy-subrc <> 0.
*
DATA: LT_ERRORTAB
TYPE TSFERROR.
FIELD-SYMBOLS: <FS_ERRORTAB> TYPE LINE OF TSFERROR.
*
* get smart form protocoll
CALL FUNCTION 'SSF_READ_ERRORS'
IMPORTING
ERRORTAB = LT_ERRORTAB.
*
* add smartform protocoll to nast protocoll
LOOP AT LT_ERRORTAB ASSIGNING <FS_ERRORTAB>.
CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
EXPORTING
MSG_ARBGB = <FS_ERRORTAB>-MSGID
MSG_NR
= <FS_ERRORTAB>-MSGNO
MSG_TY
= <FS_ERRORTAB>-MSGTY
MSG_V1
= <FS_ERRORTAB>-MSGV1
MSG_V2
= <FS_ERRORTAB>-MSGV2
MSG_V3
= <FS_ERRORTAB>-MSGV3
MSG_V4
= <FS_ERRORTAB>-MSGV4
EXCEPTIONS
OTHERS
= 1.
ENDLOOP.
ELSE.
*
*
ENDIF.
Breakpoints
Since many of the developers feel comfortable putting break point in the code lines for debugging purpose even
though you can achieve Smartforms: Dynamic Breakpoints. If you have hard coded break point it would make it
difficult for you to debug the same form in Quality system, where you dont have access to remove the form. You
would think, Oh man, Why didnt I remove this?
Olha s a tela aiii, ela bem simples.... vamos dar um nome pro
formulrio e clicar no boto 'Criar'.
Fazendo isso voc ir para tela onde ns efetivamente iremos trabalhar com a
criao do Smartforms.
Agora vamos criar uma janela para colocar as informaes do header, primeiro
clique com o boto direito na Pagina e selecione Criar/Janela,
Eu sei, vocs devem estar pensando... Mas porque esse louco tah fazendo
tudo isso s pra pegar o nome do primeiro user que nico?
A resposta bem simples, porque eu queria mostrar como colocar cdigo
dentro do Smart, rsrsrs.
Agora que ns pegamos o nome vamos jogar essa varivel num lugar no Smart
para ser exibido, vamos clicar com o boto direito na Area principal da
tabela que criamos dentro da janela1 que criamos tambm, veja imagem abaixo.
CampoItem
Numero Spool
Nome User
Hora gerao Spool
Hora eliminao Spool
Dispositivo Saida
CampoTabelaTransp.
RQIDENT
RQOWNER
RQCRETIME
RQDELTIME
RQDEST
Portanto temos que vamos criar essas 5 colunas nessa categoria de linha,
o que tambm muito fcil, depois de criar a tabela na Janela principal
vamos clicar no boto 'Linhas e colunas' um lpis que est na aba
'Tabelas', e delimitar o tamanho de cada campo, caso queira fazer algo com
medidas um pouco mais exatas s clicar no boto 'Detalhes' e escrever o
tamanho das colunas que vo ficar os valores, pra voltar na tela anterior
s clicar no boto 'Table Painter' veja imagem e v se ajuda alguma coisa.
Ative, Ufa, parece que acabamos a parte de desenho, agora vamos pra nossa
razo de viver, os cdigos, to brincando, a parte dos cdigos vamos no prximo
post porque se eu to cansado de escrever vocs devem estar cansado jah de ler,
portanto, proximo post sobre o programa que chama o Smart e alguns comentrios
pertinentes ao assunto Smartforms, e depois vamos comear a entrar um pouco
mais fundo no assunto. Bons Estudos e vamo l rapaziada, qualquer duvida estou
a disposio, tentarei responder o mximo no menor prazo possvel.
6 comentrios:
1.
2.
Mauro Luiz Junior12 de setembro de 2012 06:49
Logo Mais...
Responder
3.
4.
Annimo11 de abril de 2013 10:58
Muito
bom
Somente uma ressalva... como eu defino o tamanho do logo ?
mesmo!
Responder
5.
Mauro Luiz Junior6 de maio de 2013 06:32
Fala Mano, na hora que voc tiver atribuindo a imagem ao objeto grfico do seu Smartforms,
voc vai precisar colocar, NOME , OBJETO e ID.... Logo abaixo vai ter um frame Escrito...
'Caractersticas tcnicas' Na resoluo, dependendo do valor que colocar a imagem aumenta
ou
diminui.
Espero ter ajudado.
Responder
6.
Fernando Silva31 de julho de 2015 06:47
Mauro, parabns pelos posts... esse foi meio difcil de acompanhar, mas estou tentando!
hahaha... vou ver a parte 2! Valeu!
START-OF-SELECTION.
SELECT *
FROM tsp01
INTO TABLE it_tsp01
WHERE rqowner = sy-uname.
BREAK-POINT.
Bons estudos.
*&---------------------------------------------------------------------*
*&
Form z_busca_nome_function
*&---------------------------------------------------------------------*
FORM z_busca_nome_function .
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname
= c_form
*
VARIANT
= ' '
*
DIRECT_CALL
= ' '
IMPORTING
fm_name
= vl_fm_name
EXCEPTIONS
no_form
= 1
no_function_module
= 2
OTHERS
= 3
.
ENDFORM.
" z_busca_nome_function
*&---------------------------------------------------------------------*
*&
Form z_call_form
*&---------------------------------------------------------------------*
FORM z_call_form .* Uma diquinha pra que voc traga todos os parametros corretos
executar
* o smartforms, quando voc apertar F8 ele ira para a transao se37 com
* funo j escrita no campo do nome da funo, copie o nome daquela funo,
* volte para esse programa, clique no boto MODELO e e cole o nome da funo,
* mas no se esquea que esse nome de funo temporrio, portanto, depois
* de fazer esse procedimento mude o nome da funo que voc colou pela variavel
* de retorno da funo acima conforme eu fiz abaixo.
CALL FUNCTION vl_fm_name
* EXPORTING
*
ARCHIVE_INDEX
*
ARCHIVE_INDEX_TAB
*
ARCHIVE_PARAMETERS
*
CONTROL_PARAMETERS
*
MAIL_APPL_OBJ
*
MAIL_RECIPIENT
*
MAIL_SENDER
*
OUTPUT_OPTIONS
*
USER_SETTINGS
* IMPORTING
*
DOCUMENT_OUTPUT_INFO
*
JOB_OUTPUT_INFO
*
JOB_OUTPUT_OPTIONS
TABLES
it_tsp01
EXCEPTIONS
=
=
=
=
=
=
=
=
= 'X'
=
=
=
= it_tsp01
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.
ENDFORM.
" z_call_form