quinta-feira, 2 de setembro de 2021

Erro ao carregar aplicativo FIORI criado no VS code no S4

 Eu tinha um aplicativo criado no VS code que testava e funcionava sem problema, quando eu importei no S4, dava erro ao carregar a aplicação no browser..

no console do browser - chrome apresentava erro na biblioteca sap.m.f.layouttype.js


busquei várias informações sobre o problema e não achava o pq do erro.  Até q comecei a procurar alguma coisa fora disso e encontrei uma informação q resolvi o problema.

substitui a chamada no INDEX.HTML na linha do src

<script
    id="sap-ui-bootstrap"
    src="resources/sap-ui-core.js"
    data-sap-ui-theme="sap_fiori_3"
    data-sap-ui-resourceroots='{
            "rvf.remvfut": "."
        }'
    data-sap-ui-compatVersion="edge"
    data-sap-ui-async="true"
    data-sap-ui-preload="async"
    data-sap-ui-libs="sap.m">
</script>

Substitui por:

<script
    id="sap-ui-bootstrap"
    src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
    data-sap-ui-theme="sap_fiori_3"
    data-sap-ui-resourceroots='{
            "rvf.remvfut": "."
        }'
    data-sap-ui-compatVersion="edge"
    data-sap-ui-async="true"
    data-sap-ui-preload="async"
    data-sap-ui-libs="sap.m">
</script>


quarta-feira, 1 de setembro de 2021

Erro 0K 407 - falta modelo sap_sm.xls

 Verificar a nota 1937247 - How to manage SAP standard templates [Video]

Importar o arquivo  .zip da nota 1686797 

Apesar da nota 1937247 falar  para importar no client 000, pode fazer direto no ambiente q está com erro



domingo, 29 de agosto de 2021

CDS view - Search help com descrição do texto

 Exemplo, descrição do material

Importante  lembrar de colocar a categoria de dados e a semantica de texto


@AbapCatalog.sqlViewName: 'ZDDV_CDS_SZK_T8'

@AbapCatalog.compiler.compareFilter: true

@AbapCatalog.preserveKey: true

@ObjectModel.dataCategory: #TEXT

@AccessControl.authorizationCheck: #CHECK

@EndUserText.label: 'Material'

@OData.publish: true


define view ZDD_CDS_SZK_T8 as select from makt

 {

 key matnr as CodMat,

      @Semantics.text: true

      @EndUserText.label: 'Descrição'

      cast(maktx as abap.char(30)) as Mattxt


} where spras = $session.system_language


--- Na view principal

define view ZDD_CDS_SZK_T3

  as select from vbak as A

  association [1..*] to zdd_cds_szk_t6 as _ItemOV   on $projection.DocVen = _ItemOV.Vbeln

  association [1]    to ZDD_CDS_SZK_T4 as _SalesOrg on $projection.OrgVen = _SalesOrg.SalesOrganization

  association [1] to ZDD_CDS_SZK_T7 as _ItemOVSum   on $projection.DocVen = _ItemOVSum.Vbeln

  association [1] to ZDD_CDS_SZK_T8 as _MatF4  on $projection.CodMat = _MatF4.CodMat

