REPORT zfi_bal_generaux.
************************************************************************
* DEFINICION TABLAS, ESTRUCTURAS Y TIPOS *
************************************************************************
*--DEFINICION DE TABLAS DE SISTEMA
TABLES: bsad, "Contabilidad: índice secundario para deudores
glt0, "Cifras movimientos reg.maestro ctas.mayor
skb1,
skat,
t001,
ska1.
*--DEFINICION DE TABLAS INTERNAS
*-- tabla de clientes
DATA: BEGIN OF i_cliente OCCURS 0,
saknr LIKE skb1-saknr.
DATA: END OF i_cliente.
*-- tabla para ALV
DATA: BEGIN OF i_datos OCCURS 0,
clase(10),
debe LIKE bsid-dmbtr,
haber LIKE bsid-dmbtr,
saknr LIKE skb1-saknr,
name1 LIKE skat-txt20,
dif_debe LIKE bsid-dmbtr,
dif_haber LIKE bsid-dmbtr,
saldo LIKE bsid-dmbtr,
END OF i_datos.
DATA: BEGIN OF i_datos2 OCCURS 0,
clase2(10),
debe LIKE bsid-dmbtr,
haber LIKE bsid-dmbtr,
altkt LIKE skb1-altkt,
name2 LIKE skat-txt20,
dif_debe LIKE bsid-dmbtr,
dif_haber LIKE bsid-dmbtr,
saldo LIKE bsid-dmbtr,
END OF i_datos2.
DATA: i_datos_bilan LIKE i_datos OCCURS 0 WITH HEADER LINE.
DATA: i_datos_gestion LIKE i_datos OCCURS 0 WITH HEADER LINE.
DATA: saldo LIKE bsid-dmbtr.
DATA: gs_disvariant TYPE disvariant.
* Type Pool donde vienen definidas todas las estructuras y tablas
TYPE-POOLS: slis.
* Catálogo de campos: contiene la descripción de los campos de salida
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE,
alv_sort TYPE slis_t_sortinfo_alv WITH HEADER LINE,
alv_sort2 TYPE slis_t_sortinfo_alv WITH HEADER LINE.
INCLUDE zalv.
************************************************************************
* DEFINICION DE PARAMETROS DE SELECCION *
************************************************************************
SELECTION-SCREEN BEGIN OF BLOCK uno WITH FRAME TITLE text-001.
SELECTION-SCREEN SKIP.
PARAMETERS: p_bukrs LIKE glt0-bukrs OBLIGATORY. "Sociedad
SELECT-OPTIONS: s_saknr FOR skb1-saknr, "Nº cuenta
* s_budat FOR bsad-budat OBLIGATORY, "Fecha contab.
s_monat FOR bsad-monat OBLIGATORY. "Mes contable
PARAMETERS: p_gjahr LIKE bsad-gjahr OBLIGATORY. "Ejerc. Contable
SELECTION-SCREEN END OF BLOCK uno.
SELECTION-SCREEN BEGIN OF BLOCK dos WITH FRAME TITLE text-200.
PARAMETERS: cta_alt AS CHECKBOX DEFAULT space.
SELECTION-SCREEN END OF BLOCK dos.
************************************************************************
* DEFINICION DE VARIABLES *
************************************************************************
************************************************************************
* *
* *
* T R A T A M I E N T O *
* *
* *
************************************************************************
*----------------------------------------------------------------------*
* START-OF-SELECTION *
*----------------------------------------------------------------------*
START-OF-SELECTION.
PERFORM selecciona_datos.
PERFORM procesa_datos.
IF NOT cta_alt IS INITIAL.
PERFORM ctaltern.
ENDIF.
END-OF-SELECTION.
PERFORM pinta.
************************************************************************
* *
* *
* S U B - R U T I N A S *
* *
* *
************************************************************************
*&---------------------------------------------------------------------*
*& Form selecciona_datos
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM selecciona_datos .
SELECT * APPENDING CORRESPONDING FIELDS OF TABLE i_cliente
FROM skb1
WHERE bukrs = p_bukrs
AND saknr IN s_saknr.
ENDFORM. " selecciona_datos
*&---------------------------------------------------------------------*
*& Form procesa_datos
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM procesa_datos .
DATA: BEGIN OF i_items OCCURS 0.
INCLUDE STRUCTURE bapi1028_4.
DATA: END OF i_items.
DATA: companycode LIKE bapi1028_0-comp_code,
glacct LIKE bapi1028_0-gl_account,
fiscalyear LIKE bapi1028_4-fisc_year,
currencytype LIKE bapi1028_5-curr_type,
date_from LIKE bapi3007-from_date,
date_to LIKE bapi3007-to_date,
v_debe LIKE bsid-dmbtr,
v_haber LIKE bsid-dmbtr,
v_dif LIKE bsid-dmbtr.
IF s_monat-high IS INITIAL.
s_monat-high = s_monat-low.
ENDIF.
companycode = p_bukrs.
fiscalyear = p_gjahr.
currencytype = '10'.
LOOP AT i_cliente.
CLEAR i_items. REFRESH i_items.
glacct = i_cliente-saknr.
CALL FUNCTION 'BAPI_GL_GETGLACCPERIODBALANCES'
EXPORTING
companycode = companycode
glacct = glacct
fiscalyear = fiscalyear
currencytype = currencytype
* IMPORTING
* BALANCE_CARRIED_FORWARD =
* RETURN =
TABLES
account_balances = i_items.
CLEAR: v_debe, v_haber.
LOOP AT i_items WHERE fis_period IN s_monat.
i_items-credit_per = i_items-credit_per * ( - 1 ).
v_haber = v_haber + i_items-credit_per.
v_debe = v_debe + i_items-debits_per.
ENDLOOP.
PERFORM name1_cliente USING i_cliente-saknr.
PERFORM saldo USING i_datos-saldo.
IF glacct = '0129000000'.
PERFORM grupo0129 USING saldo.
ENDIF.
IF saldo < 0.
v_haber = v_haber + ( saldo * ( - 1 ) ).
ELSE.
v_debe = v_debe + saldo.
ENDIF.
CLEAR saldo.
IF glacct(2) NE '06' AND
glacct(2) NE '07'.
IF i_datos-saldo < 0.
v_haber = v_haber + ( i_datos-saldo * ( - 1 ) ).
ELSE.
v_debe = v_debe + i_datos-saldo.
ENDIF.
ENDIF.
MOVE: v_debe TO i_datos-debe,
v_haber TO i_datos-haber,
i_cliente-saknr TO i_datos-saknr,
skat-txt20 TO i_datos-name1.
CONCATENATE 'Clase' i_cliente-saknr+1(1)
INTO i_datos-clase SEPARATED BY space.
v_dif = v_debe - v_haber.
IF v_dif < 0.
i_datos-dif_haber = v_dif * ( - 1 ).
ELSE.
i_datos-dif_debe = v_dif.
ENDIF.
IF i_datos-debe IS INITIAL AND
i_datos-haber IS INITIAL AND
i_datos-saldo IS INITIAL.
ELSE.
APPEND i_datos.
CLEAR i_datos.
ENDIF.
ENDLOOP.
ENDFORM. " procesa_datos
*&---------------------------------------------------------------------*
*& Form name1_cliente
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_I_CLIENTE_SAKNR text
*----------------------------------------------------------------------*
FORM name1_cliente USING p_saknr.
SELECT SINGLE * FROM skat WHERE spras = 'FR'
AND ktopl = 'SOCU'
AND saknr = p_saknr.
ENDFORM. " name1_cliente
*&---------------------------------------------------------------------*
*& Form saldo
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_I_DATOS_saldo text
*----------------------------------------------------------------------*
FORM saldo USING p_saldo.
DATA: BEGIN OF balance OCCURS 0.
INCLUDE STRUCTURE bapi1028_3.
DATA: END OF balance.
DATA: companycode LIKE bapi1028_0-comp_code,
glacct LIKE bapi1028_0-gl_account,
fiscalyear LIKE bapi1028_3-fisc_year,
currencytype LIKE bapi1028_5-curr_type.
companycode = p_bukrs.
glacct = i_cliente-saknr.
fiscalyear = p_gjahr - 1.
currencytype = '10'.
*-- bapi para sacar el saldo anterior.
CALL FUNCTION 'BAPI_GL_GETGLACCBALANCE'
EXPORTING
companycode = companycode
glacct = glacct
fiscalyear = fiscalyear
currencytype = currencytype
IMPORTING
account_balance = balance.
* RETURN = .
p_saldo = balance-balance.
ENDFORM. " saldo
*&---------------------------------------------------------------------*
*& Form pinta
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM pinta .
DATA: var_saldo(30),
var_debe(30),
var_haber(30),
anio(4).
repname = sy-repid.
anio = p_gjahr - 1.
* Descripción estándar de campos
IF NOT cta_alt IS INITIAL.
PERFORM obt_descrip_campos_tabla USING repname 'I_DATOS2'.
ELSE.
PERFORM obt_descrip_campos_tabla USING repname 'I_DATOS'.
ENDIF.
* Asignar TOP OF PAGE
PERFORM asignar_top_of_page.
* Quitamos el cero de los importes.
PERFORM no_zero USING: 'DEBE' 'X',
'HABER' 'X',
'DIF_DEBE' 'X',
'DIF_HABER' 'X',
'SALDO' 'X'.
* Marcamos los campos de los sumatorios.
PERFORM do_sum USING: 'DEBE' 'X',
'HABER' 'X',
'DIF_DEBE' 'X',
'DIF_HABER' 'X',
'SALDO' 'X'.
* Cambiamos la descripción
CONCATENATE 'Débiteur' p_gjahr
INTO var_debe SEPARATED BY space.
CONCATENATE 'Créditeur' p_gjahr
INTO var_haber SEPARATED BY space.
CONCATENATE 'Solde' anio
INTO var_saldo SEPARATED BY space.
IF NOT cta_alt IS INITIAL.
PERFORM cambio_descripcion USING:
'CLASE2' 'Clase' 'Clase'
'Clase' 'Clase',
'DEBE' 'Cumul Débit' 'Cumul Débit'
'Cumul Débit' 'Cumul Débit',
'HABER' 'Cumul Crédit' 'Cumul Crédit'
'Cumul Crédit' 'Cumul Crédit',
'ALTKT' 'Nº Compte' 'Nº Compte'
'Nº Compte' 'Nº Compte',
'NAME1' 'Intitulé' 'Intitulé'
'Intitulé' 'Intitulé',
'DIF_DEBE' var_debe var_debe
var_debe var_debe,
'DIF_HABER' var_haber var_haber
var_haber var_haber,
'SALDO' var_saldo var_saldo
var_saldo var_saldo.
ELSE.
PERFORM cambio_descripcion USING:
'CLASE' 'Clase' 'Clase'
'Clase' 'Clase',
'DEBE' 'Cumul Débit' 'Cumul Débit'
'Cumul Débit' 'Cumul Débit',
'HABER' 'Cumul Crédit' 'Cumul Crédit'
'Cumul Crédit' 'Cumul Crédit',
'SAKNR' 'Nº Compte' 'Nº Compte'
'Nº Compte' 'Nº Compte',
'NAME1' 'Intitulé' 'Intitulé'
'Intitulé' 'Intitulé',
'DIF_DEBE' var_debe var_debe
var_debe var_debe,
'DIF_HABER' var_haber var_haber
var_haber var_haber,
'SALDO' var_saldo var_saldo
var_saldo var_saldo.
ENDIF.
* Características generales del listado
PERFORM carac_gen_listado.
PERFORM subtotal.
* Disposición
gs_disvariant-report = repname.
* Se muestra el listado
IF NOT cta_alt IS INITIAL.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repname
i_callback_pf_status_set = formname_pf_status_set
i_callback_user_command = formname_user_command
is_layout = layout
it_fieldcat = fieldtab[]
it_events = events[]
i_save = 'A'
it_sort = alv_sort[]
is_variant = gs_disvariant
TABLES
t_outtab = i_datos2
EXCEPTIONS
program_error = 1
OTHERS = 2.
ELSE.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repname
i_callback_pf_status_set = formname_pf_status_set
i_callback_user_command = formname_user_command
is_layout = layout
it_fieldcat = fieldtab[]
it_events = events[]
i_save = 'A'
it_sort = alv_sort[]
is_variant = gs_disvariant
TABLES
t_outtab = i_datos
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDIF.
ENDFORM. " pinta
*&---------------------------------------------------------------------*
*& Form subtotal
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM subtotal.
IF NOT cta_alt IS INITIAL.
REFRESH alv_sort.
CLEAR alv_sort.
alv_sort-fieldname = 'CLASE2'.
alv_sort-subtot = 'X'.
APPEND alv_sort.
REFRESH alv_sort2.
CLEAR alv_sort.
alv_sort2-fieldname = 'CLASE2'.
alv_sort2-subtot = 'X'.
alv_sort2-expa = 'X'.
alv_sort2-comp = ' '.
APPEND alv_sort2.
ELSE.
REFRESH alv_sort.
CLEAR alv_sort.
alv_sort-fieldname = 'CLASE'.
alv_sort-subtot = 'X'.
APPEND alv_sort.
REFRESH alv_sort2.
CLEAR alv_sort.
alv_sort2-fieldname = 'CLASE'.
alv_sort2-subtot = 'X'.
alv_sort2-expa = 'X'.
alv_sort2-comp = ' '.
APPEND alv_sort2.
ENDIF.
ENDFORM. " subtotal
*&---------------------------------------------------------------------*
*& Form cambio_descripcion
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM cambio_descripcion USING pf_fieldname
pf_scrtext_l
pf_scrtext_m
pf_scrtext_s
pf_coltext.
READ TABLE fieldtab WITH KEY fieldname = pf_fieldname ASSIGNING <fs>.
IF sy-subrc EQ 0.
<fs>-seltext_l = pf_scrtext_l.
<fs>-seltext_m = pf_scrtext_m.
<fs>-seltext_s = pf_scrtext_s.
<fs>-reptext_ddic = pf_coltext.
ENDIF.
ENDFORM. " cambio_descripcion
*&---------------------------------------------------------------------*
*& Form no_zero
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM no_zero USING pf_fieldname
p_zero.
READ TABLE fieldtab WITH KEY fieldname = pf_fieldname ASSIGNING <fs>.
IF sy-subrc EQ 0.
<fs>-no_zero = p_zero.
ENDIF.
ENDFORM. " no_zero
*&---------------------------------------------------------------------*
*& Form do_sum
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM do_sum USING pf_fieldname
p_sum.
READ TABLE fieldtab WITH KEY fieldname = pf_fieldname ASSIGNING <fs>.
IF sy-subrc EQ 0.
<fs>-do_sum = p_sum.
ENDIF.
ENDFORM. " do_sum
*---------------------------------------------------------------------*
* FORM alv_top_of_page *
*---------------------------------------------------------------------*
* Textos de cabecera
* - typ, " H = Header, S = Selection, A = Action
* - key,
* - info,
*---------------------------------------------------------------------*
FORM alv_top_of_page.
DATA: lt_list_commentary TYPE slis_t_listheader,
ls_list_commentary TYPE slis_listheader.
DATA: v_date(60).
SELECT SINGLE * FROM t001 WHERE bukrs = p_bukrs.
CONCATENATE 'Du' '01/'
s_monat-low '/'
p_gjahr 'au'
'31/'
s_monat-high '/'
p_gjahr
INTO v_date SEPARATED BY space.
* Componemos texto de cabecera
CLEAR ls_list_commentary.
ls_list_commentary-typ = 'H'.
ls_list_commentary-info = 'Balance des comptes généraux'.
APPEND ls_list_commentary TO lt_list_commentary.
*
CLEAR ls_list_commentary.
ls_list_commentary-typ = 'S'.
ls_list_commentary-key = 'Société:'.
ls_list_commentary-info = t001-butxt.
APPEND ls_list_commentary TO lt_list_commentary.
*
CLEAR ls_list_commentary.
ls_list_commentary-typ = 'S'.
ls_list_commentary-key = 'Date comptable:'.
ls_list_commentary-info = v_date.
APPEND ls_list_commentary TO lt_list_commentary.
*
CLEAR ls_list_commentary.
ls_list_commentary-typ = 'A'.
ls_list_commentary-info = 'Edition Provisiore - Experimé en euros'.
APPEND ls_list_commentary TO lt_list_commentary.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = lt_list_commentary.
ENDFORM. "alv_top_of_page
*&---------------------------------------------------------------------
*& Form PF_STATUS
*&---------------------------------------------------------------------
FORM pf_status USING lt_cua_exclude TYPE slis_t_extab.
SET PF-STATUS 'STATUS_100'.
ENDFORM. "pf_status
*&---------------------------------------------------------------------
*& Form USER_COMMAND
*&---------------------------------------------------------------------
FORM user_command USING r_ucomm LIKE sy-ucomm
ls_selfield TYPE slis_selfield.
CASE r_ucomm.
WHEN '/&F03'.
LEAVE TO TRANSACTION 'ZFIBAL029'.
*-- Gener
WHEN 'GENER'.
PERFORM alv_gener.
*-- Bilan
WHEN 'BILAN'.
PERFORM alv_bilan.
*-- Gestion
WHEN 'GESTION'.
PERFORM alv_gestion.
ENDCASE.
ENDFORM. "user_command
*&---------------------------------------------------------------------*
*& Form alv_gener
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM alv_gener .
* Se muestra el listado general
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repname
i_callback_pf_status_set = formname_pf_status_set
i_callback_user_command = formname_user_command
is_layout = layout
it_fieldcat = fieldtab[]
it_events = events[]
i_save = 'A'
it_sort = alv_sort[]
is_variant = gs_disvariant
TABLES
t_outtab = i_datos
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. " alv_gener
*&---------------------------------------------------------------------*
*& Form alv_bilan
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM alv_bilan .
CLEAR i_datos_bilan. REFRESH i_datos_bilan.
LOOP AT i_datos WHERE clase+6(1) <= 5.
MOVE-CORRESPONDING i_datos TO i_datos_bilan.
APPEND i_datos_bilan.
CLEAR i_datos_bilan.
ENDLOOP.
* Se muestra el listado bilan
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repname
i_callback_pf_status_set = formname_pf_status_set
i_callback_user_command = formname_user_command
is_layout = layout
it_fieldcat = fieldtab[]
it_events = events[]
i_save = 'A'
it_sort = alv_sort2[]
is_variant = gs_disvariant
TABLES
t_outtab = i_datos_bilan
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. " alv_bilan
*&---------------------------------------------------------------------*
*& Form alv_gestion
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM alv_gestion .
CLEAR i_datos_gestion. REFRESH i_datos_gestion.
LOOP AT i_datos WHERE ( clase+6(1) = 6 OR
clase+6(1) = 7 ).
MOVE-CORRESPONDING i_datos TO i_datos_gestion.
APPEND i_datos_gestion.
CLEAR i_datos_gestion.
ENDLOOP.
* Se muestra el listado gestion
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = repname
i_callback_pf_status_set = formname_pf_status_set
i_callback_user_command = formname_user_command
is_layout = layout
it_fieldcat = fieldtab[]
it_events = events[]
i_save = 'A'
it_sort = alv_sort2[]
is_variant = gs_disvariant
TABLES
t_outtab = i_datos_gestion
EXCEPTIONS
program_error = 1
OTHERS = 2.
ENDFORM. " alv_gestion
*&---------------------------------------------------------------------*
*& Form grupo0129
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_SALDO text
*----------------------------------------------------------------------*
FORM grupo0129 USING P_R_SALDO.
DATA: BEGIN OF balan1 OCCURS 0.
INCLUDE STRUCTURE bapi1028_3.
DATA: END OF balan1.
DATA: companycod1 LIKE bapi1028_0-comp_code,
glacc1 LIKE bapi1028_0-gl_account,
fiscalyea1 LIKE bapi1028_3-fisc_year,
currencytyp1 LIKE bapi1028_5-curr_type.
SELECT * FROM ska1 WHERE ktopl = 'SOCU'
AND saknr BETWEEN '0600000000'
AND '0799999999'.
companycod1 = p_bukrs.
glacc1 = ska1-saknr.
fiscalyea1 = p_gjahr - 1.
currencytyp1 = '10'.
*-- bapi para sacar el saldo anterior.
CALL FUNCTION 'BAPI_GL_GETGLACCBALANCE'
EXPORTING
companycode = companycod1
glacct = glacc1
fiscalyear = fiscalyea1
currencytype = currencytyp1
IMPORTING
account_balance = balan1.
* RETURN = .
p_r_saldo = p_r_saldo + balan1-balance.
ENDSELECT.
ENDFORM. " grupo0129
*&---------------------------------------------------------------------*
*& Form ctaltern
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM ctaltern .
LOOP AT i_datos.
CALL FUNCTION 'READ_SKB1'
EXPORTING
xbukrs = p_bukrs
xsaknr = i_datos-saknr
IMPORTING
xskb1 = skb1.
* SELECT SINGLE * FROM t001
* WHERE bukrs = p_bukrs.
* SELECT SINGLE * FROM skat
* WHERE ktopl = t001-ktop2
* AND saknr = skb1-altkt.
* IF skat-txt50 IS INITIAL.
* MOVE text-601 TO skat-txt50.
* ENDIF.
* one_gsb = ' '.
* MOVE skb1-altkt TO konto.
MOVE-CORRESPONDING i_datos TO i_datos2.
CONCATENATE 'Clase' skb1-altkt+1(1)
INTO i_datos2-clase2 SEPARATED BY space.
MOVE skb1-altkt TO i_datos2-altkt.
COLLECT i_datos2.
clear skb1.
ENDLOOP.
SORT i_datos2 BY altkt.
DELETE ADJACENT DUPLICATES FROM i_datos2.
SELECT SINGLE * FROM t001
WHERE bukrs = p_bukrs.
LOOP AT i_datos2.
PERFORM name2_cliente USING i_datos2-altkt t001-ktop2.
ENDLOOP.
ENDFORM. " ctaltern
*&---------------------------------------------------------------------*
*& Form name2_cliente
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_I_DATOS2_ALTKT text
*----------------------------------------------------------------------*
FORM name2_cliente USING P_I_DATOS2_ALTKT p_i_t001_ktop2.
SELECT SINGLE * FROM skat WHERE spras = 'FR'
AND ktopl = p_i_t001_ktop2
AND saknr = p_i_datos2_altkt.
i_datos2-name2 = skat-txt20.
MODIFY i_datos2.
CLEAR skat.
ENDFORM. " name2_cliente