===== CHAMADA
determination preenche_campos on save { create; }
====== Implementação do método
METHOD preenche_campos.
READ ENTITIES OF ZI_XXXX IN LOCAL MODE
ENTITY Item
FIELDS ( posnr )
WITH CORRESPONDING #( keys )
RESULT DATA(lt_item).
READ ENTITIES OF ZI_XXXX IN LOCAL MODE
ENTITY Header
FIELDS ( id Opertyp )
WITH CORRESPONDING #( keys )
RESULT DATA(lt_header).
CHECK lt_header IS NOT INITIAL.
DATA(ls_header) = lt_header[ 1 ].
CHECK ls_header-Opertyp = zcl_sd_XXXX=>c_tipo_op-sem_retorno.
SELECT COUNT( * )
FROM ztsd_XXXX
WHERE id = ls_header-Id.
DATA(lv_posnr) = CONV posnr( sy-dbcnt ) * 10.
LOOP AT lt_item REFERENCE INTO DATA(lr_item).
MODIFY ENTITIES OF ZI_XXXX IN LOCAL MODE
ENTITY Item
UPDATE FIELDS ( posnr )
WITH VALUE #( ( %tky = lr_item->%tky posnr = lv_posnr %control-Posnr = if_abap_behv=>mk-on ) ).
ENDLOOP.
ENDMETHOD.
Nenhum comentário:
Postar um comentário