Você está na página 1de 2

FUNCTION zrsax_biw_get_data.

*"----------------------------------------------------------------------
*"*"Interface local:
*" IMPORTING
*" VALUE(I_REQUNR) TYPE SBIWA_S_INTERFACE-REQUNR
*" VALUE(I_ISOURCE) TYPE SBIWA_S_INTERFACE-ISOURCE OPTIONAL
*" VALUE(I_MAXSIZE) TYPE SBIWA_S_INTERFACE-MAXSIZE OPTIONAL
*" VALUE(I_INITFLAG) TYPE SBIWA_S_INTERFACE-INITFLAG OPTIONAL
*" VALUE(I_UPDMODE) TYPE SBIWA_S_INTERFACE-UPDMODE OPTIONAL
*" VALUE(I_DATAPAKID) TYPE SBIWA_S_INTERFACE-DATAPAKID OPTIONAL
*" VALUE(I_PRIVATE_MODE) OPTIONAL
*" VALUE(I_CALLMODE) LIKE ROARCHD200-CALLMODE OPTIONAL
*" VALUE(I_REMOTE_CALL) TYPE SBIWA_FLAG DEFAULT SBIWA_C_FLAG_OFF
*" TABLES
*" I_T_SELECT TYPE SBIWA_T_SELECT OPTIONAL
*" I_T_FIELDS TYPE SBIWA_T_FIELDS OPTIONAL
*" E_T_SOURCE_STRUCTURE_NAME STRUCTURE ZSBI_RETORNO_BANCO
*" OPTIONAL
*" E_T_DATA TYPE ZTTBI_RETORNO_BANCO OPTIONAL
*" EXCEPTIONS
*" NO_MORE_DATA
*" ERROR_PASSED_TO_MESS_HANDLER
*"----------------------------------------------------------------------
break t770126317.
STATICS c1 TYPE cursor.
DATA: lt_febep TYPE TABLE OF febep,
ls_febep LIKE LINE OF lt_febep,
lt_data TYPE TABLE OF zsbi_retorno_banco.
FIELD-SYMBOLS: <lf_data> TYPE zsbi_retorno_banco.
RANGES r_edate FOR febko-edate.
IF i_initflag = space.
IF c1 IS INITIAL.
READ TABLE i_t_select WITH KEY fieldnm = 'EDATE'.
IF sy-subrc = 0.
MOVE-CORRESPONDING i_t_select TO r_edate.
APPEND r_edate.
ENDIF.
OPEN CURSOR WITH HOLD c1 FOR
SELECT * FROM febko
WHERE edate IN r_edate.
ENDIF.
FETCH NEXT CURSOR c1 INTO
CORRESPONDING FIELDS OF TABLE e_t_data
PACKAGE SIZE i_maxsize.
lt_data[] = e_t_data[].
CHECK NOT lt_data[] IS INITIAL.
SELECT * FROM febep INTO TABLE lt_febep
FOR ALL ENTRIES IN lt_data
WHERE kukey = lt_data-kukey.
SORT lt_febep BY kukey ASCENDING.
DELETE ADJACENT DUPLICATES FROM lt_febep COMPARING kukey belnr.
IF sy-subrc <> 0.
CLOSE CURSOR c1.
RAISE no_more_data.
ENDIF.
LOOP AT e_t_data ASSIGNING <lf_data>.
READ TABLE lt_febep INTO ls_febep WITH KEY kukey = <lf_data>-kukey.
IF sy-subrc = 0.
MOVE:
ls_febep-bvdat TO <lf_data>-bvdat,
ls_febep-gjahr TO <lf_data>-gjahr,
ls_febep-vgext TO <lf_data>-vgext,
ls_febep-pnota TO <lf_data>-pnota.
ENDIF.
e_t_data = <lf_data> .
IF e_t_data-pnota IS INITIAL.
DELETE e_t_data.
ELSE.
MODIFY e_t_data.
ENDIF.
ENDLOOP.
ENDIF.
ENDFUNCTION.