ABAP~SAP ~ Brincando com TYPES





O Types no Abap é a definição de um modelo de dados. Seria como se fosse o blueprint ou a planta de uma casa. Você não consegue morar na planta, ela serve apenas como um modelo para uma casa onde é possível morar.

Ele também simula um objeto no repositório.

Seguem algumas dicas de declaração com types para usar onde for necessário:

1. Types com Types filhos:


    typesbegin of ty_yfather,

             nome type string,

             begin of son,

               rua type string,
               num type string,
             end of son

           end of ty_yfather.


          
2. Types com uma tabela interna:



    typesbegin of ty_ydados,
             latitude  type string,
             longitude type string,
             time      type string,
           end of ty_ydados.


    typesbegin of ty_yfather,

             nome type string,

             begin of son,

               rua type string,
               num type string,
             end of son
            
              dados type STANDARD TABLE OF ty_ydados with DEFAULT KEY

           end of ty_yfather.


Note que o "with default key" é quem permite essa referência

3. Incluindo uma tabela/estrutura


    typesbegin of ty_yfather.

            include type spfli.

    types:    end of ty_yfather.






0 comentários:

SAP~UI5 Utilizando uma constante no Expression Binding


                       

Se você quiser passar uma constante no Expression Binding, aqui tem um exemplo muito bom:

<MenuItem icon="sap-icon://create" text="New Root"
                          press="onMenuItemPressed"
                          key="NEWR"
                          startsSection="true"
                          visible="{ parts: [{value:'xxx'},{path: 'menuTreeModel>type'},
{path:        'globalModel>/editMode'}],
 formatter: '.formatter.getEditableMenuContextAdd'}"/>

Veja que o {value:'xxx'} força passar uma constante que neste caso será utilizada em um formatter implementado no App.

Outro exemplo:

<Input width="200px" enabled="{/enabled}" description="{/currencyCode}"
                   value="{
parts: [
{value: '1.200'},
{value: 'URL'}
],
type: 'sap.ui.model.type.Currency',
formatOptions: {showMeasure: false}
}"/>

Enjoy.

0 comentários:

Copyright © 2013 ABAP SAP - AbapFox! Aprenda ABAP Definitivamente