Difference between revisions of "SAP CRM"

From SapWiki
(Created page with "==CRM_ORDER_MAINTAIN== <nowiki> FUNCTION ZCRM_ORDER_TIMESTAMP. *"---------------------------------------------------------------------- *"*"Interfase local *" IMPORTING *"...")
 
 
(5 intermediate revisions by the same user not shown)
Line 13: Line 13:
 
*"      UPDATE_FAILED
 
*"      UPDATE_FAILED
 
*"----------------------------------------------------------------------
 
*"----------------------------------------------------------------------
 
 
 
*    Requerimiento CRA-08-07. Fecha real
 
*    Requerimiento CRA-08-07. Fecha real
  
Line 223: Line 221:
 
       raise update_failed.
 
       raise update_failed.
 
     ENDIF.
 
     ENDIF.
 
 
   endif.
 
   endif.
 
  
 
endfunction.
 
endfunction.
Line 270: Line 266:
 
*  IV_FROM_INIT      = FALSE
 
*  IV_FROM_INIT      = FALSE
 
               .
 
               .
 
 
     commit work and wait.
 
     commit work and wait.
  
 
ENDFUNCTION.
 
ENDFUNCTION.
 +
</nowiki>
 +
 +
==Tablas CRM==
 +
* crmd_orderadm_h : datos de contrato
 +
* BUT000 : Interlocutor Comercial
 +
* [https://wiki.scn.sap.com/wiki/display/CRM/CRM+Tables?original_fqdn=wiki.sdn.sap.com Tablas CRM]
 +
 +
==Funciones==
 +
===BUPA_RELATIONSHIPS_GET===
 +
to get all the relationships for a BP.
 +
<nowiki>
 +
* Se debe obtener la lista de trabajadores que posee la empresa en la BD de Clientes
 +
  CALL FUNCTION 'BAPI_BUPA_RELATIONSHIPS_GET'
 +
    EXPORTING
 +
      businesspartner = lt_empresa-partner
 +
    TABLES
 +
      relationships  = lt_relations
 +
      return          = lt_errores.
 +
 +
  LOOP AT lt_relations WHERE relationshipcategory = 'CRMM02' AND partner1 = lt_empresa-partner.
 +
*  Por cada partner de trabajador se busca su rut
 +
    SELECT SINGLE bpext INTO ld_bpext_aux FROM but000 WHERE partner = lt_relations-partner2.
 +
  endloop.
 +
</nowiki>
 +
===BAPI_BUPA_CREATE_FROM_DATA===
 +
===BAPI_BUPA_ADDRESS_GETDETAIL===
 +
==Ejemplo ABAP CRM==
 +
<nowiki>
 +
FORM f_datos_generales_ticket .
 +
 +
  SELECT  distinct
 +
          t1~guid
 +
*          t7~partner
 +
          t3~guid as guid2
 +
          t1~object_id t2~stat
 +
          t9~codegruppe
 +
          t9~code
 +
"          t7~partner_guid
 +
    INTO CORRESPONDING FIELDS OF TABLE gt_join
 +
  FROM    ( ( ( ( ( ( (
 +
    "( ( ( ( ( ( (
 +
 +
      crmd_orderadm_h AS t1 INNER JOIN crm_jest AS t2 ON
 +
          t1~guid = t2~objnr )
 +
    INNER JOIN crmd_orderadm_i AS t3 ON
 +
          t1~guid = t3~header )
 +
    INNER JOIN crmd_link AS enlace ON
 +
          t1~guid  = enlace~guid_hi )
 +
    INNER JOIN crmd_link AS t4 ON
 +
          t3~guid  = t4~guid_hi )
 +
    INNER JOIN crmd_partner AS t5 ON
 +
          enlace~guid_set = t5~guid )
 +
    INNER JOIN crmd_srv_osset  AS t6 ON
 +
          t4~guid_set  = t6~guid_set )
 +
*    INNER JOIN but000 AS t7 ON
 +
*          t5~relation_partner = t7~partner_guid )
 +
*    INNER JOIN but020 AS t8 ON
 +
*          t7~partner = t8~partner )
 +
    INNER JOIN crmd_srv_subject AS t9 ON
 +
          t6~guid = t9~guid_ref )
 +
    WHERE
 +
          t2~stat        in r_stat  and"    LIKE 'E%' AND
 +
          t2~inact        NE 'X' and
 +
          t1~POSTING_DATE GE FECHA_SELEC and
 +
          t1~process_type in r_proces and
 +
          t9~codegruppe  eq 'ZRV1'.
 +
 +
  gti_join[] = gt_join[].
 +
