O Conhecimento

O conhecimento é inútil a menos que você o compartilhe.

Mostrando postagens com marcador ESPECIFICAÇÂO. Mostrar todas as postagens
Mostrando postagens com marcador ESPECIFICAÇÂO. Mostrar todas as postagens

sexta-feira, 1 de junho de 2012

Rotina para preencher as estruturas com das bapis com 'X', 100% bala.....


*--------------------------------------------------------------------*
*   Shipping
*--------------------------------------------------------------------*
  REFRESH lt_shippingx.
  PERFORM fill_x_structure CHANGING ls_shippingx.
  LOOP AT lt_shipping INTO ls_shipping.
    ls_shippingx-item_no = ls_shipping-item_no.
    APPEND ls_shippingx TO lt_shippingx.
  ENDLOOP.
ENDFORM.                    " INICIALIZA_ESTRUTURAS

*&---------------------------------------------------------------------*
*&      Form  fill_x_structure
*&---------------------------------------------------------------------*
*       create x-bar per requested parameter
*       all fields will be marked with an 'X' -> change relevant
*----------------------------------------------------------------------*
FORM fill_x_structure  CHANGING cs_x_structure TYPE any.
  DATA: lr_struct TYPE REF TO cl_abap_structdescr,
        lr_field  TYPE REF TO cl_abap_elemdescr.
  FIELD-SYMBOLS: <comp> LIKE LINE OF cl_abap_structdescr=>components,
                <x>    TYPE ANY.
  lr_struct ?= cl_abap_typedescr=>describe_by_data( cs_x_structure ).
  CHECK lr_struct IS BOUND.
  LOOP AT lr_struct->components ASSIGNING <comp>.
    UNASSIGN <x>.
*  take only x fields into consideration, if unicode is active C1 takes 2 bytes
    CHECK <comp>-type_kind EQ lr_struct->typekind_char.
    ASSIGN COMPONENT <comp>-name OF STRUCTURE cs_x_structure TO <x>.
    CHECK <x> IS ASSIGNED.
*  get element description
    lr_field ?= cl_abap_typedescr=>describe_by_data( <x> ).
    CHECK lr_field->absolute_name EQ '\TYPE=BAPIUPDATE'.
    <x> = cl_mmpur_constants=>yes.
  ENDLOOP.
ENDFORM.                    " fill_x_structure
 
Blogger Templates