viernes, 4 de noviembre de 2016

SAVE_TEXT

  data:
   ltd_tlines  like tline occurs 0 with header line,
   lwa_header  type thead.

*{ +@RMA6369
  data: ls_id type thead-tdid,
        ls_name type thead-tdname,
        ls_objeto type thead-tdobject,
        ls_lines type standard table of tline,
        ls_header type thead,
        ls_tabla type standard table of thead.
*} +@RMA6369

  lwa_header-tdobject = 'EKKO'.
  lwa_header-tdname   = ip_ebeln.
  lwa_header-tdid     = 'F02'.
  lwa_header-tdspras  = 'S'.

  ltd_tlines-tdformat = '*'.
  ltd_tlines-tdline   = ip_mblnr5.
  append ltd_tlines.

  call function 'SAVE_TEXT'
    exporting
      client          = sy-mandt
      header          = lwa_header
      savemode_direct = 'X'
    tables
      lines           = ltd_tlines
    exceptions
      id              = 1
      language        = 2
      name            = 3
      object          = 4
      others          = 5.

  if sy-subrc <> 0.
*  ----------ERROR.
  else.
*  ----------EXITO.
  endif.

*{ +@RMA6369
  ls_objeto = 'EKPO'.
  concatenate ip_ebeln '00010' into ls_name.
  ls_id     = 'F01'.

  call function 'SELECT_TEXT'
    exporting
      id         = ls_id
      language   = sy-langu
      name       = ls_name
      object     = ls_objeto
    importing
      entries    = sy-tfill
    tables
      selections = ls_tabla.

  if sy-tfill = 0.
    call function 'INIT_TEXT'
      exporting
        id       = ls_id
        language = sy-langu
        name     = ls_name
        object   = ls_objeto
      importing
        header   = ls_header
      tables
        lines    = ls_lines
      exceptions
        id       = 1
        language = 2
        name     = 3
        object   = 4.

  else.
    call function 'READ_TEXT'
      exporting
        id              = ls_id
        language        = sy-langu
        name            = ls_name
        object          = ls_objeto
      importing
        header          = ls_header
      tables
        lines           = ls_lines
      exceptions
        id              = 1
        language        = 2
        name            = 3
        not_found       = 4
        object          = 5
        reference_check = 6.

  endif.
  call function 'EDIT_TEXT'
    exporting
      header = ls_header
      save   = 'X'
    tables
      lines  = ls_lines.

  call function 'SAVE_TEXT'
    exporting
      header          = ls_header
      savemode_direct = 'X'
    tables
      lines           = ls_lines.
*} +@RMA6369

No hay comentarios:

Publicar un comentario