clear: gt_join.
 +
 +
  SELECT  distinct
 +
          t1~guid
 +
*          t7~partner
 +
          t3~guid as guid2
 +
          t1~object_id t2~stat
 +
          t9~codegruppe
 +
          t9~code
 +
"          t7~partner_guid
 +
    INTO CORRESPONDING FIELDS OF TABLE gt_join
 +
  FROM    ( ( ( ( ( ( (
 +
    "( ( ( ( ( ( (
 +
 +
      crmd_orderadm_h AS t1 INNER JOIN crm_jest AS t2 ON
 +
          t1~guid = t2~objnr )
 +
    INNER JOIN crmd_orderadm_i AS t3 ON
 +
          t1~guid = t3~header )
 +
    INNER JOIN crmd_link AS enlace ON
 +
          t1~guid  = enlace~guid_hi )
 +
    INNER JOIN crmd_link AS t4 ON
 +
          t3~guid  = t4~guid_hi )
 +
    INNER JOIN crmd_partner AS t5 ON
 +
          enlace~guid_set = t5~guid )
 +
    INNER JOIN crmd_srv_osset  AS t6 ON
 +
          t4~guid_set  = t6~guid_set )
 +
*    INNER JOIN but000 AS t7 ON
 +
*          t5~relation_partner = t7~partner_guid )
 +
*    INNER JOIN but020 AS t8 ON
 +
*          t7~partner = t8~partner )
 +
    INNER JOIN crmd_srv_subject AS t9 ON
 +
          t6~guid = t9~guid_ref )
 +
    WHERE
 +
          t2~stat        in r_stat  and"    LIKE 'E%' AND
 +
          t2~inact        NE 'X' and
 +
          t1~POSTING_DATE GE FECHA_SELEC and
 +
          t1~process_type in r_proces and
 +
          t9~codegruppe  eq 'ZSVE' AND
 +
          t9~code        in  r_code.
 +
 +
loop at gt_join into gs_join.
 +
      APPEND gs_join to gti_join.
 +
endloop.
 +
 +
gt_join[] = gti_join[].
 +
 +
loop at gt_join into gs_join.
 +
 +
* Busca o Cliente do Rechamado
 +
          CALL FUNCTION 'CRM_ORDERADM_I_READ_PARTNER_OW'
 +
            EXPORTING
 +
              iv_header          = gs_join-guid
 +
            IMPORTING
 +
              es_main_partner_wrk = wa_crmt_partner_external_wrk.
 +
 +
          ty_ticket_int-partner = wa_crmt_partner_external_wrk-ref_partner_no+2(7).
 +
          ty_ticket_int-objeto  = gs_join-guid.
 +
          ty_ticket_int-guid    = gs_join-object_id.
 +
          ty_ticket_int-estat  = gs_join-stat.
 +
          ty_ticket_int-CODEGRUPPE    = gs_join-CODEGRUPPE.
 +
          ty_ticket_int-CODE  = gs_join-CODE.
 +
** texto del ticket
 +
          perform observs.
 +
          ty_ticket_int-texto  =  texto.
 +
          APPEND ty_ticket_int.
 +
endloop.
 +
ENDFORM.                    " F_DATOS_GENERALES_TICKET
 
</nowiki>
 
</nowiki>

Latest revision as of 18:53, 28 July 2022

CRM_ORDER_MAINTAIN

FUNCTION ZCRM_ORDER_TIMESTAMP.
*"----------------------------------------------------------------------
*"*"Interfase local
*"  IMPORTING
*"     VALUE(IV_GUID) TYPE  CRMT_OBJECT_GUID
*"     VALUE(IV_APPTYPE) TYPE  CRMT_APPTYPE
*"     VALUE(IV_TIMESTAMP_TO) TYPE  CRMT_TIMESTAMP OPTIONAL
*"     VALUE(IV_TIMESTAMP_FROM) TYPE  CRMT_TIMESTAMP OPTIONAL
*"     VALUE(IV_COMMIT_FLAG) TYPE  CHAR1 OPTIONAL
*"  EXCEPTIONS
*"      UPDATE_FAILED
*"----------------------------------------------------------------------
*     Requerimiento CRA-08-07. Fecha real

