REPORT y_ebf_044 NO STANDARD PAGE HEADING.
*
TABLES : tfdir.
*
*
*
PARAMETERS: pa_func LIKE rs38l-name.
*
*
* Fuente ABAP
DATA : lt_codfte TYPE rswsourcet,
wa_codfte LIKE LINE OF lt_codfte.
* Fuente ABAP
DATA : lt_fte_aux_00 TYPE rswsourcet,
ld_fte_aux_00 LIKE LINE OF lt_fte_aux_00.
* Fuente ABAP
DATA : lt_fte_aux TYPE rswsourcet,
wa_fte_aux LIKE LINE OF lt_fte_aux_00.
* Fuente ABAP
DATA : lt_fte_prefinal TYPE rswsourcet,
wa_fte_prefinal LIKE LINE OF lt_fte_prefinal.
* Fuente ABAP
DATA : lt_fte_final TYPE rswsourcet,
wa_fte_final LIKE LINE OF lt_fte_prefinal.
* Estructura interna de los datos de entorno de test
DATA : lt_datadir TYPE STANDARD TABLE OF eudatadir WITH HEADER LINE.
* Objetos del entorno de desarrollo
DATA : lt_eufunc TYPE STANDARD TABLE OF eufunc WITH HEADER LINE.
* Parametros IMPORT
DATA : lt_import TYPE STANDARD TABLE OF rsimp WITH HEADER LINE.
* Parametros Changing
DATA : lt_change TYPE STANDARD TABLE OF rscha WITH HEADER LINE.
* Pararametros EXPORT
DATA : lt_export TYPE STANDARD TABLE OF rsexp WITH HEADER LINE.
* Parametros TABLAS
DATA : lt_tables TYPE STANDARD TABLE OF rstbl WITH HEADER LINE.
* Parametros EXCEPTION
DATA : lt_except TYPE STANDARD TABLE OF rsexc WITH HEADER LINE.
* Biblioteca de funciones: Interfase documentación
DATA : lt_paradocu TYPE STANDARD TABLE OF rsfdo WITH HEADER LINE.
* Biblioteca de funciones: Parámetro Import
DATA : lt_param TYPE STANDARD TABLE OF rsimp WITH HEADER LINE.
* Contador
DATA : ld_lines TYPE i.
* Area de nombres
DATA : ld_namespace LIKE rs38l-namespace.
* Grupo funciones a la que está asignado el módulo funciones
DATA : ld_area LIKE rs38l-area.
*
*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR pa_func.
*
CALL FUNCTION 'RS_HELP_HANDLING'
EXPORTING
dynpfield = 'pa_func'
dynpname = sy-dynnr
object = 'FB'
progname = 'Y_EBF_012'
suppress_selection_screen = sy-input.
*
*
*
START-OF-SELECTION.
*
*
*
PERFORM fu_import_interface_ext(sapms38l)
TABLES lt_import
lt_change
lt_export
lt_tables
lt_except
lt_paradocu
USING pa_func.
*
CALL FUNCTION 'FUNCTION_STUB_GENERATE'
EXPORTING
funcname = pa_func
ic_mode = 'X'
TABLES
source = lt_codfte
EXCEPTIONS
function_not_exist = 1
OTHERS = 2.
*
IF ( sy-subrc EQ 0 ).
ENDIF.
DATA: ld_var_name TYPE string.
*
FIELD-SYMBOLS: <fs> TYPE any.
*
DATA: ld_string TYPE string.
DATA: ld_search_string TYPE string.
*
LOOP AT lt_codfte INTO wa_codfte.
*
SEARCH wa_codfte FOR ' EXCEPTIONS'.
IF ( sy-subrc EQ 0 ).
EXIT.
ENDIF.
SEARCH wa_codfte FOR ' = '.
CHECK sy-subrc EQ 0.
*
LOOP AT lt_import.
CONCATENATE '.' lt_import-parameter '.' INTO ld_search_string
SEPARATED BY space.
*
SEARCH wa_codfte FOR ld_search_string .
IF ( sy-subrc EQ 0 ).
CONCATENATE '= LD_' lt_import-parameter INTO ld_var_name.
REPLACE '=' WITH ld_var_name INTO wa_codfte.
MODIFY lt_codfte FROM wa_codfte.
*
REPLACE '= LD_' WITH 'DATA: LD_' INTO ld_var_name.
IF NOT lt_import-dbfield IS INITIAL.
CONCATENATE ld_var_name 'TYPE' lt_import-dbfield '.'
INTO ld_fte_aux_00 SEPARATED BY space.
ELSEIF lt_import-typ IS INITIAL.
CONCATENATE ld_var_name 'TYPE'
'C' '.'
INTO ld_fte_aux_00 SEPARATED BY space.
ELSE.
CONCATENATE ld_var_name 'TYPE'
lt_import-typ '.'
INTO ld_fte_aux_00 SEPARATED BY space.
ENDIF.
APPEND ld_fte_aux_00 TO lt_fte_aux_00.
IF lt_import-default IS INITIAL.
CONCATENATE '* LD_' lt_import-parameter ' = '
INTO wa_fte_aux.
ELSE.
CONCATENATE '* LD_' lt_import-parameter ' = '
lt_import-default '.'
INTO wa_fte_aux.
ENDIF.
APPEND wa_fte_aux TO lt_fte_aux.
CLEAR : wa_fte_aux.
APPEND wa_fte_aux TO lt_fte_aux.
lt_param-parameter = lt_import-parameter.
lt_param-dbfield = lt_import-dbfield.
lt_param-typ = lt_import-typ.
APPEND lt_param.
EXIT.
ENDIF.
ENDLOOP.
*
LOOP AT lt_export.
CONCATENATE '.' lt_export-parameter '.' INTO ld_search_string
SEPARATED BY space.
SEARCH wa_codfte FOR ld_search_string .
IF sy-subrc EQ 0.
CONCATENATE '= LD_' lt_export-parameter INTO ld_var_name.
REPLACE '=' WITH ld_var_name INTO wa_codfte.
MODIFY lt_codfte FROM wa_codfte.
REPLACE '= LD_' WITH 'DATA: LD_' INTO ld_var_name.
IF NOT ( lt_export-dbfield IS INITIAL ).
CONCATENATE ld_var_name 'TYPE' lt_export-dbfield '.'
INTO ld_fte_aux_00 SEPARATED BY space.
ELSEIF lt_export-typ IS INITIAL.
CONCATENATE ld_var_name 'TYPE'
'C' '.'
INTO ld_fte_aux_00 SEPARATED BY space.
*
ELSE.
CONCATENATE ld_var_name 'TYPE'
lt_export-typ '.'
INTO ld_fte_aux_00 SEPARATED BY space.
ENDIF.
APPEND ld_fte_aux_00 TO lt_fte_aux_00.
EXIT.
ENDIF.
ENDLOOP.
*
LOOP AT lt_change.
CONCATENATE '.' lt_change-parameter '.' INTO ld_search_string
SEPARATED BY space.
SEARCH wa_codfte FOR ld_search_string .
IF ( sy-subrc EQ 0 ).
CONCATENATE '= LD_' lt_change-parameter INTO ld_var_name.
REPLACE '=' WITH ld_var_name INTO wa_codfte.
MODIFY lt_codfte FROM wa_codfte.
REPLACE '= LD_' WITH 'DATA: LD_' INTO ld_var_name.
IF NOT lt_change-dbfield IS INITIAL.
CONCATENATE ld_var_name 'TYPE' lt_change-dbfield '.'
INTO ld_fte_aux_00 SEPARATED BY space.
ELSEIF lt_change-typ IS INITIAL.
CONCATENATE ld_var_name 'TYPE'
'C' '.'
INTO ld_fte_aux_00 SEPARATED BY space.
ELSE.
CONCATENATE ld_var_name 'TYPE'
lt_change-typ '.'
INTO ld_fte_aux_00 SEPARATED BY space.
ENDIF.
APPEND ld_fte_aux_00 TO lt_fte_aux_00.
CONCATENATE '* LD_' lt_change-parameter ' = '
lt_change-default
INTO wa_fte_aux.
APPEND wa_fte_aux TO lt_fte_aux.
CLEAR : wa_fte_aux.
APPEND wa_fte_aux TO lt_fte_aux.
lt_param-parameter = lt_change-parameter.
lt_param-dbfield = lt_change-dbfield.
lt_param-typ = lt_change-typ.
APPEND lt_param.
EXIT.
ENDIF.
ENDLOOP.
LOOP AT lt_tables.
CONCATENATE '.' lt_tables-parameter '.' INTO ld_search_string
SEPARATED BY space.
SEARCH wa_codfte FOR ld_search_string .
IF ( sy-subrc EQ 0 ).
CONCATENATE '= LT_' lt_tables-parameter INTO ld_var_name.
REPLACE '=' WITH ld_var_name INTO wa_codfte.
MODIFY lt_codfte FROM wa_codfte.
REPLACE '= LT_' WITH 'DATA: LT_' INTO ld_var_name.
IF NOT ( lt_tables-dbstruct IS INITIAL ).
CONCATENATE ld_var_name 'TYPE standard table of '
lt_tables-dbstruct '.'
INTO ld_fte_aux_00 SEPARATED BY space.
ELSEIF ( lt_tables-typ IS INITIAL ).
CONCATENATE ld_var_name 'TYPE standard table of '
'char255' '.'
INTO ld_fte_aux_00 SEPARATED BY space.
ELSE.
CONCATENATE ld_var_name 'TYPE'
lt_tables-typ '.'
INTO ld_fte_aux_00 SEPARATED BY space.
ENDIF.
APPEND ld_fte_aux_00 TO lt_fte_aux_00.
CONCATENATE 'DATA: WA_' lt_tables-parameter space
' LIKE LINE OF LT_' lt_tables-parameter '.'
INTO ld_fte_aux_00.
APPEND ld_fte_aux_00 TO lt_fte_aux_00.
*
DATA : lt_dfies_tab TYPE STANDARD TABLE OF dfies WITH HEADER LINE.
DATA : ld_tabname TYPE ddobjname.
ld_tabname = lt_tables-dbstruct.
CALL FUNCTION 'DDIF_FIELDINFO_GET'
EXPORTING
tabname = ld_tabname
TABLES
dfies_tab = lt_dfies_tab
EXCEPTIONS
not_found = 1
internal_error = 2
OTHERS = 3.
IF ( sy-subrc EQ 0 ).
ENDIF.
IF ( lt_dfies_tab[] IS INITIAL ).
CONCATENATE '* WA_' lt_tables-parameter ' = '
INTO wa_fte_aux.
APPEND wa_fte_aux TO lt_fte_aux.
ELSE.
LOOP AT lt_dfies_tab.
CONCATENATE '* WA_' lt_tables-parameter '-'
lt_dfies_tab-fieldname ' = '
INTO wa_fte_aux.
APPEND wa_fte_aux TO lt_fte_aux.
ENDLOOP.
ENDIF.
CONCATENATE '* APPEND WA_' lt_tables-parameter ' TO '
' LT_' lt_tables-parameter
INTO wa_fte_aux.
APPEND wa_fte_aux TO lt_fte_aux.
CLEAR : wa_fte_aux.
APPEND wa_fte_aux TO lt_fte_aux.
EXIT.
ENDIF.
ENDLOOP.
ENDLOOP.
LOOP AT lt_fte_aux_00 INTO ld_fte_aux_00.
WRITE : / ld_fte_aux_00.
APPEND ld_fte_aux_00 TO lt_fte_prefinal.
APPEND ld_fte_aux_00 TO lt_fte_final.
ENDLOOP.
APPEND INITIAL LINE TO lt_fte_prefinal.
APPEND INITIAL LINE TO lt_fte_final.
WRITE : /.
LOOP AT lt_fte_aux INTO wa_fte_aux.
WRITE : / wa_fte_aux.
APPEND wa_fte_aux TO lt_fte_prefinal.
ENDLOOP.
WRITE : /.
LOOP AT lt_codfte INTO wa_codfte.
REPLACE '"' WITH '*' INTO wa_codfte.
MODIFY lt_codfte FROM wa_codfte.
WRITE : / wa_codfte.
APPEND wa_codfte TO lt_fte_prefinal.
APPEND wa_codfte TO lt_fte_final.
ENDLOOP.
*