{


      @UI.facet: [

      {

      id: 'Info',

      type: #DATAPOINT_REFERENCE,

      purpose: #HEADER,

      position: 10,

      qualifier: 'OrgVenda'

       },

       -- facet de corpo

       {

      id: 'Dados',

      label: 'Info geral',

      type: #COLLECTION,

      purpose: #STANDARD,

      position: 10

       },

       {

      label: 'Dados NF',

      type: #IDENTIFICATION_REFERENCE,

      purpose: #STANDARD,

      position: 10,

      parentId: 'Dados'

       },

       {

       id: 'Item',

       type: #LINEITEM_REFERENCE,

       purpose: #STANDARD,

       targetElement: '_ItemOV',

       position: 20

       }


       ]

     

      @ObjectModel.text.association: '_MatF4'

     

      @UI.lineItem: [{ position: 10 }]

  key A.vbeln                            as DocVen,

      @UI.lineItem: [{ position: 30 }]

      @UI.selectionField: [{position: 30}]

      @ObjectModel.foreignKey.association: '_SalesOrg'

      @Consumption.filter: { selectionType: #RANGE, multipleSelections: true }

      @UI.dataPoint: { qualifier: 'OrgVenda', title: 'Organização de vendas' }

      A.vkorg                            as OrgVen,

      @UI.lineItem: [{ position: 40 }]

      @UI.selectionField: [{position: 40}]

      @UI.dataPoint: { title: 'Canal de distribuição' }

      A.vtweg                            as CanDist,

      @UI.lineItem: [{ position: 50 }]

      @UI.selectionField: [{position: 50}]

      @UI.identification: [{ position: 10 }]

      A.spart                            as SetAtiv,

      @UI.dataPoint: { title: 'Cliente' }

      A.kunnr                            as CodCli,

      @UI.hidden: true

      A.auart                            as TpOV,

      (concat('Doc.Venda :', A.vbeln ) ) as TxtDoc,

      case  

      when _ItemOVSum.SomaTotal < 10 then 1

      else 3 

      end as StatusCor,

      @UI.lineItem: [{ position: 60 },

                     { criticality: 'StatusCor', value: 'TotalQtd' }]

      _ItemOVSum.SomaTotal as TotalQtd,      

       

      _ItemOVSum.totitem as TotItem,             

      

     @UI.selectionField: [{position: 50}]  

      @ObjectModel.foreignKey.association: '_MatF4'

      @Search.defaultSearchElement: true

      --@Consumption.filter: { selectionType: #RANGE, multipleSelections: true }

      _ItemOV.Matnr as CodMat,

             

      _ItemOV,

      _ItemOVSum,

      _SalesOrg,

      _MatF4

      

}



quinta-feira, 19 de agosto de 2021

Teclas de atalho eclipse para abap

https://blogs.sap.com/2013/11/21/useful-keyboard-shortcuts-for-abap-in-eclipse/

 Editing source code:

ShortcutWhat it will do
CTRL+DDeletes the selected codeline
CTRL+SHIFT+DELETEDeletes the content from the cursor postion to the end of the line
CTRL+DELETEDeletes the next word in the editor
CTRL+BACKSPACEDeletes the previous word in the editor
ALT+UP/DOWNMoves the selected codelines up/down in the editor
CTRL+ALT+UP/DOWNDuplicates Codelines before/after the selected codeline
CTRL+UP/DOWNScrolls Line up/down
SHIFT+ENTERAdds a new line below the current line and positions the cursor in that line
CTRL+SHIFT+ENTERAdds a new line above the current line and positions the cursor in that line
CTRL+ZUndo changes
ALT+SHIFT+RRename the selected object, e.g. variable, method, class
CTRL+1Opens Quickfix/Quickassist Dialog on the selected element
CTRL+7Comments/Uncomments selected code in the editor
SHIFT+F1Formats the source code (aka. Pretty Printer)
CTRL+SHIFT+F1Formats the marked source code or source code block (e.g. method)
CTRL+NCreates new development object
CTRL+SHIFT+XConvert marked editor content to upper case
CTRL+SHIFT+YConvert marked editor content to lower case
CTRL+UUnlock Editor

Navigation:

CTRL-LJump to line in editor
CTRL-OLaunch the quick outline
ALT+LEFT/RIGHTNavigate through the editor navigation history
CTRL+ ; / :Step quickly through the editormarkers, like tasks, bookmarks, error markers, ATC findings etc.
F3Navigate to the definition of the selected element, e.g. variable, method, attribute etc.

Editor Tabs:

CTRL + EDisplays a list of all open editors
CTRL + F6Easily switch between the editor tabs (Like Tab for Windows)
CTRL + F7Easily switch between all eclipse views
CTRL + F8Easily switch between the perspectives
CTRL + MMaximize the active editor or viewer to full-screen mode
CTRL+3Easily open Eclipse views or trigger command via the Quick Access Inputfield
CTRL+PAGE UP/PAGE DOWNNavigate through the editor tabs forward and backward
ALT+PAGE UP/PAGE DOWNNavigate through the tabs of the class editor between global class, local class and test classes
CTRL + F4Close the active editor tab
CTRL+SHIFT+F4Close all editor tabs

Debugging:

CTRL+SHIFT+BSet a line break point in the ABAP editor

quarta-feira, 16 de junho de 2021

SM30 - Customer button updating screen in runtime

 I always have been problem with customers modification in SM30, to save I use some specific events to change simple fields like user/date/time, but to update the fields in runtime it is not so easy because the specific standard controls and tables.

In my example I created a button in the maintanaince view ( making a copy from standard user interface ) to update a specific field in the view. 

The button "Atualiza NF" to update de column "Document number"



I created a module PAI to system recognize the function code.


the form code

I use de loop in table EXTRACT where it is used the field symbol <vim_extract_struc>.

When the structure <vim_extract_struc> is move to field symbol <table1> automatically the field symbol <f1_x> is set with the values as a key to table  TOTAL 


....

  LOOP AT extract.

    DATA(l_tabixsy-tabix.

    "When the structure <vim_extract_struc> is move to field symbol <table1> automatically the field
       "
symbol <f1_x> is set with the values as a key to table  TOTAL as you can see in below in the               "READ TABLE total

    MOVE <vim_extract_struc> TO <table1>.


    ASSIGN COMPONENT 'CD_CARREGAMENTO' OF STRUCTURE <vim_extract_struc>
                                       TO FIELD-SYMBOL(<l_cd_carr>).
    CHECK sy-subrc 0.

.....

    MOVE <table1> TO <vim_extract_struc>.
    MODIFY extract INDEX l_tabix.
   

    READ TABLE total WITH KEY <f1_x> BINARY SEARCH.
    MOVE <table1> TO <vim_total_struc>.

    "As the <table1> in the right line, the field symbol <ACTION> have to be filled

    "with "U"(update) to when you click the button "SAVE" the modified data be "posted.

    <action> 'U'.
    MODIFY total INDEX sy-tabix.

ENDLOOP.

......

quinta-feira, 11 de março de 2021

WS_DELIVERY_UPDATE_2 - Atualização lote fornecedor

Flag padrão para criação de lote

        <ls_item>-taqui 'X'.
        <ls_item>-lianp 'X'.

Tive q fazer uma inclusão na exit de remessa MV50AFZ1

Form userexit_save_document_prepare

FIELD-SYMBOLS <lfs_tab_vbpok> TYPE ANY TABLE.

DATA: lt_vbpok_tab TYPE TABLE OF vbpok.

ASSIGN ('(SAPLV50S)VBPOK_TAB[]') TO <lfs_tab_vbpok>.
IF sy-subrc = 0.

  lt_vbpok_tab[] = <lfs_tab_vbpok>.

  LOOP AT xlips ASSIGNING FIELD-SYMBOL(<lfs_xlips).

    READ TABLE lt_vbpok_tab INTO DATA(ls_vbpok)
                                WITH KEY posnr_vl = <lfs_xlips>-posnr.

    IF sy-subrc = 0 AND ls_vbpok-lichn IS NOT INITIAL.
      <lfs_xlips>-lichn = ls_vbpok-lichn.
    ENDIF.

  ENDLOOP.

ENDIF.


GN_DELIVERY_CREATE - Criação recebimento VL31N - Preenchimento de parâmetros

 Parâmetros básicos para criação de recebimento

DATAls_vbsk TYPE vbsk.
DATAlt_komdlgn TYPE TABLE OF komdlgn,
      lt_vbfs    TYPE TABLE OF vbfs,
      lt_vbls    TYPE TABLE OF vbls.

CLEAR ls_vbsk.

APPEND INITIAL LINE TO lt_komdlgn ASSIGNING FIELD-SYMBOL(<ls_komdlgn>).
<ls_komdlgn>-lfart 'EL'.
<ls_komdlgn>-matnr ??.
<ls_komdlgn>-werks ??.
<ls_komdlgn>-lfdat sy-datum.
<ls_komdlgn>-lfimg ??.
<ls_komdlgn>-vrkme ??.
<ls_komdlgn>-meins ??.
<ls_komdlgn>-vgbel <pedido de compra>.
<ls_komdlgn>-vgpos <item pedido de compra>.
<ls_komdlgn>-vgtyp 'V'.
<ls_komdlgn>-lgort ??.
<ls_komdlgn>-lifnr ??.

CALL FUNCTION 'GN_DELIVERY_CREATE'
  EXPORTING
    vbsk_i   ls_vbsk
  TABLES
    xkomdlgn lt_komdlgn
    xvbfs    lt_vbfs "Erros se houver
    xvbls    lt_vbls"Recebimento criado.