Zfi Procon Usa Form 1
Zfi Procon Usa Form 1
Zfi Procon Usa Form 1
*&---------------------------------------------------------------------*
*& Form ZF_MATCH_CODE_BLART
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form zf_match_code_blart changing cv_blart type blart.
if sy-subrc eq 0.
read table lt_match into ls_match index 1.
move ls_match-fieldval to cv_blart.
endif.
if sy-subrc ne 0.
message e030(zdimsg) with p_bukrs.
endif.
*&---------------------------------------------------------------------*
*& Form ZF_BUSCAR_DATOS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form zf_buscar_datos.
select bukrs belnr gjahr monat blart budat bktxt waers xblnr "bldat budat
from bkpf
into corresponding fields of table gt_datos "gt_bkpf
where bukrs eq p_bukrs and
gjahr eq p_gjahr and
budat in so_budat and
blart in so_blart and
* blart EQ p_blart AND
belnr in so_belnr.
*&---------------------------------------------------------------------*
*& Form ZF_COMPLETAR_DOC
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form zf_completar_doc .
if sy-subrc eq 0.
endif.
endloop.
*--------------------------------------------------------------------*
*--------------------------------------------------------------------*
*--------------------------------------------------------------------*
* IF gt_datos IS NOT INITIAL.
* SELECT bukrs hkont bukrs_aju hkont_aju
* FROM zfi_cuen_soc_aju
* INTO TABLE lt_cuen_soc_aju
* FOR ALL ENTRIES IN gt_belnr
* WHERE bukrs EQ gt_belnr-bukrs AND
* hkont EQ gt_belnr-hkont.
*
* SELECT bukrs gsber kostl bukrs_aju gsber_aju kostl_aju
* FROM zfi_obj_imp_soc
* INTO TABLE lt_obj_imp
* FOR ALL ENTRIES IN gt_belnr
* WHERE bukrs EQ gt_belnr-bukrs AND
* gsber EQ gt_belnr-gsber AND
* kostl EQ gt_belnr-kostl.
*
* SELECT bukrs blart bukrs_aju blart_aju
* FROM zfi_clase_doc
* INTO TABLE lt_clase_doc
* FOR ALL ENTRIES IN gt_datos
* WHERE bukrs EQ gt_datos-bukrs AND
* blart EQ gt_datos-blart.
*
*
* ENDIF.
endform. " ZF_COMPLETAR_DOC
*&---------------------------------------------------------------------*
*& Form ZF_BSEG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_<LFS_DATOS>_BUKRS text
* -->P_<LFS_DATOS>_BELNR text
* -->P_<LFS_DATOS>_GJAHR text
* <--P_<LFS_DATOS>_TEXT text
*----------------------------------------------------------------------*
form zf_bseg using uv_bukrs type bukrs
uv_belnr type belnr_d
uv_gjahr type gjahr
changing ct_datos type ty_datos. "cv_text.
if sy-subrc eq 0.
if sy-subrc eq 0. "ZFI_CUEN_SOC_AJU
"Registro no informado en la tabla: Objeto de imputación sociedad ajuste
move: text-t03 to <lfs_datos>-text,
icon_red_light to <lfs_datos>-icon.
move-corresponding <lfs_datos> to ls_list.
append ls_list to gt_list.
exit.
endif.
endif.
else.
read table gt_datos assigning <lfs_datos> with key bukrs = <lfs_bseg>-bukrs
belnr = <lfs_bseg>-belnr
gjahr = <lfs_bseg>-gjahr
binary search.
if sy-subrc eq 0. "ZFI_CUEN_SOC_AJU
"Registro no informado en la tabla: Cuentas sociedad ajuste
move: text-t02 to <lfs_datos>-text,
icon_red_light to <lfs_datos>-icon.
move-corresponding <lfs_datos> to ls_list.
append ls_list to gt_list.
exit.
endif.
endif.
endloop.
endform. " ZF_BSEG
*&---------------------------------------------------------------------*
*& Form ZF_ZFI_CUEN_SOC_AJU
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_<LFS_BSEG>_BUKRS text
* -->P_<LFS_BSEG>_HKONT text
* <--P_<LFS_BSEG>_HKONT_AJU_B text
*----------------------------------------------------------------------*
form zf_zfi_cuen_soc_aju using uv_bukrs type bukrs
uv_hkont type hkont
changing cv_hkont_aju_b type hkont.
*&---------------------------------------------------------------------*
*& Form ZF_ZFI_OBJ_IMP_SOC
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_<LFS_BSEG>_BUKRS text
* -->P_<LFS_BSEG>_GSBER text
* -->P_<LFS_BSEG>_KOSTL text
* <--P_<LFS_BSEG>_GSBER_AJU_B text
* <--P_<LFS_BSEG>_KOSTL_AJU_B text
*----------------------------------------------------------------------*
form zf_zfi_obj_imp_soc using uv_bukrs type bukrs
uv_gsber type gsber
uv_kostl type kostl
uv_hkont type hkont
changing cv_gsber_aju_b type gsber
cv_kostl_aju_b type kostl.
*&---------------------------------------------------------------------*
*& Form ZF_CREATE_DOC
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form zf_create_doc .
if sy-subrc eq 0.
* Documento ya replicado
move: icon_yellow_light to <lfs_datos>-icon,
text-t08 to <lfs_datos>-text.
move-corresponding <lfs_datos> to ls_list.
append ls_list to gt_list.
else.
clear: ls_header, ls_doc, ls_doc_ajus.
refresh: lt_bapiacgl09, lt_currency, lt_return, lt_bseg.
if sy-subrc <> 0.
* Implement suitable error handling here
endif.
*--------------------------------------------------------------------*
* Cabecera
*--------------------------------------------------------------------*
read table lt_bkpf index 1 into ls_bkpf.
if sy-subrc eq 0.
"Documento creado
concatenate text-t05
ls_return-message_v2(10) "Documento
ls_return-message_v2+10(4) "Sociedad
ls_return-message_v2+14(4) "Año
into <lfs_datos>-text separated by space.
else.
read table lt_return into ls_return with key type = 'E' binary search.
if sy-subrc eq 0.
call function 'FORMAT_MESSAGE'
exporting
id = ls_return-id
lang = sy-langu
no = ls_return-number
v1 = ls_return-message_v1
v2 = ls_return-message_v2
v3 = ls_return-message_v3
v4 = ls_return-message_v4
importing
msg = <lfs_datos>-text.
endif.
* REFRESH: lt_return.
endif.
endloop.
*&---------------------------------------------------------------------*
*& Form ZF_BAPIACGL09
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_LT_BSEG text
* <--P_LS_BAPIACGL09 text
* <--P_LS_CURRENCY text
*----------------------------------------------------------------------*
form zf_bapiacgl09 using ut_bseg type bseg_t
us_datos type ty_datos
uv_monat type monat
changing ct_bapiacgl09 type bapiacgl09_tab "BAPIACAR09_TAB
ct_currency type bapiaccr09_tab
ct_extension1 type bapiacextc_tab.
*--------------------------------------------------------------------*
* Extension1 para añadir BSCHL y ANBWA
*--------------------------------------------------------------------*
ls_extension1-field1 = ls_bapiacgl09-itemno_acc.
case <lfs_bseg>-bschl.
when'40' or '70'.
concatenate 'BSCHL' '40' into ls_extension1-field2.
when '50' or '75'.
concatenate 'BSCHL' '50' into ls_extension1-field2.
endcase.
if <lfs_bseg>-shkzg eq 'S'.
ls_currency-amt_doccur = <lfs_bseg>-wrbtr.
elseif <lfs_bseg>-shkzg eq 'H'.
ls_currency-amt_doccur = <lfs_bseg>-wrbtr * -1.
else.
" nothing to do with default case
endif.
*&---------------------------------------------------------------------*
*& Form ZF_DISPLAY
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
form zf_display .
try.
cl_salv_table=>factory(
importing
r_salv_table = lr_alv
changing
t_table = gt_list ).
catch cx_salv_msg.
exit.
endtry.
lr_columns = lr_alv->get_columns( ).
* gr_columns = gr_table->get_columns( ).
** TRY.
lr_column ?= lr_columns->get_column( 'ICON' ). "Exception Column
lr_column->set_medium_text( 'Status' ).
lr_column->set_long_text( 'Status' ).
lr_column->set_short_text( 'Status' ).
lr_columns->set_optimize( abap_true ).
** CATCH cx_salv_not_found. "#EC NO_HANDLER
** ENDTRY.
** TRY.
lr_column ?= lr_columns->get_column( 'TEXT' ). "Exception Column
lr_column->set_medium_text( text-t06 ). "( 'Descripción' ).
lr_column->set_long_text( text-t06 ). "( 'Descripción' ).
lr_column->set_short_text( text-t07 ). "( 'Descrip.' ).
lr_columns->set_optimize( abap_true ).
** CATCH cx_salv_not_found. "#EC NO_HANDLER
** ENDTRY.
* alv_columns = lr_alv->get_columns( ).
* alv_column ?= alv_columns->get_column( 'STATUS' ).
** alv_column->set_SHORT_text( 'Status' ).
* alv_column->set_visible( abap_false ).
* TRY.
* lr_column ?= lr_columns->get_column( 'BUKRS_AJU' ).
* lr_columns->set_MEDIUM_text( 'Soci. Ajus.' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
*
* TRY.
* lr_column ?= lr_columns->get_column( 'HKONT_AJU' ).
* lr_columns->set_MEDIUM_text( 'Cuenta Ajus.' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
*
* TRY.
* lr_column ?= lr_columns->get_column( 'GSBER_AJU' ).
* lr_columns->set_MEDIUM_text( 'División Ajus.' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
*
* TRY.
* lr_column ?= lr_columns->get_column( 'KOSTL_AJU' ).
* lr_columns->set_MEDIUM_text( 'Cent. coste Ajus.' ).
* CATCH cx_salv_not_found. "#EC NO_HANDLER
* ENDTRY.
*
* TRY.
* lr_column ?= lr_columns->get_column( 'BLART_AJU' ).
* lr_columns->set_MEDIUM_text( 'Clase Doc. Ajus.' ).
*
* CATCH cx_salv_not_found. "#EC NO_HANDLER
*ENDTRY.
* kostl_aju TYPE kostl,
* BLART_aju TYPE BLART,
lr_alv->display( ). "display ALV
*&---------------------------------------------------------------------*
*& Form ZF_CLASE_DOC
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_<LFS_DATOS>_BUKRS text
* -->P_<LFS_DATOS>_BLART text
* <--P_<LFS_DATOS>_BUKRS_AJU text
* <--P_<LFS_DATOS>_BLART_AJU text
*----------------------------------------------------------------------*
form zf_clase_doc using uv_bukrs type bukrs
uv_blart type blart
changing cv_bukrs_aju type bukrs
cv_blart_aju type blart.