quarta-feira, 5 de janeiro de 2022

Eclipse - Informações sobre status debug (toggle breakpoint) AMDP

Informações do post conforme link abaixo

 https://blogs.sap.com/2020/04/21/adt-abap-debugger-what-to-do-if-your-program-does-not-stop-at-breakpoints/#UnusualBreakpoint


Details Section

1) Unusual looking breakpoint

a)Your breakpoint is decorated with a gray diamond. That means the source where you placed the breakpoint is currently inactive. Activate the source to make the breakpoint work.

b)Your breakpoint is crossed out. That means you activated the Eclipse feature ‘Skip All Breakpoints’ that can be used to make ALL breakpoints non-functional. Deactivate the ‘Skip All Breakpoints’ feature via main menu ‘Run’ -> ‘Skip All Breakpoints’. Alternatively use the buttons in the Eclipse main toolbar or in the breakpoints view toolbar.

c)Your breakpoint is white. That means the breakpoint was disabled. To enable it keep shift pressed and double click the breakpoint. Alternatively open the context menu on the breakpoint and choose ‘Enable Breakpoint’.

If you are told this cannot be done because ‘… debugging is disabled …’ click the link on the popup and activate the checkbox ‘Enable debugger’.

d)Your breakpoint is green. That means you currently deal with a special kind of breakpoint which can be a soft breakpoint, a temporary breakpoint or an AMDP breakpoint. To identify what it actually is you can mouse hover over the breakpoint and check the hover text or you can open the breakpoints view and check the text there.

– Soft breakpoints are only effective in a running debug session but they cannot launch a new debug session on their own. This is a special feature for debugging situations with massive amounts of requests, e.g. catch one request with a normal breakpoint, disable that normal breakpoint and continue working with soft breakpoints. To remove the attribute ‘Soft’ from your breakpoint keep ALT pressed and double click it or change it via the breakpoints view.

– Temporary breakpoints occur in temporary editors, e.g. if you stepped into a foreign system via RFC or if you debug classic dynpros/screens with ADT. They are only effective in a running debug session but they cannot launch a new debug session. If you need a standard breakpoint that is able to startup a new debug session try a different/earlier source position.

– AMDP breakpoints are not ABAP breakpoints at all. Learn more about AMDP Debugging in this blog. A similar blog ‘What to do if your DB procedure does not stop at AMDP breakpoints’ is planned. It will be linked here once available.

e)Your breakpoint is decorated with a red cross. That means that there is a conflict with someone else who wants to debug the same requests as you do. Learn more about debugging conflicts in this blog.

f)Your breakpoint is decorated with a gray cross. That means the ABAP system is not reachable at all. Check whether your computer has a working network connection and whether the ABAP system is reachable at all (e.g. via SAP GUI).

g)Your breakpoint is decorated with a small U (User). That means you currently try to debug the requests of a different user. See this detail section.

h)Your breakpoint is decorated with a small T (Terminal-ID). Unless you have a good reason you should not use this option at all. To go back to normal mode, right click a breakpoint, choose “Debug Properties…” and change the radio button to “Logon User”.

i)Your breakpoint is decorated with a small P (Project). That means you can only debug requests that are started from exactly the ADT project you are currently working in. That includes execution of ABAP unit tests, activities in embedded SAP GUI or class runs (Right click -> “Run As” -> “ABAP Application Console”). In this mode, you cannot debug requests from other ADT projects, from a web browser (e.g. Fiori Apps) or RFC requests.

If you are not sure what this project mode is good for or how you even entered it you can read this blog. To go back to normal mode, right click a breakpoint, choose “Debug Properties…” and change the radio button to “Logon User”.

j)Your breakpoint is decorated with a small C (Conditional). That means you added a condition to the breakpoint (e.g. “sy-subrc = 4”). The condition is evaluated during runtime once the breakpoint is reached. If the result is false, the debugger will not stop the program and there will be no debug session. For further details see the ADT documentation.

To make the breakpoint always stop, just remove the condition via the breakpoints view or via right click on the breakpoint and “Breakpoint Properties…”.

terça-feira, 21 de dezembro de 2021

Corrigindo status monitor NFE - cancelamento autorizado pelo SEFAZ mas status 2 no monitor

 Pela chave da NFE ler tabela /XNFE/EVENTS

CHNFE =  <chave da NF>

pegar o valor do GUID 

Utilizar função /XNFE/PROCSTEP_EV_ERPUPDAT - colocar o GUID

Executar debugando conforme tela abaixo.



terça-feira, 9 de novembro de 2021

Alterando nome de arquivo anexo - caixa de entrada FIORI

UKM_CASE - com workflow de aprovação de crédito.
Quando o caso entra na caixa de entrada do usuário/responsável na aprovação ou qualquer outra decisão na caixa de entrada do FIORI é possível incluir um comentário/justificativa, esse texto quando volta para o backend entra como um anexo na caixa de email na SOST, o problema é que o nome do arquivo por standard fica como "Approver Comments", debugando percebi que esse texto é uma constante sem  opção de tradução.

Sem muita opção no retorno para o backend eu altero o nome do arquivo antes de entrar na caixa de email para envio. 
Essa informação fica gravado na tabela SOOD