* Guid para trabajar con la función de lectura.
  data: WV_GUID            like          IV_GUID,
        WT_GUID            type          CRMT_OBJECT_GUID_TAB.

* Cabecera de administración del doc. vecino.
  data: WT_ORDERADM_H      type          CRMT_ORDERADM_H_WRKT,
        WS_ORDERADM_H      type line of  CRMT_ORDERADM_H_WRKT.

* Status del documento vecino.
  data: WT_STATUS          type          CRMT_STATUS_WRKT,
        WS_STATUS          type line of  CRMT_STATUS_WRKT.

* Apuntes
  data: WT_APPOINTMENT      type         CRMT_APPOINTMENT_WRKT,
        WS_APPOINTMENT      type line of CRMT_APPOINTMENT_WRKT.

* Objetos pendientes de grabar
  data: WT_OBJECTS_TO_SAVE  type         CRMT_OBJECT_NAME_TAB,
        WS_OBJECTS_TO_SAVE  type line of CRMT_OBJECT_NAME_TAB.

* Información para la modificación global.
  data: WT_M_INPUT_FIELDS     type         CRMT_INPUT_FIELD_TAB,
        WS_M_INPUT_FIELDS     type line of CRMT_INPUT_FIELD_TAB,
        WT_M_INPUT_FIELD_NAMES  type       CRMT_INPUT_FIELD_NAMES_TAB,
        WS_M_INPUT_FIELD_NAMES  type line of CRMT_INPUT_FIELD_NAMES_TAB,
        WT_M_ACTIVITY_H       type         CRMT_ACTIVITY_H_COMT,
        WS_M_ACTIVITY_H       type line of CRMT_ACTIVITY_H_COMT,
        WT_M_APPOINTMENT      type         CRMT_APPOINTMENT_COMT,
        WS_M_APPOINTMENT      type line of CRMT_APPOINTMENT_COMT.

* Estado modificado.
  data: WV_CHANGED.

* Apunte IV_APPTYPE, clave para modificación.
  data: WS_LOGICAL_DATE_KEY type         CRMT_DATE_LOGICAL_DATE_KEY.

  data: lv_TZNZONESYS type TZNZONESYS.

clear: WS_M_APPOINTMENT, WS_M_ACTIVITY_H, WS_M_INPUT_FIELD_NAMES,
       WS_M_INPUT_FIELDS, WS_OBJECTS_TO_SAVE, WS_APPOINTMENT,
       WS_STATUS, WS_ORDERADM_H, wv_guid.
clear: WT_M_APPOINTMENT, WT_M_ACTIVITY_H, WT_M_INPUT_FIELD_NAMES,
       WT_M_INPUT_FIELDS, WT_OBJECTS_TO_SAVE, WT_APPOINTMENT,
       WT_STATUS, WT_ORDERADM_H, WT_GUID.
refresh: WT_M_APPOINTMENT, WT_M_ACTIVITY_H, WT_M_INPUT_FIELD_NAMES,
       WT_M_INPUT_FIELDS, WT_OBJECTS_TO_SAVE, WT_APPOINTMENT,
       WT_STATUS, WT_ORDERADM_H, WT_GUID.

  check not IV_TIMESTAMP_TO is initial or
        not IV_TIMESTAMP_FROM is initial.

* Recupera los status de los vecinos aceptados.
  append IV_GUID to WT_GUID.
  call function 'CRM_ORDER_READ'
    EXPORTING
      IT_HEADER_GUID       = WT_GUID
    IMPORTING
      ET_ORDERADM_H        = WT_ORDERADM_H
      ET_STATUS            = WT_STATUS
      ET_APPOINTMENT       = WT_APPOINTMENT
    EXCEPTIONS
      DOCUMENT_NOT_FOUND   = 1
      ERROR_OCCURRED       = 2
      DOCUMENT_LOCKED      = 3
      NO_CHANGE_AUTHORITY  = 4
      NO_DISPLAY_AUTHORITY = 5
      NO_CHANGE_ALLOWED    = 6
      others               = 7.
  if SY-SUBRC <> 0.
    message id SY-MSGID type SY-MSGTY number SY-MSGNO
            with SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  endif.

