o_dyndoc_id TYPE REF TO cl_dd_document,
sexta-feira, 15 de setembro de 2023
CL_GUI_ALV_GRID - TOP_OF_PAGE - CL_DD_DOCUMENT - METHOD ADD_TABLE
o_dyndoc_id TYPE REF TO cl_dd_document,
terça-feira, 18 de julho de 2023
Calling method from another class from another program
PROGRAM 1
REPORT y_test_prog1.
DATA lv_cc TYPE bkpf-bukrs.
CLASS lcl_local_class DEFINITION.
PUBLIC SECTION.
CLASS-METHODS :
cc_code IMPORTING lv_cc TYPE bkpf-bukrs.
ENDCLASS.
CLASS lcl_local_class IMPLEMENTATION.
METHOD cc_code.
IF lv_cc = ‘1000’.
WRITE lv_cc.
ELSE.
WRITE : ‘Worked’ , lv_cc.
ENDIF.
ENDMETHOD.
ENDCLASS.
START-OF-SELECTION.
lv_cc = ‘1000’.
CALL METHOD lcl_local_class=>cc_code
EXPORTING
lv_cc = lv_cc.
PROGRAM 2
REPORT y_test_prog2.
PARAMETER lv_cc TYPE bkpf-bukrs.
DATA : go_test TYPE REF TO object,
ge_abs_typename TYPE string
VALUE ‘\PROGRAM=Y_TEST_PROG1\CLASS=LCL_LOCAL_CLASS’.
START-OF-SELECTION.
CREATE OBJECT go_test TYPE (ge_abs_typename).
BREAK-POINT.
CALL METHOD go_test->(‘CC_CODE’)
EXPORTING
lv_cc = lv_cc.
quarta-feira, 5 de julho de 2023
CL_GUI_TEXT_EDITOR - Get text using method GET_TEXTSTREAM
After call metho GET_TEXTSTREAM, call the method flush
Example.
IF o_editor_test IS BOUND.
o_editor_test->get_textstream( IMPORTING text = DATA(lv_text) ).
cl_gui_cfw=>flush( ).
ENDIF.
Eclipse ABAP - shortcuts
F3 - Igual F2 no SAPGUI - entra no método ou perform
F2 - Exibe campos de estrutura/função/tabelas etc.
CTRL+F3 = Ativar
CTRL+SHIFT+F3 = Ativar vários objetos
F8 = F8 no SAPGUI - executa programa
CTRL+SHIFT+< = Comentar código
CTRL+SHIFT+> = Descomentar código
CTRL+SHIFT+X = upper case
CTRL+SHIFT+Y = lower case
CTRL+1 = opções para implementar, renomear, excluir método
ALT+SHIFT+R = Renomeia uma variável de qualquer tipo em todos os lugares onde a variável é utilizado no mesmo objeto (as vezes dá pau mas funciona)
CTRL + O - Lista de métodos ou subrotinas para navegação
CTRL+SHIFT+G - Lista de utilização do objeto
Navegar para elemento de texto.
Alt+F2 - Shows the signature of the method you are currently editing
Tab/Shift+Tab - When selecting a multiple lines of code, Tab indents the selection and Shift+Tab decreases the indent
CTRL+SHIFT+L - This open a list with all shortcuts available.
https://blogs.sap.com/2022/12/06/abap-cheat-sheets/
from blog
https://blogs.sap.com/2013/11/21/useful-keyboard-shortcuts-for-abap-in-eclipse/
Editing source code:
Shortcut | What it will do |
CTRL+D | Deletes the selected codeline |
CTRL+SHIFT+DELETE | Deletes the content from the cursor position to the end of the line |
CTRL+DELETE | Deletes the next word in the editor |
CTRL+BACKSPACE | Deletes the previous word in the editor |
ALT+UP/DOWN | Moves the selected codelines up/down in the editor |
CTRL+ALT+UP/DOWN | Duplicates Codelines before/after the selected codeline |
CTRL+UP/DOWN | Scrolls Line up/down |
SHIFT+ENTER | Adds a new line below the current line and positions the cursor in that line |
CTRL+SHIFT+ENTER | Adds a new line above the current line and positions the cursor in that line |
CTRL+Z | Undo changes |
ALT+SHIFT+R | Rename the selected object, e.g. variable, method, class |
CTRL+1 | Opens Quickfix/Quickassist Dialog on the selected element |
CTRL+7 | Comments/Uncomments selected code in the editor |
SHIFT+F1 | Formats the source code (aka. Pretty Printer) |
CTRL+SHIFT+F1 | Formats the marked source code or source code block (e.g. method) |
CTRL+N | Creates new development object |
CTRL+SHIFT+X | Convert marked editor content to upper case |
CTRL+SHIFT+Y | Convert marked editor content to lower case |
CTRL+U | Unlock Editor |
Navigation:
CTRL-L | Jump to line in editor |
CTRL-O | Launch the quick outline |
ALT+LEFT/RIGHT | Navigate through the editor navigation history |
CTRL+ ; / : | Step quickly through the editor markers, like tasks, bookmarks, error markers, ATC findings etc. |
F3 | Navigate to the definition of the selected element, e.g. variable, method, attribute etc. |
Editor Tabs:
CTRL + E | Displays a list of all open editors |
CTRL + F6 | Easily switch between the editor tabs (Like Tab for Windows) |
CTRL + F7 | Easily switch between all eclipse views |
CTRL + F8 | Easily switch between the perspectives |
CTRL + M | Maximize the active editor or viewer to full-screen mode |
CTRL+3 | Easily open Eclipse views or trigger command via the Quick Access Input field |
CTRL+PAGE UP/PAGE DOWN | Navigate through the editor tabs forward and backward |
ALT+PAGE UP/PAGE DOWN | Navigate through the tabs of the class editor between global class, local class and test classes |
CTRL + F4 | Close the active editor tab |
CTRL+SHIFT+F4 | Close all editor tabs |
Debugging:
CTRL+SHIFT+B | Set a line break point in the ABAP editor |
quinta-feira, 20 de abril de 2023
ABAP 740 - Collect usando FOR GROUP
matnr TYPE matnr,
tipo type char1,
cont TYPE i,
END OF tp_t.
DATA t_teste TYPE TABLE OF tp_t.
APPEND VALUE #( matnr = 'A' cont = 1 ) TO t_teste.
APPEND VALUE #( matnr = 'B' tipo = 'X' cont = 1 ) TO t_teste.
APPEND VALUE #( matnr = 'B' cont = 2 ) TO t_teste.
APPEND VALUE #( matnr = 'B' cont = 3 ) TO t_teste.
APPEND VALUE #( matnr = 'D' cont = 2 ) TO t_teste.
APPEND VALUE #( matnr = 'C' cont = 1 ) TO t_teste.
APPEND VALUE #( matnr = 'C' cont = 1 ) TO t_teste.
APPEND VALUE #( matnr = 'C' tipo = 'W' cont = 1 ) TO t_teste.
APPEND VALUE #( matnr = 'C' tipo = 'W' cont = 1 ) TO t_teste.
VALUE gkey(
FOR GROUPS material OF wa IN t_teste
GROUP BY ( matnr = wa-matnr
tipo = wa-tipo )
DESCENDING
LET cont_1 = REDUCE tp_t( init line type tp_t
for ls_c in group material
NEXT line-matnr = ls_c-matnr
LINE-TIPO = ls_c-tipo
line-cont = line-cont + ls_c-cont ) in ( cont_1 ) ).
BREAK-POINT.
LOOP AT lt_mat INTO data(lsx).
WRITE: / lsx-matnr, lsx-tipo, lsx-cont.
ENDLOOP.
segunda-feira, 27 de março de 2023
terça-feira, 14 de fevereiro de 2023
Workflow - Erro formatação HTML na exibição SBWP
- Para exibição de HTML no container da SBWP por mais que o HTML funcione 100% no ambiente tipo chrome, edge ou qualquer outra ferramenta para exibição no SAP especificamente na exibição de conteúdo as vezes aparece algumas tags fora de posição ou aparece a tag mesmo, etc..
Para resolver esse problema fiquei procurando até achar um cara que fala de uma nota da SAP q desconhecia até então falando justamente da do HTML em editor sapscript.
2472157 - Work item description with HTML table in expression is not displayed correctly
Resumindo a nota a estrutura que deve ser usado para montar o HTML deve ser a TLINE_T que é a mesma estrutura do editor sapscript
Na primeira linha do sapscript no container do workflow deve ser colocado o texto MAIL_HTML_ONLY e depois a tabela que tem o HTML.
Ficaria dessa forma.