cancel
Showing results for 
Search instead for 
Did you mean: 

IS-U enhancing transaction FPBW (open items extraction using table DFKKOPBW

Former Member
0 Kudos

Has anybody experiances with IS-U Accounts Receivable & payable - 'Open Items' extraction using transaction FPBW

(which fill the table DFKKOPBW).

1. I need to fill an custom included structure in this table (DFKKOPBW) and I am searching for the correct time (for performance reasons) & place in the (SAP) source (in the program flow) to do this.

2. Anybody any clues on Custum/user exits in this part?

See also function group FKKOPBW.

Jos Reithofer

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Hi Jos,

I assume that by now, you might have found a way to do this. I was wondering if you used the CI_FKKOPBW include or if you've created your own.

Thanks,

D.

nablan_umar
Active Contributor
0 Kudos

Try this code that can search a user exit in a transaction. I got it from previous post in this forum.

*&----


*

*& Report Y_SEARCH_USEREXIT *

*& *

*&----


*

REPORT y_search_userexit LINE-SIZE 140 NO STANDARD PAGE HEADING.

*----


*

  • CONSTANTS

*----


*

*CONSTANTS: c_user_exit(22) TYPE c VALUE 'CALL CUSTOMER-FUNCTION',

constants: c_badi(30) type c value 'CALL METHOD CL_EXITHANDLER=>',

c_funcao_1(13) TYPE c VALUE 'CALLFUNCTION''',

c_funcao_2(13) TYPE c VALUE 'CALL FUNCTION',

c_include(07) TYPE c VALUE 'INCLUDE',

c_submit(06) TYPE c VALUE 'SUBMIT',

c_comentario TYPE c VALUE '*',

c_ponto TYPE c VALUE '.',

c_aspa TYPE c VALUE '''',

c_x TYPE c VALUE 'X'.

*----


*

  • TABELAS INTERNAS

*----


*

DATA: BEGIN OF ti_programa OCCURS 0,

codigo_fonte(200) type c, " LIKE rssource-line,

END OF ti_programa.

DATA: BEGIN OF ti_includes OCCURS 0,

nome LIKE sy-repid,

nivel(2) TYPE n,

END OF ti_includes.

DATA: BEGIN OF ti_user_exit OCCURS 0,

programa LIKE sy-repid,

linha(10) TYPE n,

codigo_fonte LIKE rssource-line,

nivel(2) TYPE n,

END OF ti_user_exit.

*----


*

  • VARIÁVEIS GLOBAIS

*----


*

DATA: vg_caracter TYPE c,

vg_palavra(50) TYPE c,

vg_inicial LIKE sy-index,

vg_conta_aspa TYPE n,

vg_pname LIKE tfdir-pname,

vg_texto(50) TYPE c,

vg_contador LIKE sy-tfill,

vg_nivel(2) TYPE n,

vg_ini_contagem TYPE c, " INDICA QUE DEVE SER INICIADA A CONTAGEM

vg_conta_espaco TYPE n. " TOTAL DE ESPAÇOS ( MÁXIMO 2 )

*----


*

  • PARAMETERS

*----


*

*- DADOS OBRIGATÓRIOS.

SELECTION-SCREEN BEGIN OF BLOCK bl01 WITH FRAME TITLE tl_001 .

selection-screen begin of line.

selection-screen comment 1(25) tl_003.

PARAMETERS: p_prog LIKE sy-repid.

selection-screen end of line.

selection-screen begin of line.

selection-screen comment 1(25) tl_004.

parameters: p_tcode LIKE sy-tcode.

selection-screen end of line.

selection-screen begin of line.

selection-screen comment 1(25) tl_009.

parameters: p_exit(30) TYPE c default 'CALL CUSTOMER-FUNCTION'.

selection-screen end of line.

SELECTION-SCREEN END OF BLOCK bl01.

*- DADOS OPCIONAIS.

SELECTION-SCREEN BEGIN OF BLOCK bl02 WITH FRAME TITLE tl_002.

selection-screen begin of line.

PARAMETERS: p_incl TYPE c AS CHECKBOX.

selection-screen comment 4(25) tl_005.

selection-screen end of line.

selection-screen begin of line.

parameters: p_func TYPE c AS CHECKBOX.

selection-screen comment 4(25) tl_006.

selection-screen end of line.

selection-screen begin of line.

parameters: p_submit TYPE c AS CHECKBOX.

selection-screen comment 4(25) tl_007.

selection-screen end of line.

selection-screen begin of line.

selection-screen comment 1(25) tl_008.

parameters: p_nivel(2) TYPE n.

selection-screen end of line.

SELECTION-SCREEN END OF BLOCK bl02.

initialization.

tl_001 = 'Program Selection'.

tl_002 = 'Search Depth'.

tl_003 = 'Program Name'.

tl_004 = 'Transaction Code'.

tl_005 = 'Process INCLUDEs'.

tl_006 = 'Process FUNCTION MODULEs'.

tl_007 = 'Process SUBMITs'.

tl_008 = 'Depth level'.

tl_009 = 'Search string'.

*----


*

  • INÍCIO

*----


*

START-OF-SELECTION.

*- CONSISTÊNCIAS DOS PARÂMETROS.

PERFORM consisti_parametros.

*- INICIALIZA TABELA.

PERFORM inicializa_tabela.

*- VERIFICA SE NO PROGRAMA EXISTE ALGUM INCLUDE,FUNÇÃO OU SUBMIT.

PERFORM verifica_include_funcao_submit.

*- ANALISA OS INCLUDES E PROCURA POR USER EXIT.

PERFORM procura_user_exit.

*- EXIBE TODAS USER EXIT ENCONTRADAS.

PERFORM exibe_user_exit.

*----


*

  • FIM

*----


*

END-OF-SELECTION.

*&----


*

*& Form PROCURA_USER_EXIT

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM procura_user_exit.

*- VERIFICA SE NOS INCLUDES SELECIONADOS EXISTEM USER EXITS.

LOOP AT ti_includes.

*- ESVAZIA TABELA INTERNA.

REFRESH ti_programa.

*- REALIZA LEITURA DO INCLUDE ARMAZENANDO-O EM TABELA INTERNA

READ REPORT ti_includes-nome INTO ti_programa.

LOOP AT ti_programa.

*- VERIFICA SE NA LINHA DO PROGRAMA EXISTE ALGUM INCLUDE.

SEARCH ti_programa-codigo_fonte FOR p_exit.

*- SE ENCONTROU INCLUDE E SE A LINHA NÃO ESTÁ COMENTADA...

IF sy-subrc EQ 0

AND ti_programa-codigo_fonte+0(1) NE c_comentario.

CLEAR ti_user_exit.

*- REMOVE ESPAÇOS NO INÍCIO DA STRING.

SHIFT ti_programa-codigo_fonte LEFT DELETING LEADING space.

MOVE: ti_includes-nome TO ti_user_exit-programa,

sy-tabix TO ti_user_exit-linha,

ti_programa-codigo_fonte TO ti_user_exit-codigo_fonte,

ti_includes-nivel TO ti_user_exit-nivel.

APPEND ti_user_exit.

ENDIF.

ENDLOOP.

ENDLOOP.

ENDFORM. " PROCURA_USER_EXIT

*&----


*

*& Form EXIBE_USER_EXIT

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM exibe_user_exit.

PERFORM cabecalho.

PERFORM user_exit_nao_encontrada.

PERFORM lista_user_exit_encontrada.

PERFORM rodape.

ENDFORM. " EXIBE_USER_EXIT

*&----


*

*& Form PROCURA_INCLUDE

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM procura_include.

CLEAR vg_palavra.

*- VERIFICA SE NA LINHA DO PROGRAMA EXISTE ALGUM INCLUDE.

SEARCH ti_programa-codigo_fonte FOR c_include.

*- SE ENCONTROU INCLUDE E SE A LINHA NÃO ESTÁ COMENTADA...

IF sy-subrc EQ 0

AND ti_programa-codigo_fonte+0(1) NE c_comentario.

*- VERIFICA TODOS OS 72

DO 72 TIMES.

vg_inicial = sy-index - 1.

MOVE ti_programa-codigo_fonte+vg_inicial(1) TO vg_caracter.

IF NOT vg_caracter IS INITIAL.

*- VERIFICA SE NÃO É FIM DO COMANDO.

IF vg_caracter EQ c_ponto.

EXIT.

ENDIF.

*- MONTA PALAVRA.

CONCATENATE vg_palavra vg_caracter INTO vg_palavra.

*- CONVERTE PARA MAÍUSCULA PARA FUTURA COMPARAÇÃO.

TRANSLATE vg_palavra TO UPPER CASE.

*- SE ENCONTROU ALGUM INCLUDE

IF vg_palavra EQ c_include.

CLEAR vg_palavra.

ENDIF.

ENDIF.

ENDDO.

*- SALVA NOME DO INCLUDE P

READ TABLE ti_includes WITH KEY nome = vg_palavra.

IF NOT sy-subrc IS INITIAL.

IF vg_nivel LE p_nivel.

MOVE: vg_palavra TO ti_includes-nome,

vg_nivel TO ti_includes-nivel.

APPEND ti_includes.

ENDIF.

ENDIF.

ENDIF.

ENDFORM. " PROCURA_INCLUDE

*&----


*

*& Form PROCURA_FUNCAO

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM procura_funcao.

CLEAR: vg_conta_aspa,

vg_palavra.

*- VERIFICA SE NA LINHA DO PROGRAMA EXISTE ALGUM INCLUDE.

SEARCH ti_programa-codigo_fonte FOR c_funcao_2.

*- SE ENCONTROU INCLUDE E SE A LINHA NÃO ESTÁ COMENTADA...

IF sy-subrc EQ 0

AND ti_programa-codigo_fonte+0(1) NE c_comentario.

*- VERIFICA TODOS OS 72

DO 72 TIMES.

vg_inicial = sy-index - 1.

MOVE ti_programa-codigo_fonte+vg_inicial(1)

TO vg_caracter.

IF NOT vg_caracter IS INITIAL.

*- VERIFICA SE NÃO É FIM DO COMANDO.

IF vg_caracter EQ c_aspa.

ADD 1 TO vg_conta_aspa.

IF vg_conta_aspa EQ 2.

EXIT.

ENDIF.

ENDIF.

*- MONTA PALAVRA.

CONCATENATE vg_palavra vg_caracter INTO vg_palavra.

*- CONVERTE PARA MAÍUSCULA PARA FUTURA COMPARAÇÃO.

TRANSLATE vg_palavra TO UPPER CASE.

*- SE ENCONTROU ALGUM INCLUDE

IF vg_palavra EQ c_funcao_1.

CLEAR vg_palavra.

ENDIF.

ENDIF.

ENDDO.

*- PESQUISA NOME DA FUNÇÃO PARA FUTURA PESQUISA POR USER EXIT.

CLEAR vg_pname.

SELECT SINGLE pname

INTO vg_pname

FROM tfdir

WHERE funcname EQ vg_palavra.

IF sy-subrc EQ 0.

READ TABLE ti_includes WITH KEY nome = vg_pname.

IF NOT sy-subrc IS INITIAL.

IF vg_nivel LE p_nivel.

MOVE: vg_pname TO ti_includes-nome,

vg_nivel TO ti_includes-nivel.

APPEND ti_includes.

ENDIF.

ENDIF.

ENDIF.

ENDIF.

ENDFORM. " PROCURA_FUNCAO

*&----


*

*& Form VERIFICA_INCLUDE_FUNCAO_SUBMIT

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM verifica_include_funcao_submit.

LOOP AT ti_includes.

ADD 1 TO vg_contador.

DESCRIBE TABLE ti_includes.

PERFORM evitar_time_out USING sy-tfill.

MOVE ti_includes-nivel TO vg_nivel.

ADD 1 TO vg_nivel.

*- ESVAZIA TABELA INTERNA.

REFRESH ti_programa.

READ REPORT ti_includes-nome INTO ti_programa.

LOOP AT ti_programa.

*- PROCURA POR INCLUDES.

IF p_incl EQ c_x.

PERFORM procura_include.

ENDIF.

*- PROCURA POR FUNÇÃO.

IF p_func EQ c_x.

PERFORM procura_funcao.

ENDIF.

*- PROCURA POR SUBMIT.

IF p_submit EQ c_x.

PERFORM procura_submit.

ENDIF.

ENDLOOP.

ENDLOOP.

ENDFORM. " VERIFICA_INCLUDE_FUNCAO_SUBMIT

*&----


*

*& Form EVITAR_TIME_OUT

*&----


*

  • text

*----


*

  • -->P_SY_TFILL text

  • -->P_SY_SUBRC text

*----


*

FORM evitar_time_out USING p_sy_tfill.

DATA: vl_total(10) TYPE n,

vl_atual(10) TYPE n.

MOVE: p_sy_tfill TO vl_total,

vg_contador TO vl_atual.

CONCATENATE 'Total:' vl_total '-' 'Atual:' vl_atual

INTO vg_texto

SEPARATED BY space.

CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'

EXPORTING

text = vg_texto.

ENDFORM. " EVITAR_TIME_OUT

*&----


*

*& Form PROCURA_SUBMIT

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM procura_submit.

CLEAR: vg_conta_espaco, vg_palavra, vg_ini_contagem.

*- VERIFICA SE NA LINHA DO PROGRAMA EXISTE ALGUM INCLUDE.

SEARCH ti_programa-codigo_fonte FOR c_submit.

*- SE ENCONTROU INCLUDE E SE A LINHA NÃO ESTÁ COMENTADA...

IF sy-subrc EQ 0

AND ti_programa-codigo_fonte+0(1) NE c_comentario.

*- VERIFICA TODOS OS 7

DO 72 TIMES.

vg_inicial = sy-index - 1.

MOVE ti_programa-codigo_fonte+vg_inicial(1) TO vg_caracter.

IF vg_ini_contagem EQ c_x AND vg_caracter IS INITIAL.

ADD 1 TO vg_conta_espaco.

ENDIF.

IF NOT vg_caracter IS INITIAL.

MOVE c_x TO vg_ini_contagem.

IF vg_caracter EQ c_ponto.

EXIT.

ENDIF.

*- MONTA PALAVRA.

IF vg_conta_espaco LT 2.

CONCATENATE vg_palavra vg_caracter INTO vg_palavra.

*- CONVERTE PARA MAÍUSCULA PARA FUTURA COMPARAÇÃO.

TRANSLATE vg_palavra TO UPPER CASE.

*- SE ENCONTROU ALGUM INCLUDE

IF vg_palavra EQ c_submit.

CLEAR vg_palavra.

ENDIF.

ELSE.

EXIT.

ENDIF.

ENDIF.

ENDDO.

*- PESQUISA NOME DA FUNÇÃO

READ TABLE ti_includes WITH KEY nome = vg_palavra.

IF NOT sy-subrc IS INITIAL.

IF vg_nivel LE p_nivel.

MOVE: vg_palavra TO ti_includes-nome,

vg_nivel TO ti_includes-nivel.

APPEND ti_includes.

ENDIF.

ENDIF.

ENDIF.

ENDFORM. " PROCURA_SUBMIT

*&----


*

*& Form CONSISTI_PARAMETROS

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM consisti_parametros.

IF p_nivel IS INITIAL.

MOVE 1 TO p_nivel.

ENDIF.

IF p_prog IS INITIAL AND p_tcode IS INITIAL.

*- NOME DO PROGRAMA E NOM

*- DEVE SER INFORMADO.

MESSAGE ID 'ZF' TYPE 'I' NUMBER '000' WITH text-003.

STOP.

ENDIF.

IF NOT p_prog IS INITIAL AND NOT p_tcode IS INITIAL.

*- SOLICITA AO U

MESSAGE ID 'ZF' TYPE 'I' NUMBER '000' WITH text-004.

STOP.

ENDIF.

ENDFORM. " CONSISTI_PARAMETROS

*&----


*

*& Form INICIALIZA_TABELA

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM inicializa_tabela.

DATA vl_pgmna LIKE tstc-pgmna.

REFRESH ti_includes.

IF NOT p_prog IS INITIAL.

MOVE: p_prog TO ti_includes-nome,

'0' TO ti_includes-nivel.

APPEND ti_includes.

ELSEIF NOT p_tcode IS INITIAL.

SELECT SINGLE pgmna

FROM tstc

INTO vl_pgmna

WHERE tcode EQ p_tcode.

IF sy-subrc EQ 0.

MOVE: vl_pgmna TO ti_includes-nome,

'0' TO ti_includes-nivel.

APPEND ti_includes.

ENDIF.

ENDIF.

ENDFORM. " INICIALIZA_TABELA

*&----


*

*& Form CABECALHO

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM cabecalho.

DATA vl_complemento(50) TYPE c.

IF p_tcode IS INITIAL.

CONCATENATE '(Program)' p_prog

into vl_complemento

SEPARATED BY space.

ELSE.

CONCATENATE '(Transaction)' p_tcode

INTO vl_complemento

SEPARATED BY space.

ENDIF.

FORMAT COLOR COL_KEY.

WRITE: /001 sy-uline,

/001 sy-vline,

040 'User Exits in a Program',

vl_complemento,

140 sy-vline,

/001 sy-uline.

WRITE: /001 sy-vline,

003 'Program Name',

044 sy-vline,

046 'Level',

052 sy-vline,

054 'Lineno',

065 sy-vline,

067 'UserExit',

140 sy-vline,

/001 sy-uline.

ENDFORM. " CABECALHO

*&----


*

*& Form USER_EXIT_NAO_ENCONTRADA

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM user_exit_nao_encontrada.

DESCRIBE TABLE ti_user_exit.

CHECK sy-tfill IS INITIAL.

FORMAT COLOR COL_NORMAL INTENSIFIED ON.

WRITE: /003 'Userexit does not exist',

139 ' '.

FORMAT RESET.

ENDFORM. " USER_EXIT_NAO_ENCONTRADA

*&----


*

*& Form LISTA_USER_EXIT_ENCONTRADA

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM lista_user_exit_encontrada.

DATA vl_cor TYPE c.

LOOP AT ti_user_exit.

IF vl_cor EQ c_x.

CLEAR vl_cor.

ELSE.

MOVE c_x TO vl_cor.

ENDIF.

*- AJUSTA COR NA TELA.

IF vl_cor EQ c_x.

FORMAT COLOR COL_NORMAL INTENSIFIED ON.

ELSE.

FORMAT COLOR COL_NORMAL INTENSIFIED OFF.

ENDIF.

*- INÍCIO DA IMPRESSÃO.

WRITE: /003 ti_user_exit-programa,

046 ti_user_exit-nivel,

054 ti_user_exit-linha,

067 ti_user_exit-codigo_fonte,

139 ' '.

ENDLOOP.

ENDFORM. " LISTA_USER_EXIT_ENCONTRADA

*&----


*

*& Form RODAPE

*&----


*

  • text

*----


*

  • --> p1 text

  • <-- p2 text

*----


*

FORM rodape.

DESCRIBE TABLE ti_includes.

FORMAT COLOR COL_TOTAL.

WRITE: /001 sy-uline,

/001 sy-vline,

003 'Total include searched:', sy-tfill,

' - with level:', p_nivel,

140 sy-vline,

/001 sy-uline.

ENDFORM. " RODAPE