Utilizei a função conforme abaixo:
Essa rotina eu inseri numa classe criada dentro do fluxo do workflow

    DATA: l_doc_id    TYPE sofolenti1-doc_id,
          ls_doc_data TYPE sofolenti1.

    DATA: lt_header  TYPE TABLE OF solisti1,
          lt_content TYPE TABLE OF solisti1.
    
    "O LOOP é necessário pois pode haver mais anexos 
    LOOP AT it_attach INTO DATA(ls_attach).

      l_doc_id = ls_attach-instid.
        
      "Faço a importação dos dados do anexo
      CALL FUNCTION 'SO_DOCUMENT_READ_API1'
        EXPORTING
          document_id                = l_doc_id
        IMPORTING
          document_data              = ls_doc_data
        TABLES
          object_header              = lt_header
          object_content             = lt_content
        EXCEPTIONS
          document_id_not_exist      = 1
          operation_no_authorization = 2
          x_error                    = 3
          OTHERS                     = 4.
     
      "Nesse caso peguei somente o objeto COMMENT ref. a justificativa gravado
      IF sy-subrc = 0 AND
         ls_doc_data-obj_name = 'COMMENT' AND
         ls_doc_data-obj_descr = /iwwrk/if_wf_constants_gw=>gc_approver_comments.

        DATA: l_attach_id TYPE soattinfi1-attach_id.
        DATA: ls_attach_data TYPE soattchgi1.

        CONCATENATE ls_doc_data-doc_id ls_doc_data-object_id
                    INTO l_attach_id RESPECTING BLANKS.

        CLEAR ls_attach_data.
        MOVE-CORRESPONDING ls_doc_data TO ls_attach_data.
        ls_attach_data-obj_descr = mc_approver_filename. "Constante com outro nome                                                            " do arquivo
        ls_attach_data-att_size = ls_doc_data-doc_size.

        CALL FUNCTION 'SO_ATTACHMENT_UPDATE_API1'
          EXPORTING
            attachment_id              = l_attach_id
            attachment_data            = ls_attach_data
          TABLES
            attachment_header          = lt_header
            attachment_content         = lt_content
          EXCEPTIONS
            attachment_not_exist       = 1
            operation_no_authorization = 2
            parameter_error            = 3
            x_error                    = 4
            enqueue_error              = 5
            OTHERS                     = 6.

        IF sy-subrc <> 0.

        ENDIF.


      ENDIF.

    ENDLOOP.

segunda-feira, 25 de outubro de 2021

Adicionando anexo em Doc. contábil - utilizando a funcionalidade standard GOS (Generic Object Services)

 Precisei fazer isso para um programa Z que lista doc. contábil e o usuário queria anexar arquivos nos doc. contábeis.



DATA(lo_gos) = NEW cl_gos_srv_attachment_create( ).

DATA: l_sib    TYPE sibflporb,
      l_ip     TYPE swc_value,
      l_status TYPE sgs_status,
      l_icon   TYPE sgs_icon.


"Empresa + Doc.contábil + Exercicio
l_sib-instid = '100010000592332021'.
l_sib-typeid = 'BKPF'.
l_sib-catid = 'BO'.

"igual ao L_SIB-INSTID
l_ip = '100010000592332021'.

lo_gos->set_object(
EXPORTING is_lporb = l_sib
          ip_default_attribute = l_ip
  IMPORTING
          ep_status = l_status
          ep_icon = l_icon ).

lo_gos->execute( ).

"Não esquecer do COMMIT
COMMIT WORK AND WAIT.

UKM_CASE - Incluindo botão adicional na tela de solicitação de crédito

 Transação SCASE_CUSTOMIZING


- Definir um código de função primeiro



- Criar perfil da função 


- Implementar BADI

    - Definição SCMG_CASE_FCODE_S






quinta-feira, 14 de outubro de 2021

BADI - Transação UKM_CASE - Preenchimento de campos na inicialização

 Definição SCMG_INITIALIZE_C

Implementação com filtro. No caso da UKM_CASE


Implementação do método.

No meu caso, defini um valor padrão para o segmento de crédito '0000'

    DATA: l_help           TYPE string.

    TRY.
        CALL METHOD im_case->get_single_attribute_value
          EXPORTING
            im_srmadid = 'FCR_SEGMENT'
          RECEIVING
            re_value   = l_help.

        IF l_help IS INITIAL.
          l_help = '0000'.
        ENDIF.

*     set currency to prevent UI-error due to initial currency
        CALL METHOD im_case->set_single_attribute_value
          EXPORTING
            im_value   = l_help
            im_srmadid = 'FCR_SEGMENT'.

      CATCH cx_srm_framework .
      CATCH cx_scmg_case_attribute .
    ENDTRY.


RESULTADO.



quarta-feira, 13 de outubro de 2021

CL_SALV_TABLE - Filtro dentro de evento hotspot - erro na atualização da tela

 Situação de tela com 2 ALV em tela SPLIT, no ALV superior com campo hotspot, e no ALV inferior lista de itens do item superior selecionado.

 ALV inferior utilizando classes SALV, tentei utilizar o filtro, mas a tela não atualizava, tentei forçar o PBO utilizando o método 

CALL METHOD cl_gui_cfw=>set_new_ok_code

 EXPORTING

          new_code = 'REFRESH'.

mas também não funcionou.

Para resolver tive que carregar os dados novamente com o filtro. Um detalhe é q tive q carregar todos os dados, anteriormente tentei montar uma tabela interna com o filtro, até atualizava a tela, mas não sei o que acontece mas ao rolar o scroll lateral no final da página dava um DUMP, me parece q ele se perde no contador de linhas. Mas sempre carregando tudo funciona sem problema.


  READ TABLE gt_dados INDEX fu_row-index
                      INTO DATA(ls_dados).

  CHECK sy-subrc = 0.

  DATA(lo_filters) = o_alv_item->get_filters( ).
  lo_filters->remove_filter('MATNR').

  l_low =  ls_dados-matnr.
  lo_filters->add_filter(
  columnname = 'MATNR'
  low = l_low
  ).

  o_alv_item->set_data( CHANGING t_table = gt_acdoca ).

  o_alv_item->refresh( ).