Cristian-Paolini

Create Entity Compañía

Jul 22nd, 2022 (edited)
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 0.77 KB | None | 0 0
  1.   METHOD companiaset_create_entity.
  2.  
  3.     DATA:
  4.       wa_nueva_compania    TYPE ztca_companias_p,
  5.       lv_id_nueva_compania TYPE ztca_companias_p-id_compania.
  6.  
  7.     io_data_provider->read_entry_data(
  8.       IMPORTING
  9.         es_data = er_entity
  10.     ).
  11.  
  12.     MOVE-CORRESPONDING er_entity TO wa_nueva_compania.
  13.  
  14.     SELECT MAX( id_compania ) FROM ztca_companias_p
  15.       INTO lv_id_nueva_compania.
  16.     IF sy-subrc EQ 0.
  17.       lv_id_nueva_compania = lv_id_nueva_compania + 1.
  18.     ELSE.
  19.       lv_id_nueva_compania = 1.
  20.     ENDIF.
  21.     wa_nueva_compania-id_compania = lv_id_nueva_compania.
  22.     er_entity-id_compania = lv_id_nueva_compania.
  23.  
  24.     INSERT ztca_companias_p FROM wa_nueva_compania.
  25.     IF sy-subrc NE 0.
  26.       er_entity-id_compania = 0.
  27.     ENDIF.
  28.   ENDMETHOD.
Add Comment
Please, Sign In to add comment