** Verifica el cambio de estado.
*  call function 'CRM_ORDER_GET_OBJECTS_TO_SAVE'
*    exporting
*      IV_REF_GUID        = IV_GUID
*      IV_REF_KIND        = 'A'
*    importing
*      ET_OBJECTS_TO_SAVE = WT_OBJECTS_TO_SAVE.
*
*  clear WV_CHANGED.
*  loop at WT_OBJECTS_TO_SAVE into WS_OBJECTS_TO_SAVE.
*    if WS_OBJECTS_TO_SAVE = 'STATUS'.
*      loop at WT_STATUS into WS_STATUS.
*        if WS_STATUS-STATUS = 'I1005'.
*          WV_CHANGED = 'X'.
*          exit.
*        endif.
*      endloop.
*      if WV_CHANGED = SPACE.
*        exit.
*      endif.
*    endif.
*  endloop.
*
** El resto del código solo tiene sentido si se ha cambiado el
** status a cerrado.
*  check WV_CHANGED = 'X'.

  read table WT_APPOINTMENT into WS_APPOINTMENT
    with key APPT_TYPE = IV_APPTYPE.

*  check SY-SUBRC = 0.

  read table WT_ORDERADM_H into WS_ORDERADM_H index 1.

* Cambia las fechas del apunte.
* ADVERTENCIA: Cambiar datos por datos del systema!!!!

* Zona horaria del sistema
*  select single TZONESYS
*    from TTZCU
*    into lv_TZNZONESYS.
*clear lv_TZNZONESYS.

  if not IV_TIMESTAMP_FROM is initial.
    convert time stamp IV_TIMESTAMP_FROM
            time zone  lv_TZNZONESYS
            into date  WS_APPOINTMENT-DATE_FROM
                 time  WS_APPOINTMENT-TIME_FROM.

    convert date       WS_APPOINTMENT-DATE_FROM
            time       WS_APPOINTMENT-TIME_FROM
       into time stamp WS_APPOINTMENT-TIMESTAMP_FROM
            time zone  WS_APPOINTMENT-TIMEZONE_FROM.
  endif.

  if not IV_TIMESTAMP_TO is initial.
    convert time stamp IV_TIMESTAMP_TO
            time zone  lv_TZNZONESYS
            into date  WS_APPOINTMENT-DATE_TO
                 time  WS_APPOINTMENT-TIME_TO.

    convert date       WS_APPOINTMENT-DATE_TO
            time       WS_APPOINTMENT-TIME_TO
       into time stamp WS_APPOINTMENT-TIMESTAMP_TO
            time zone  WS_APPOINTMENT-TIMEZONE_TO.
  endif.

* Actualiza información de modificación para el apunte.
  refresh WT_M_INPUT_FIELD_NAMES.
  clear WS_M_INPUT_FIELDS.
* Prepara la clave lógica del apunte ORDERPLANNED.
  WS_LOGICAL_DATE_KEY-APPT_TYPE = IV_APPTYPE.
  clear WS_LOGICAL_DATE_KEY-IS_DURATION.
* Clave del apunte a modificar.
  WS_M_APPOINTMENT-REF_GUID       = IV_GUID.
  WS_M_APPOINTMENT-REF_KIND       = 'A'.
  WS_M_APPOINTMENT-APPT_TYPE      = WS_LOGICAL_DATE_KEY-APPT_TYPE.
  WS_M_APPOINTMENT-IS_DURATION    = WS_LOGICAL_DATE_KEY-IS_DURATION.
* Cambia los valores del apunte.
  WS_M_APPOINTMENT-TIMESTAMP_TO   = WS_APPOINTMENT-TIMESTAMP_TO.
  WS_M_APPOINTMENT-TIMESTAMP_FROM = WS_APPOINTMENT-TIMESTAMP_FROM.
  insert WS_M_APPOINTMENT into table WT_M_APPOINTMENT.
  WS_M_INPUT_FIELDS-REF_GUID          = IV_GUID.
  WS_M_INPUT_FIELDS-REF_KIND          = 'A'.
  WS_M_INPUT_FIELDS-OBJECTNAME        = 'APPOINTMENT'.
  WS_M_INPUT_FIELDS-LOGICAL_KEY       = WS_LOGICAL_DATE_KEY.
* Indica los campos modificados.

  if not IV_TIMESTAMP_TO is initial.
    WS_M_INPUT_FIELD_NAMES-FIELDNAME    = 'TIMESTAMP_TO'.
    WS_M_INPUT_FIELD_NAMES-CHANGEABLE   = 'X'.
    insert WS_M_INPUT_FIELD_NAMES into table WT_M_INPUT_FIELD_NAMES.
  endif.

  if not IV_TIMESTAMP_FROM is initial.
    WS_M_INPUT_FIELD_NAMES-FIELDNAME    = 'TIMESTAMP_FROM'.
    insert WS_M_INPUT_FIELD_NAMES into table WT_M_INPUT_FIELD_NAMES.
  endif.

* Combina los campos modificados con la clave del apunte.
  WS_M_INPUT_FIELDS-FIELD_NAMES = WT_M_INPUT_FIELD_NAMES.
  insert WS_M_INPUT_FIELDS into table WT_M_INPUT_FIELDS.

  call function 'CRM_ORDER_MAINTAIN'
    EXPORTING
      IT_ACTIVITY_H     = WT_M_ACTIVITY_H
      IT_APPOINTMENT    = WT_M_APPOINTMENT
    CHANGING
      CT_INPUT_FIELDS   = WT_M_INPUT_FIELDS
    EXCEPTIONS
      ERROR_OCCURRED    = 1
      DOCUMENT_LOCKED   = 2
      NO_CHANGE_ALLOWED = 3
      NO_AUTHORITY      = 4
      others            = 5.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      raise update_failed.
    ENDIF.

  if IV_COMMIT_FLAG = 'X'.
    CALL FUNCTION 'ZCRM_ORDER_SAVE_COMMIT'
      EXPORTING
        IV_GUID        = IV_GUID
      EXCEPTIONS
        UPDATE_FAILED  = 1
        others         = 2.
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      raise update_failed.
    ENDIF.
  endif.

endfunction.


FUNCTION ZCRM_ORDER_SAVE_COMMIT.
*"----------------------------------------------------------------------
*"*"Interfase local
*"  IMPORTING
*"     REFERENCE(IV_GUID) TYPE  CRMT_OBJECT_GUID
*"  EXCEPTIONS
*"      UPDATE_FAILED
*"----------------------------------------------------------------------
  data: WV_GUID            like          IV_GUID,
        WT_GUID            type          CRMT_OBJECT_GUID_TAB.

    append IV_GUID to WT_GUID.
    CALL FUNCTION 'CRM_ORDER_SAVE'
      EXPORTING
        IT_OBJECTS_TO_SAVE         = WT_GUID
*   IV_UPDATE_TASK_LOCAL       = FALSE
*   IV_SAVE_FRAME_LOG          = FALSE
*   IV_NO_BDOC_SEND            = FALSE
* IMPORTING
*   ET_SAVED_OBJECTS           =
*   ET_EXCEPTION               =
*   ET_OBJECTS_NOT_SAVED       =
* CHANGING
*   CV_LOG_HANDLE              =
     EXCEPTIONS
       DOCUMENT_NOT_SAVED         = 1
       OTHERS                     = 2
              .
    IF SY-SUBRC <> 0.
      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
              WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      raise update_failed.
    ENDIF.

    CALL FUNCTION 'CRM_ORDER_DEQUEUE'
      EXPORTING
        IV_GUID            = IV_GUID
*   IV_COLLECT         = ' '
*   IV_FROM_INIT       = FALSE
              .
    commit work and wait.

ENDFUNCTION.

Tablas CRM

  • crmd_orderadm_h : datos de contrato
  • BUT000 : Interlocutor Comercial
  • Tablas CRM

Funciones

BUPA_RELATIONSHIPS_GET

to get all the relationships for a BP.

* Se debe obtener la lista de trabajadores que posee la empresa en la BD de Clientes
  CALL FUNCTION 'BAPI_BUPA_RELATIONSHIPS_GET'
    EXPORTING
      businesspartner = lt_empresa-partner
    TABLES
      relationships   = lt_relations
      return          = lt_errores.

  LOOP AT lt_relations WHERE relationshipcategory = 'CRMM02' AND partner1 = lt_empresa-partner.
*  Por cada partner de trabajador se busca su rut
    SELECT SINGLE bpext INTO ld_bpext_aux FROM but000 WHERE partner = lt_relations-partner2.
  endloop. 

BAPI_BUPA_CREATE_FROM_DATA

BAPI_BUPA_ADDRESS_GETDETAIL

Ejemplo ABAP CRM

FORM f_datos_generales_ticket .

  SELECT  distinct
          t1~guid
*          t7~partner
          t3~guid as guid2
          t1~object_id t2~stat
          t9~codegruppe
          t9~code
"          t7~partner_guid
    INTO CORRESPONDING FIELDS OF TABLE gt_join
  FROM    ( ( ( ( ( ( (
    "( ( ( ( ( ( (

       crmd_orderadm_h AS t1 INNER JOIN crm_jest AS t2 ON
          t1~guid = t2~objnr )
    INNER JOIN crmd_orderadm_i AS t3 ON
          t1~guid = t3~header )
    INNER JOIN crmd_link AS enlace ON
          t1~guid  = enlace~guid_hi )
    INNER JOIN crmd_link AS t4 ON
          t3~guid  = t4~guid_hi )
    INNER JOIN crmd_partner AS t5 ON
          enlace~guid_set = t5~guid )
    INNER JOIN crmd_srv_osset  AS t6 ON
          t4~guid_set   = t6~guid_set )
*    INNER JOIN but000 AS t7 ON
*          t5~relation_partner = t7~partner_guid )
*    INNER JOIN but020 AS t8 ON
*          t7~partner = t8~partner )
    INNER JOIN crmd_srv_subject AS t9 ON
          t6~guid = t9~guid_ref )
    WHERE
           t2~stat         in r_stat  and"    LIKE 'E%' AND
           t2~inact        NE 'X' and
           t1~POSTING_DATE GE FECHA_SELEC and
           t1~process_type in r_proces and
           t9~codegruppe   eq 'ZRV1'.

  gti_join[] = gt_join[].
clear: gt_join.

  SELECT  distinct
          t1~guid
*          t7~partner
          t3~guid as guid2
          t1~object_id t2~stat
          t9~codegruppe
          t9~code
"          t7~partner_guid
    INTO CORRESPONDING FIELDS OF TABLE gt_join
  FROM    ( ( ( ( ( ( (
    "( ( ( ( ( ( (

       crmd_orderadm_h AS t1 INNER JOIN crm_jest AS t2 ON
          t1~guid = t2~objnr )
    INNER JOIN crmd_orderadm_i AS t3 ON
          t1~guid = t3~header )
    INNER JOIN crmd_link AS enlace ON
          t1~guid  = enlace~guid_hi )
    INNER JOIN crmd_link AS t4 ON
          t3~guid  = t4~guid_hi )
    INNER JOIN crmd_partner AS t5 ON
          enlace~guid_set = t5~guid )
    INNER JOIN crmd_srv_osset  AS t6 ON
          t4~guid_set   = t6~guid_set )
*    INNER JOIN but000 AS t7 ON
*          t5~relation_partner = t7~partner_guid )
*    INNER JOIN but020 AS t8 ON
*          t7~partner = t8~partner )
    INNER JOIN crmd_srv_subject AS t9 ON
          t6~guid = t9~guid_ref )
    WHERE
           t2~stat         in r_stat  and"    LIKE 'E%' AND
           t2~inact        NE 'X' and
           t1~POSTING_DATE GE FECHA_SELEC and
           t1~process_type in r_proces and
           t9~codegruppe   eq 'ZSVE' AND
           t9~code         in  r_code.

loop at gt_join into gs_join.
      APPEND gs_join to gti_join.
endloop.

 gt_join[] = gti_join[].

loop at gt_join into gs_join.

* Busca o Cliente do Rechamado
          CALL FUNCTION 'CRM_ORDERADM_I_READ_PARTNER_OW'
            EXPORTING
              iv_header           = gs_join-guid
            IMPORTING
              es_main_partner_wrk = wa_crmt_partner_external_wrk.

           ty_ticket_int-partner = wa_crmt_partner_external_wrk-ref_partner_no+2(7).
           ty_ticket_int-objeto  = gs_join-guid.
           ty_ticket_int-guid    = gs_join-object_id.
           ty_ticket_int-estat   = gs_join-stat.
           ty_ticket_int-CODEGRUPPE    = gs_join-CODEGRUPPE.
           ty_ticket_int-CODE   = gs_join-CODE.
** texto del ticket
           perform observs.
           ty_ticket_int-texto  =  texto.
           APPEND ty_ticket_int.
endloop.
ENDFORM.                    " F_DATOS_GENERALES_TICKET