*&---------------------------------------------------------------------*
*& Report ZBACK_AND_REST
*& Este programa permite realizar Back Up y Restauración de
*& Module Pool, Grupo de Funciones y Reportes
*&
*& El Back Up y la Restauracion incluyen:
*& Dynpros, PF Status, Modulos de Funciones, etc
*&
*& Modo de Uso :
*& - Seleccione la operacion a realizar ( Back Up o Restauracion)
*& - Seleccione el tipo de aplicacion (Reporte, Module Pool o Grupo de Funciones)
*& - Ingrese el nombre de la aplicacion.
*& (En caso de seleccionar un grupo de funciones, indicar el nombre del grupo
*& y no de alguno de sus modulos de funciones)
*& - Seleccione la ruta donde se guardaran los archivos generados (en caso de Back Up)
*& o la ruta donde se encuentran los archivos generados (en caso de restauracion)
*&
*& Recomendaciones:
*& - No cambie el nombre de ninguno de los archivos y carpetas generados
*& - En caso de restauracion, el nombre a ingresar debera ser el mismo que el
*& de la carpeta generada.
*&
*& Contacto:
*& - Por reporte de errores, dumps, bugs, modificaciones, etc
*& enviar mail a: pablopessoa@gmail.com
*&---------------------------------------------------------------------*
*& Desarrollado por : Pablo Guillermo Pessoa
*& Fecha : 27-07-2010
*& La Plata - Bs As - Argentina
*&---------------------------------------------------------------------*
REPORT zback_and_rest_ppe.
TABLES : trdir,trkey.
***********************************************************************
* DATA (Para descargar el programa)
***********************************************************************
"Programa Principal
DATA: prog_texts LIKE textpool OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF prog_source OCCURS 0,
line(255) TYPE c,
END OF prog_source.
"Include
DATA: inc_texts LIKE textpool OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF inc_source OCCURS 0,
line(255) TYPE c,
END OF inc_source.
DATA: gt_trdir TYPE STANDARD TABLE OF trdir WITH HEADER LINE. "trdir Tabla de sistema TRDIR
DATA: gt_d010inc TYPE STANDARD TABLE OF d010inc WITH HEADER LINE. " Tabla de Includes
DATA: gs_trdir TYPE trdir. "Tabla de sistema TRDIR
DATA: gs_d010inc TYPE d010inc. "Tabla de utilización para Includes ABAP
***********************************************************************
* DATA (Para grupos de funciones)
***********************************************************************
DATA : gt_tfdir TYPE STANDARD TABLE OF tfdir,
gt_enlfdir TYPE STANDARD TABLE OF enlfdir,
gs_enlfdir TYPE enlfdir,
gs_tfdir TYPE tfdir.
DATA: gt_functab TYPE TABLE OF rs38l_incl,
gs_functab TYPE rs38l_incl,
gt_dokumentation TYPE TABLE OF funct,
gt_exception_list TYPE TABLE OF rsexc,
gt_export_parameter TYPE TABLE OF rsexp,
gt_import_parameter TYPE TABLE OF rsimp,
gt_tables_parameter TYPE TABLE OF rstbl,
includes TYPE rs38l-name,
nombre_funcion TYPE tlibg-area,
funcion_tlibg TYPE tlibg-area,
funcion_rs38l TYPE rs38l-name.
***********************************************************************
* DATA (Para Module Pool)
***********************************************************************
DATA: gt_d020t TYPE TABLE OF d020t. "Descripción breve del dynpro
DATA: gt_d020s TYPE TABLE OF d020s. "Tabla de sistema D020S (sources de dynpro)
DATA: gt_d021s TYPE TABLE OF d021s. "fld Campos de dynpro
DATA: gt_d022s TYPE TABLE OF d022s. "src Lógica de proceso en dynpro
DATA: gt_d023s TYPE TABLE OF d023s. "matchcodes dynpro
DATA: gt_d021t TYPE TABLE OF d021t. "d021t Textos de palabras clave en dynpro
"workAreas
DATA: gs_d020s TYPE d020s. "hdr dynpros
DATA: gs_d020t TYPE d020t. "Descripción breve del dynpro
DATA: gs_d021s TYPE d021s. "Campos de dynpro
DATA: gs_d022s TYPE d022s. "Lógica de proceso en dynpro
DATA: gs_d023s TYPE d023s. "Parámetros dynpro
DATA: BEGIN OF dynp_id,
prog TYPE d020t-prog,
dynr TYPE d020t-dynr,
END OF dynp_id.
DATA: mess(50) TYPE c,
line(50) TYPE c,
word(50) TYPE c.
***********************************************************************
************* DATA Para menu painter (gui status)
*** Codigo extraido y adaptado del programa ZREPTRAN_620
***********************************************************************
DATA: stx4 TYPE STANDARD TABLE OF rsmptexts WITH HEADER LINE.
DATA: fun4 TYPE STANDARD TABLE OF rsmpe_funt WITH HEADER LINE.
DATA: ctx4 TYPE STANDARD TABLE OF rsmpe_ctx WITH HEADER LINE.
DATA: mtx4 TYPE STANDARD TABLE OF rsmpe_mnlt WITH HEADER LINE.
DATA: men4 TYPE STANDARD TABLE OF rsmpe_men WITH HEADER LINE.
DATA: act4 TYPE STANDARD TABLE OF rsmpe_act WITH HEADER LINE.
DATA: doc4 TYPE STANDARD TABLE OF rsmpe_atrt WITH HEADER LINE.
DATA: sta4 TYPE STANDARD TABLE OF rsmpe_stat WITH HEADER LINE.
DATA: set4 TYPE STANDARD TABLE OF rsmpe_staf WITH HEADER LINE.
DATA: pfk4 TYPE STANDARD TABLE OF rsmpe_pfk WITH HEADER LINE.
DATA: but4 TYPE STANDARD TABLE OF rsmpe_but WITH HEADER LINE.
DATA: tit4 TYPE STANDARD TABLE OF rsmpe_titt WITH HEADER LINE.
DATA: biv46c TYPE STANDARD TABLE OF rsmpe_buts WITH HEADER LINE.
DATA: tadm4 TYPE STANDARD TABLE OF rsmpe_adm WITH HEADER LINE.
DATA: adm4 TYPE rsmpe_adm.
DATA: gs_tadir TYPE tadir.
DATA: gt_tadir TYPE STANDARD TABLE OF tadir.
DATA: gs_tdevc TYPE tdevc.
DATA: tr_key TYPE trkey.
***********************************************************************
* DATA (Generales)
***********************************************************************
DATA: ruta_destino TYPE string.
DATA: resp TYPE c.
DATA: pro_name TYPE reposrc-progname. "se insertara el nombre a guardar en las tablas
DATA: nombregrupo TYPE string.
DATA: reporte TYPE reposrc-progname.
***********************************************************************
********************** Selection - Screen
***********************************************************************
SELECTION-SCREEN BEGIN OF BLOCK programa WITH FRAME TITLE tprogram.
SELECTION-SCREEN SKIP 1 .
SELECTION-SCREEN BEGIN OF BLOCK operac WITH FRAME TITLE toperac.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(13) tbackup.
PARAMETERS: rb_back RADIOBUTTON GROUP oper.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(13) trestore.
PARAMETERS: rb_rest RADIOBUTTON GROUP oper.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK operac.
SELECTION-SCREEN SKIP 1 .
SELECTION-SCREEN BEGIN OF BLOCK aplic WITH FRAME TITLE ttipo.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(19) trepor.
PARAMETERS: rb_repor RADIOBUTTON GROUP appl.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(19) tmodul.
PARAMETERS: rb_modul RADIOBUTTON GROUP appl.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(19) tgrupo.
PARAMETERS: rb_grupo RADIOBUTTON GROUP appl.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK aplic.
SELECTION-SCREEN SKIP 1 .
SELECTION-SCREEN BEGIN OF BLOCK info WITH FRAME TITLE tinfo.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(23) tname.
PARAMETERS: p_name TYPE reposrc-progname DEFAULT ' '.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(23) tdest.
PARAMETERS: p_dest TYPE string DEFAULT 'C:\' LOWER CASE.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK info.
SELECTION-SCREEN SKIP 1 .
SELECTION-SCREEN END OF BLOCK programa.
***********************************************************************
* AT SELECTION-SCREEN
***********************************************************************
"ayuda de busqueda de ruta donde guardar los archivos
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_dest.
PERFORM f_ayuda USING p_dest.
***********************************************************************
* Inicializacion de textos de Selección
***********************************************************************
INITIALIZATION.
tprogram = 'Back up y Restauración de Aplicaciones'.
toperac = 'Seleccione Operación'.
tbackup = 'Back Up'.
trestore = 'Restauración'.
ttipo = 'Seleccione Tipo de Aplicación'.
trepor = 'Reporte'.
tmodul = 'Module Pool'.
tgrupo = 'Grupo de Funciones'.
tinfo = 'Complete la Información'.
tname = 'Nombre :'.
tdest = 'Ruta Destino / Origen :'.
***********************************************************************
* START-OF-SELECTION
***********************************************************************
START-OF-SELECTION.
IF rb_back = 'X'. " La Operacion es de Back Up
IF rb_repor = 'X'.
PERFORM backup_reporte.
ENDIF.
IF rb_modul = 'X'.
PERFORM backup_module.
ENDIF.
IF rb_grupo = 'X'.
PERFORM backup_grupofunc.
ENDIF.
ELSE. "La Operacion es de Restauracion
IF rb_repor = 'X'.
PERFORM restore_reporte.
ENDIF.
IF rb_modul = 'X'.
PERFORM restore_module.
ENDIF.
IF rb_grupo = 'X'.
PERFORM restore_grupofunc.
ENDIF.
ENDIF.
***********************************************************************
* SUB-RUTINAS
***********************************************************************
*&---------------------------------------------------------------------*
*& Form F_AYUDA
*& Obtiene la ruta donde se colocaran los archivos
*&---------------------------------------------------------------------*
FORM f_ayuda USING p_aux.
" abre un browser para seleccionar el directorio de destino
CALL METHOD cl_gui_frontend_services=>directory_browse
EXPORTING
window_title = 'Seleccione un Directorio'
initial_folder = 'C:\'
CHANGING
selected_folder = p_aux.
ENDFORM. "F_AYUDA
*&---------------------------------------------------------------------*
*& Form BACKUP_REPORTE
*&---------------------------------------------------------------------*
FORM backup_reporte .
PERFORM backup_module.
ENDFORM. " BACKUP_REPORTE
*&---------------------------------------------------------------------*
*& Form BACKUP_MODULE
*& Realiza el backup del Module Pool
*&---------------------------------------------------------------------*
FORM backup_module .
REFRESH gt_trdir.
"valido en trdir qeu exista el programa Principal
SELECT SINGLE *
INTO CORRESPONDING FIELDS OF gs_trdir
FROM trdir WHERE name EQ p_name.
IF sy-subrc EQ 0.
"voy generando la entrada en TRDIR tanto para includes como para el module pool
APPEND gs_trdir TO gt_trdir.
"Descargo los elementos de texto del Programa Pincipal
READ TEXTPOOL p_name INTO prog_texts.
CLEAR ruta_destino.
CONCATENATE p_dest '\' p_name '\TEXTELEMENT\' p_name INTO ruta_destino.
PERFORM download TABLES prog_texts USING ruta_destino.
"Descargo el Codigo Fuente del Programa Pincipal
READ REPORT p_name INTO prog_source.
CLEAR ruta_destino.
CONCATENATE p_dest '\' p_name '\SOURCES\' p_name INTO ruta_destino.
PERFORM download TABLES prog_source USING ruta_destino.
" Ahora traigo toda la lista de includes de ese module pool
PERFORM buscar_includes TABLES gt_d010inc USING p_name.
"loopeo la tabla de includes y por cada uno guardo el source, la entrada en trdir y los elem de texto
LOOP AT gt_d010inc INTO gs_d010inc.
CLEAR gs_trdir.
SELECT SINGLE *
INTO CORRESPONDING FIELDS OF gs_trdir
FROM trdir WHERE name EQ gs_d010inc-include.
APPEND gs_trdir TO gt_trdir.
"Descargo los elementos de texto del include gs_d010inc-include
CLEAR prog_texts.
READ TEXTPOOL gs_d010inc-include INTO prog_texts.
CLEAR ruta_destino.
CONCATENATE p_dest '\' p_name '\TEXTELEMENT\' gs_d010inc-include INTO ruta_destino.
PERFORM download TABLES prog_texts USING ruta_destino.
"Descargo el Codigo Fuente include gs_d010inc-include
CLEAR prog_source.
READ REPORT gs_d010inc-include INTO prog_source.
CLEAR ruta_destino.
CONCATENATE p_dest '\' p_name '\SOURCES\' gs_d010inc-include INTO ruta_destino.
PERFORM download TABLES prog_source USING ruta_destino.
ENDLOOP.
" Descargo todas las entradas en TRDIR
CLEAR ruta_destino.
CONCATENATE p_dest '\' p_name '\TRDIR' INTO ruta_destino.
PERFORM download TABLES gt_trdir USING ruta_destino.
"Busco los status Gui.
PERFORM savestatus USING p_dest p_name.
"Descargo las dynpros
PERFORM savedynpros USING p_dest p_name.
ELSE.
MESSAGE 'El Module Pool Ingresado no Existe' TYPE 'S'.
ENDIF.
ENDFORM. " BACKUP_MODULE
*&---------------------------------------------------------------------*
*& Form BACKUP_GRUPOFUNC
*&---------------------------------------------------------------------*
FORM backup_grupofunc .
"el grupo de funciones es un reporte, por lo tanto tengo que guardar su codigo fuente
"asi como de todos sus includes para poder despues ingresarlos al sistema
CONCATENATE 'SAPL' p_name INTO nombregrupo.
reporte = nombregrupo.
READ REPORT reporte INTO prog_source.
"guardo el codigo fuente del grupo de funciones
CLEAR ruta_destino.
CONCATENATE p_dest '\' p_name '\FUNCTIONGROUP\' p_name INTO ruta_destino.
PERFORM download TABLES prog_source USING ruta_destino.
"ahora busco y descargo los codigos fuentes de todos los includes del grupo de funciones
" hay que destacar que no es son lo mismo los source del grupo que del modulo de funcion
PERFORM buscar_includes TABLES gt_d010inc USING nombregrupo.
CLEAR ruta_destino.
CONCATENATE p_dest '\' p_name '\FUNCTIONGROUP\INCLUDES' INTO ruta_destino.
PERFORM download TABLES gt_d010inc USING ruta_destino.
"Loopeo la tabla de d010inc y saco los trdir de cada uno
LOOP AT gt_d010inc INTO gs_d010inc.
"Saco y guardo el codigo fuente de cada include
reporte = gs_d010inc-include.
READ REPORT reporte INTO prog_source.
CLEAR ruta_destino.
CONCATENATE p_dest '\' p_name '\FUNCTIONGROUP\' gs_d010inc-include INTO ruta_destino.
PERFORM download TABLES prog_source USING ruta_destino.
" esto crea una tabla "INCLUDES SOURCE" donde estaran los codigos fuentes de todos los includes
ENDLOOP.
"Busco los status Gui.
PERFORM savestatus USING p_dest p_name.
"Descargo las dynpros
PERFORM savedynpros USING p_dest nombregrupo.
"Ya guarde toda la informacion del grupo de funciones y sus includes
" ahora busco los modulos de funciones y guardo su informacion
funcion_tlibg = p_name.
CALL FUNCTION 'RS_FUNCTION_POOL_CONTENTS'
EXPORTING
function_pool = funcion_tlibg
TABLES
functab = gt_functab
EXCEPTIONS
function_pool_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
"Encontro la tabla de modulos de funciones para el grupo p_name
" la loopeo y traigo la informacion de cada module
LOOP AT gt_functab INTO gs_functab.
"descargo la tabla que tiene todos los modulos de funciones
CLEAR ruta_destino.
CONCATENATE p_dest '\' p_name '\FUNCTIONMODULES\MODULES' INTO ruta_destino.
PERFORM download TABLES gt_functab USING ruta_destino.
includes = gs_functab-funcname.
CALL FUNCTION 'FUNCTION_IMPORT_DOKU'
EXPORTING
funcname = includes
TABLES
dokumentation = gt_dokumentation
exception_list = gt_exception_list
export_parameter = gt_export_parameter
import_parameter = gt_import_parameter
tables_parameter = gt_tables_parameter
EXCEPTIONS
error_message = 1
function_not_found = 2
invalid_name = 3
OTHERS = 4.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
" No tuvo problemas en importar la funcion, traigo el codigo fuente de su include
CLEAR prog_source.
reporte = gs_functab-include.
READ REPORT reporte INTO prog_source.
"y guardo toda la informacion
CONCATENATE p_dest '\' p_name '\FUNCTIONMODULES\dokumentation_' gs_functab-include INTO ruta_destino.
PERFORM download TABLES gt_dokumentation USING ruta_destino.
CONCATENATE p_dest '\' p_name '\FUNCTIONMODULES\exception_list_' gs_functab-include INTO ruta_destino.
PERFORM download TABLES gt_exception_list USING ruta_destino.
CONCATENATE p_dest '\' p_name '\FUNCTIONMODULES\export_parameter_' gs_functab-include INTO ruta_destino.
PERFORM download TABLES gt_export_parameter USING ruta_destino.
CONCATENATE p_dest '\' p_name '\FUNCTIONMODULES\import_parameter_' gs_functab-include INTO ruta_destino.
PERFORM download TABLES gt_import_parameter USING ruta_destino.
CONCATENATE p_dest '\' p_name '\FUNCTIONMODULES\tables_parameter_' gs_functab-include INTO ruta_destino.
PERFORM download TABLES gt_tables_parameter USING ruta_destino.
CONCATENATE p_dest '\' p_name '\FUNCTIONMODULES\' gs_functab-include INTO ruta_destino.
PERFORM download TABLES prog_source USING ruta_destino.
ENDIF.
ENDLOOP.
ENDIF.
ENDFORM. " BACKUP_GRUPOFUNC
*&---------------------------------------------------------------------*
*& Form RESTORE_REPORTE
*&---------------------------------------------------------------------*
FORM restore_reporte .
PERFORM restore_module.
ENDFORM. " RESTORE_REPORTE
*&---------------------------------------------------------------------*
*& Form RESTORE_MODULE
*&---------------------------------------------------------------------*
FORM restore_module .
DATA : programa TYPE string.
" Levanto las tablas TRDIR
REFRESH gt_trdir.
CLEAR ruta_destino.
CONCATENATE p_dest '\TRDIR' INTO ruta_destino.
PERFORM upload TABLES gt_trdir USING ruta_destino. "gt_trdir-name
" loopeo la tabla gt_trdir y cargo todo el contenido ( module pool e includes)
LOOP AT gt_trdir INTO gs_trdir.
programa = gs_trdir-name.
"Verificar que no existe el programa para no reescribirlo
resp = 1.
SELECT SINGLE * FROM trdir WHERE name = programa.
IF sy-subrc = 0.
PERFORM popuptoconfirm USING resp programa.
ENDIF.
IF resp = 1. " se puede insertar el programa/include
"inserto el codigo fuente
CLEAR ruta_destino.
CONCATENATE p_dest '\SOURCES\' programa INTO ruta_destino.
PERFORM upload TABLES prog_source USING ruta_destino.
pro_name = programa.
INSERT REPORT pro_name FROM prog_source DIRECTORY ENTRY gs_trdir.
"inserto los elementos de texto
CLEAR ruta_destino.
CONCATENATE p_dest '\TEXTELEMENT\' programa INTO ruta_destino.
PERFORM upload TABLES prog_texts USING ruta_destino.
INSERT textpool pro_name FROM prog_texts LANGUAGE sy-langu.
ENDIF.
ENDLOOP.
"Busco los status Gui.
PERFORM uploadstatus USING p_dest p_name.
"Restaurados el Programa y los Includes, Restauro las Dynpros
PERFORM uploaddynpros USING p_dest.
ENDFORM. " RESTORE_MODULE
*&---------------------------------------------------------------------*
*& Form RESTORE_GRUPOFUNC
*&---------------------------------------------------------------------*
FORM restore_grupofunc .
nombre_funcion = p_name.
"Compruebo que no exista el grupo en el sistema
resp = 1.
CALL FUNCTION 'RS_FUNCTION_POOL_EXISTS'
EXPORTING
function_pool = nombre_funcion
EXCEPTIONS
pool_not_exists = 1
OTHERS = 2.
IF sy-subrc = 0. " el grupo existe, se debe pedir confirmacion
PERFORM popuptoconfirm USING resp nombre_funcion.
ENDIF.
IF resp = 1 . " Esta habilitado a insertar el grupo de funciones
"Comienzo por crear el grupo de funciones con sus includes
CALL FUNCTION 'FUNCTION_POOL_CREATE'
EXPORTING
pool_name = nombre_funcion
short_text = nombre_funcion
EXCEPTIONS
name_already_exists = 1
name_not_correct = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
"Ya cree el grupo.. ahora inserto el codigo fuente del grupo y cargo todos sus includes
CONCATENATE p_dest '\FUNCTIONGROUP\' p_name INTO ruta_destino.
PERFORM upload TABLES prog_source USING ruta_destino.
funcion_rs38l = p_name.
INSERT REPORT funcion_rs38l FROM prog_source.
"INCLUDES
REFRESH gt_d010inc.
CONCATENATE p_dest '\FUNCTIONGROUP\INCLUDES' INTO ruta_destino.
PERFORM upload TABLES gt_d010inc USING ruta_destino. "MASTER INCLUDE
LOOP AT gt_d010inc INTO gs_d010inc.
REFRESH prog_source.
CONCATENATE p_dest '\FUNCTIONGROUP\' gs_d010inc-include INTO ruta_destino.
PERFORM upload TABLES prog_source USING ruta_destino.
funcion_rs38l = gs_d010inc-include.
INSERT REPORT funcion_rs38l FROM prog_source.
ENDLOOP.
"Restaurados el Programa y los Includes, Restauro las Dynpros
PERFORM uploaddynpros USING p_dest.
"ya termine con el grupo de funciones, ahora cargo todos sus modulos de funciones
CONCATENATE p_dest '\FUNCTIONMODULES\MODULES' INTO ruta_destino.
PERFORM upload TABLES gt_functab USING ruta_destino. "FUNCNAME INCLUDE
LOOP AT gt_functab INTO gs_functab.
"levanto los archivos necesarios para crear la funcion
CONCATENATE p_dest '\FUNCTIONMODULES\import_parameter_' gs_functab-include INTO ruta_destino.
PERFORM upload TABLES gt_import_parameter USING ruta_destino.
CONCATENATE p_dest '\FUNCTIONMODULES\dokumentation_' gs_functab-include INTO ruta_destino.
PERFORM upload TABLES gt_dokumentation USING ruta_destino.
CONCATENATE p_dest '\FUNCTIONMODULES\exception_list_' gs_functab-include INTO ruta_destino.
PERFORM upload TABLES gt_exception_list USING ruta_destino.
CONCATENATE p_dest '\FUNCTIONMODULES\export_parameter_' gs_functab-include INTO ruta_destino.
PERFORM upload TABLES gt_export_parameter USING ruta_destino.
CONCATENATE p_dest '\FUNCTIONMODULES\tables_parameter_' gs_functab-include INTO ruta_destino.
PERFORM upload TABLES gt_tables_parameter USING ruta_destino.
CONCATENATE p_dest '\FUNCTIONMODULES\' gs_functab-include INTO ruta_destino.
PERFORM upload TABLES prog_source USING ruta_destino.
"creo la funcion
funcion_tlibg = p_name.
CALL FUNCTION 'FUNCTION_CREATE'
EXPORTING
funcname = gs_functab-funcname
function_pool = funcion_tlibg
short_text = funcion_tlibg
TABLES
exception_list = gt_exception_list
export_parameter = gt_export_parameter
import_parameter = gt_import_parameter
parameter_docu = gt_dokumentation
tables_parameter = gt_tables_parameter
EXCEPTIONS
double_task = 1
error_message = 2
function_already_exists = 3
invalid_function_pool = 4
invalid_name = 5
too_many_functions = 6
OTHERS = 7.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
"le inserto el codigo fuente
funcion_rs38l = gs_functab-funcname.
INSERT REPORT funcion_rs38l FROM prog_source.
ENDLOOP.
ENDIF.
ENDFORM. " RESTORE_GRUPOFUNC
*&---------------------------------------------------------------------*
*& Form BUSCAR_INCLUDES
*&---------------------------------------------------------------------*
FORM buscar_includes TABLES gt_d010inc_aux USING programa.
DATA : gs_d010inc_aux TYPE d010inc.
DATA : str(2) TYPE c.
SELECT *
INTO CORRESPONDING FIELDS OF TABLE gt_d010inc_aux
FROM d010inc WHERE master EQ p_name AND
include NOT LIKE '<%' AND
include NOT LIKE '>%' AND
include NOT LIKE '%======%'.
LOOP AT gt_d010inc_aux INTO gs_d010inc_aux.
str = gs_d010inc_aux-include+0(2).
IF str = '%_' OR str = 'CL' OR str = 'CX' OR str = 'IF' .
DELETE gt_d010inc_aux INDEX sy-tabix.
ENDIF.
ENDLOOP.
ENDFORM. " BUSCAR_INCLUDES
*&---------------------------------------------------------------------*
*& Form SAVESTATUS
*&---------------------------------------------------------------------*
FORM savestatus USING destino programa.
DATA: pro TYPE program.
DATA: prog TYPE trdir-name.
DATA: ruta_destino TYPE string.
pro = programa. " esto se hace asi por que sino sale error con el tipo de parametro qeu se pasa
prog = programa.
"saco los valores de la tabla TADIR
CALL FUNCTION 'AKB_GET_TADIR'
EXPORTING
obj_type = 'PROG'
obj_name = prog
IMPORTING
tadir = gs_tadir
tdevc = gs_tdevc
EXCEPTIONS
object_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
REFRESH gt_tadir.
APPEND gs_tadir TO gt_tadir.
CLEAR ruta_destino.
CONCATENATE destino '\' programa '\STATUSGUI\TADIR' INTO ruta_destino.
PERFORM download TABLES gt_tadir USING ruta_destino.
SELECT * FROM rsmptexts INTO TABLE stx4
WHERE progname = pro.
CALL FUNCTION 'RS_CUA_INTERNAL_FETCH'
EXPORTING
program = prog
IMPORTING
adm = adm4
TABLES
sta = sta4
fun = fun4
men = men4
mtx = mtx4
act = act4
but = but4
pfk = pfk4
set = set4
doc = doc4
tit = tit4
biv = biv46c
EXCEPTIONS
not_found = 1
unknown_version = 2
OTHERS = 3.
IF sy-subrc = 0.
"Descargo todas las tablas en la carpeta STATUSGUI
CLEAR ruta_destino.
CONCATENATE destino '\' programa '\STATUSGUI\sta4' INTO ruta_destino.
PERFORM download TABLES sta4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\' programa '\STATUSGUI\stx4' INTO ruta_destino.
PERFORM download TABLES stx4 USING ruta_destino.
REFRESH tadm4.
APPEND adm4 TO tadm4.
CLEAR ruta_destino.
CONCATENATE destino '\' programa '\STATUSGUI\adm4' INTO ruta_destino.
PERFORM download TABLES tadm4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\' programa '\STATUSGUI\fun4' INTO ruta_destino.
PERFORM download TABLES fun4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\' programa '\STATUSGUI\men4' INTO ruta_destino.
PERFORM download TABLES men4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\' programa '\STATUSGUI\mtx4' INTO ruta_destino.
PERFORM download TABLES mtx4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\' programa '\STATUSGUI\act4' INTO ruta_destino.
PERFORM download TABLES act4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\' programa '\STATUSGUI\but4' INTO ruta_destino.
PERFORM download TABLES but4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\' programa '\STATUSGUI\pfk4' INTO ruta_destino.
PERFORM download TABLES pfk4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\' programa '\STATUSGUI\set4' INTO ruta_destino.
PERFORM download TABLES set4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\' programa '\STATUSGUI\doc4' INTO ruta_destino.
PERFORM download TABLES doc4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\' programa '\STATUSGUI\tit4' INTO ruta_destino.
PERFORM download TABLES tit4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\' programa '\STATUSGUI\biv46c' INTO ruta_destino.
PERFORM download TABLES biv46c USING ruta_destino.
ENDIF.
ENDFORM. " SAVESTATUS
*&---------------------------------------------------------------------*
*& Form UPLOADSTATUS
*&---------------------------------------------------------------------*
FORM uploadstatus USING destino programa.
DATA: pro TYPE program.
DATA: prog TYPE trdir-name.
DATA: ruta_destino TYPE string.
"LÑevanto todas las tablas en la carpeta STATUSGUI
CLEAR ruta_destino.
CONCATENATE destino '\STATUSGUI\TADIR' INTO ruta_destino.
PERFORM upload TABLES gt_tadir USING ruta_destino.
CLEAR gs_tadir.
READ TABLE gt_tadir INTO gs_tadir INDEX 1.
CLEAR ruta_destino.
CONCATENATE destino '\STATUSGUI\sta4' INTO ruta_destino.
PERFORM upload TABLES sta4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\STATUSGUI\stx4' INTO ruta_destino.
PERFORM upload TABLES stx4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\STATUSGUI\adm4' INTO ruta_destino.
PERFORM upload TABLES tadm4 USING ruta_destino.
CLEAR adm4.
READ TABLE tadm4 INTO adm4 INDEX 1.
CLEAR ruta_destino.
CONCATENATE destino '\STATUSGUI\fun4' INTO ruta_destino.
PERFORM upload TABLES fun4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\STATUSGUI\men4' INTO ruta_destino.
PERFORM upload TABLES men4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\STATUSGUI\mtx4' INTO ruta_destino.
PERFORM upload TABLES mtx4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\STATUSGUI\act4' INTO ruta_destino.
PERFORM upload TABLES act4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\STATUSGUI\but4' INTO ruta_destino.
PERFORM upload TABLES but4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\STATUSGUI\pfk4' INTO ruta_destino.
PERFORM upload TABLES pfk4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\STATUSGUI\set4' INTO ruta_destino.
PERFORM upload TABLES set4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\STATUSGUI\doc4' INTO ruta_destino.
PERFORM upload TABLES doc4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\STATUSGUI\tit4' INTO ruta_destino.
PERFORM upload TABLES tit4 USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\STATUSGUI\biv46c' INTO ruta_destino.
PERFORM upload TABLES biv46c USING ruta_destino.
prog = programa.
CALL FUNCTION 'RS_CUA_INTERNAL_WRITE'
EXPORTING
program = prog
language = sy-langu
tr_key = tr_key
adm = adm4
TABLES
sta = sta4
fun = fun4
men = men4
mtx = mtx4
act = act4
but = but4
pfk = pfk4
set = set4
doc = doc4
tit = tit4
biv = biv46c
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc = 0.
MODIFY rsmptexts FROM TABLE stx4.
ENDIF.
ENDFORM. " UPLOADSTATUS
*&---------------------------------------------------------------------*
*& Form SAVEDYNPROS
*&---------------------------------------------------------------------*
FORM savedynpros USING destino programa .
"Primero traigo las dynpros asociadas al programa de la tabla D020S
SELECT *
INTO CORRESPONDING FIELDS OF TABLE gt_d020t
FROM d020t
WHERE prog = programa. "AND dtxt NOT LIKE 'SEL_SCREEN%'.
"Loopeo los resultados obtenidos para traer el detalle de cada dynpro
LOOP AT gt_d020t INTO gs_d020t.
dynp_id-prog = gs_d020t-prog.
dynp_id-dynr = gs_d020t-dynr.
IMPORT DYNPRO gs_d020s gt_d021s gt_d022s gt_d023s ID dynp_id.
CLEAR ruta_destino.
CONCATENATE destino '\' programa '\DYNPROS\DYN_SOU_' dynp_id-dynr INTO ruta_destino.
REFRESH gt_d020s.
APPEND gs_d020s TO gt_d020s.
PERFORM download TABLES gt_d020s USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\' programa '\DYNPROS\DYN_CAM_' dynp_id-dynr INTO ruta_destino.
PERFORM download TABLES gt_d021s USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\' programa '\DYNPROS\DYN_LOG_' dynp_id-dynr INTO ruta_destino.
PERFORM download TABLES gt_d022s USING ruta_destino.
CLEAR ruta_destino.
CONCATENATE destino '\' programa '\DYNPROS\DYN_PAR_' dynp_id-dynr INTO ruta_destino.
PERFORM download TABLES gt_d023s USING ruta_destino.
"Traigo la informacion de la tabla d021t
SELECT * INTO CORRESPONDING FIELDS OF TABLE gt_d021t
FROM d021t WHERE prog EQ dynp_id-prog AND dynr EQ dynp_id-dynr.
CLEAR ruta_destino.
CONCATENATE destino '\' programa '\DYNPROS\DYN_21T_' dynp_id-dynr INTO ruta_destino.
PERFORM download TABLES gt_d021t USING ruta_destino.
ENDLOOP.
" descargo la tabla que tiene los nombres de las dynpros
CLEAR ruta_destino.
CONCATENATE destino '\' programa '\DYNPROS\DYN_20T' INTO ruta_destino.
PERFORM download TABLES gt_d020t USING ruta_destino.
ENDFORM. " SAVEDYNPROS
*&---------------------------------------------------------------------*
*& Form UPLOADDYNPROS
*&---------------------------------------------------------------------*
FORM uploaddynpros USING origen.
CLEAR ruta_destino.
CONCATENATE origen '\DYNPROS\DYN_20T' INTO ruta_destino.
PERFORM upload TABLES gt_d020t USING ruta_destino.
"Loopeo la tabla de Dynpros y genero cada una
LOOP AT gt_d020t INTO gs_d020t.
" cada ds_d020t es un numero de dynpro asociado al programa PROG Y DYNR
"Levanto los archivos correspondientes a la Dynpro DYNR
"'SOU'.
CLEAR ruta_destino.
CONCATENATE origen '\DYNPROS\DYN_SOU_' gs_d020t-dynr INTO ruta_destino.
PERFORM upload TABLES gt_d020s USING ruta_destino.
"'CAM'.
CLEAR ruta_destino.
CONCATENATE origen '\DYNPROS\DYN_CAM_' gs_d020t-dynr INTO ruta_destino.
PERFORM upload TABLES gt_d021s USING ruta_destino.
"'LOG'.
CLEAR ruta_destino.
CONCATENATE origen '\DYNPROS\DYN_LOG_' gs_d020t-dynr INTO ruta_destino.
PERFORM upload TABLES gt_d022s USING ruta_destino.
"'PAR'.
CLEAR ruta_destino.
CONCATENATE origen '\DYNPROS\DYN_PAR_' gs_d020t-dynr INTO ruta_destino.
PERFORM upload TABLES gt_d023s USING ruta_destino.
"21t
CLEAR ruta_destino.
CONCATENATE origen '\DYNPROS\DYN_21T_' gs_d020t-dynr INTO ruta_destino.
PERFORM upload TABLES gt_d021t USING ruta_destino.
CLEAR dynp_id.
dynp_id-prog = gs_d020t-prog.
dynp_id-dynr = gs_d020t-dynr.
READ TABLE gt_d020s INTO gs_d020s INDEX 1.
GENERATE DYNPRO gs_d020s gt_d021s gt_d022s gt_d023s ID dynp_id
MESSAGE mess LINE line WORD word.
IF sy-subrc = 0.
EXPORT DYNPRO gs_d020s gt_d021s gt_d022s gt_d023s ID dynp_id.
ENDIF.
ENDLOOP.
ENDFORM. " UPLOADDYNPROS
*&---------------------------------------------------------------------*
*& Form DOWNLOAD
*&---------------------------------------------------------------------*
FORM download TABLES tabla USING value(ruta_destino).
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = ruta_destino
filetype = 'DAT'
TABLES
data_tab = tabla
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " DOWNLOAD
*&---------------------------------------------------------------------*
*& Form UPLOAD
*&---------------------------------------------------------------------*
FORM upload TABLES tabla USING value(ruta_destino).
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = ruta_destino
filetype = 'DAT'
TABLES
data_tab = tabla
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " UPLOAD
*&---------------------------------------------------------------------*
*& Form POPUPTOCONFIRM
*&---------------------------------------------------------------------*
FORM popuptoconfirm USING p_resp p_programa.
DATA: pregunta TYPE string,
title TYPE string.
CLEAR pregunta.
CLEAR title.
CONCATENATE 'El programa/include ' p_programa ' ya existe en el Sistema' INTO title.
CONCATENATE 'Si decide continuar se reemplazara bajo su responsabilidad' cl_abap_char_utilities=>newline INTO pregunta.
CONCATENATE pregunta 'Continuar de todos modos ?' INTO pregunta.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
titlebar = title
text_question = pregunta
default_button = '2'
display_cancel_button = space
text_button_1 = 'Continuar'(002)
text_button_2 = 'Cancelar'(003)
IMPORTING
answer = resp
EXCEPTIONS
text_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " POPUPTOCONFIRM
Sunday, March 31, 2013
Download and Uploda MOdule Pool Program
Friday, March 29, 2013
IDES Server Configuration
SAP IDES Installation Procedure
for SAP Install on W2k server
Procedure for installation on W2k server with sp3.
Installation Of SAP 4.6b
System Requirements.
P-III System
1024 MB or 512 MB RAM
Minimum 60GB HDD
40 GB Hdd (2GB for WinNT & 38 GB for oracle & SAP)
10 GB Hdd for CD dumps.
CDROM drive.
Network Card
C:\ - 10GB - Windows 2000 Server - NTFS
D:\ - 40GB - Oracle & SAP - NTFS
E:\ - 10GB - CD Dumps - NTFS
F:\ - CDROM Drive
Install Windows 2000 server in first 10GB partition
Computer Name - SAPSRV
IP Address - 192.168.1.2
Subnet Mask - 255.255.255.0
Work Group - TEKSOFT
Complete the installation & Restart.
Install Service Pack 3
Install All the Drivers
Install IE6 SP1
Create two Users as mentioned bellow
Start -> Programs -> Administrative Tools -> Computer Management -> Local Users
and Groups -> Users -> New User
a. First user name TEKADM
Give password, disable the already enabled option & enable
"Password Never Expires & user cannot change the password option "
b. Second user name SAPServiceTEK
Give password, disable the already enabled option & enable
"Password Never Expires & user cannot change the password option "
Add the two Users to Administrators Group
Change hostfile
Open C:\Winnt\System32\driver\ect\host file in Notepad & add IP Address and Computer Name in
The bottom of file. Save & Exit.
Change the Virtual Memory
C: Min - 512MB
Max - 1024MB
D: Min - 2048MB
Max - 2560MB
Change the File and Printer sharing properties to “ Maximize through
Logon as TEKADM
Insert SAP-Oracle CD &
Select F:\NT\i386\setup & click enter
Location of oracle D:\orant & click enter
Accept path change & click enter
Oracle 8 enterprise edition & click enter
(Oracle 8.1.7 will not be supported by SAP Kernel 4.6B)
(Oracle 8.1.7 will be supported by SAP Kernel 4.6C only)
After completion of oracle Stop the service "Oracle TNSlistner 80"
Select F:\NT\i386\Patchs\8.0.5.2.2\setup & click enter
Accept the defaults & complete the installation.
Restart the system.
Dump all the export CDs (6 CDs) into
E:\dump\db1 - export CD 1
E:\dump\db2 - export CD 2
E:\dump\db3 - export CD 3 (To dump type as E:\dump\db1>Xcopy /e f: & enter)
E:\dump\db4 - export CD 4
E:\dump\db5 - export CD 5
E:\dump\db6 - export CD 6
Insert Kernel CD
Select F:\46bker\NT\i386\NTPATCH\R3dllins & click enter
This will install patch for NT.
Restart the system.
Logon as TEKADM
From kernel CD
F:\NT\common\r3setup & enter
Enter the following
System Name - TEK (must be 3 Letters Capital)
Location - C:\users\Tekadm\install (it comes by default)
Accept to restart the machine.
Logon on as TEKADM
Copy the file "db_ides.r3s" from DB1\IDES\NT\ORA\DB_IDES.R3S
(18KB files size) to C:\users\tekadm\install
Start r3setup from
C:\users\tekadm\install\r3setup & enter
Select "central.r3s" file & enter
& Follow as mentioned bellow
System Name - TEK
Instance no. - 00
Accept Defaults
Directory of SAP system -change to D:
RAM of the sys. - Accept the default
Location of the KERNEL CD - F:
Port no. - 3600
Enter the password of TEKADM two times
Enter the password of SAPServiceTEK two times
Start the installation.
This will come upto
Select C:\users\tekadm\install\r3setup & enter
Select "db_ides.r3s" & enter
System Name - TEK
Instance no. - 00
Accept Defaults
Select WE8DEC (default for r/3 4.x system) & enter
Oracle dir. - D:
Location of SAP Database specific files
SAP Database Drive
SAPARCH D
SAPBACKUP D
SAPCHECK D
SAPREORG D
SAPTRACE D & enter
Location of Oracle Data files
Oracle Data directory drive
SAPDATA1 D
SAPDATA2 D
SAPDATA3 D
SAPDATA4 D
SAPDATA5 D
SAPDATA6 D & enter
Location Database LOG files
Dir. for LOG files Drive
ORIGLOGA D
ORIGLOGB D & enter
Location Mirrored Database LOG files
(Change from D to C)
Dir. for LOG files Drive
MIRRLOGA C
MIRRLOGB C & enter
Accept the default RAM & enter
Location of export CDs dump
CD name Location Copy destination
KERNEL F:\46bker
EXPORT1 E:\dump\db1\1
EXPORT2 E:\dump\db2\2
EXPORT3 E:\dump\db3\3
EXPORT4 E:\dump\db4\4 (Clear this field)
EXPORT5 E:\dump\db5\5
EXPORT6 E:\dump\db6\6 & enter
Enter the Password of TEKADM
No. of parallel process - 1
Start installation.
Wait for 14 to 15 Hrs & installation will come Upto 91% & will ask for SAPr3 password.
Enter the password of TEKADM & enter
This will come upto 95%
Open SAP Management Console from desktop & Right click "TEK" & start the service.
Wait for the service to start & will change from yellow to green.
Come to the r3setup screen & click next.
This will bring upto 100% & the installation is over.
Exit the r3setup & stop the "TEK"service & Restart the system.
POST INSTALLATION TASKS
After SAP installation, install SAPGUI in the server. (CD 9)
Restart the system
Open SAP Management Console & start the sap service.
Start the Sap Frontend from the start\programs\sap frontend\sapsrv.
Logon as
Client 000
User name DDIC
Password 19920706
Language en
* Note : Clear this field
This means if you already have the CD's copied on the the harddrive you don't need to copy them again.. CD Title------CD Location-----------CD copy to this location
kernel--------Dump location1-------clear , don't re copy
cd1-----------Dump2--------- -------clear, this field
cd2-----------........3-----------------clear
cd3-----------.........4----------------clear
Procedure for installation on W2k server with sp3.
Installation Of SAP 4.6b
System Requirements.
P-III System
1024 MB or 512 MB RAM
Minimum 60GB HDD
40 GB Hdd (2GB for WinNT & 38 GB for oracle & SAP)
10 GB Hdd for CD dumps.
CDROM drive.
Network Card
C:\ - 10GB - Windows 2000 Server - NTFS
D:\ - 40GB - Oracle & SAP - NTFS
E:\ - 10GB - CD Dumps - NTFS
F:\ - CDROM Drive
Install Windows 2000 server in first 10GB partition
Computer Name - SAPSRV
IP Address - 192.168.1.2
Subnet Mask - 255.255.255.0
Work Group - TEKSOFT
Complete the installation & Restart.
Install Service Pack 3
Install All the Drivers
Install IE6 SP1
Create two Users as mentioned bellow
Start -> Programs -> Administrative Tools -> Computer Management -> Local Users
and Groups -> Users -> New User
a. First user name TEKADM
Give password, disable the already enabled option & enable
"Password Never Expires & user cannot change the password option "
b. Second user name SAPServiceTEK
Give password, disable the already enabled option & enable
"Password Never Expires & user cannot change the password option "
Add the two Users to Administrators Group
Change hostfile
Open C:\Winnt\System32\driver\ect\host file in Notepad & add IP Address and Computer Name in
The bottom of file. Save & Exit.
Change the Virtual Memory
C: Min - 512MB
Max - 1024MB
D: Min - 2048MB
Max - 2560MB
Change the File and Printer sharing properties to “ Maximize through
Logon as TEKADM
Insert SAP-Oracle CD &
Select F:\NT\i386\setup & click enter
Location of oracle D:\orant & click enter
Accept path change & click enter
Oracle 8 enterprise edition & click enter
(Oracle 8.1.7 will not be supported by SAP Kernel 4.6B)
(Oracle 8.1.7 will be supported by SAP Kernel 4.6C only)
After completion of oracle Stop the service "Oracle TNSlistner 80"
Select F:\NT\i386\Patchs\8.0.5.2.2\setup & click enter
Accept the defaults & complete the installation.
Restart the system.
Dump all the export CDs (6 CDs) into
E:\dump\db1 - export CD 1
E:\dump\db2 - export CD 2
E:\dump\db3 - export CD 3 (To dump type as E:\dump\db1>Xcopy /e f: & enter)
E:\dump\db4 - export CD 4
E:\dump\db5 - export CD 5
E:\dump\db6 - export CD 6
Insert Kernel CD
Select F:\46bker\NT\i386\NTPATCH\R3dllins & click enter
This will install patch for NT.
Restart the system.
Logon as TEKADM
From kernel CD
F:\NT\common\r3setup & enter
Enter the following
System Name - TEK (must be 3 Letters Capital)
Location - C:\users\Tekadm\install (it comes by default)
Accept to restart the machine.
Logon on as TEKADM
Copy the file "db_ides.r3s" from DB1\IDES\NT\ORA\DB_IDES.R3S
(18KB files size) to C:\users\tekadm\install
Start r3setup from
C:\users\tekadm\install\r3setup & enter
Select "central.r3s" file & enter
& Follow as mentioned bellow
System Name - TEK
Instance no. - 00
Accept Defaults
Directory of SAP system -change to D:
RAM of the sys. - Accept the default
Location of the KERNEL CD - F:
Port no. - 3600
Enter the password of TEKADM two times
Enter the password of SAPServiceTEK two times
Start the installation.
This will come upto
Select C:\users\tekadm\install\r3setup & enter
Select "db_ides.r3s" & enter
System Name - TEK
Instance no. - 00
Accept Defaults
Select WE8DEC (default for r/3 4.x system) & enter
Oracle dir. - D:
Location of SAP Database specific files
SAP Database Drive
SAPARCH D
SAPBACKUP D
SAPCHECK D
SAPREORG D
SAPTRACE D & enter
Location of Oracle Data files
Oracle Data directory drive
SAPDATA1 D
SAPDATA2 D
SAPDATA3 D
SAPDATA4 D
SAPDATA5 D
SAPDATA6 D & enter
Location Database LOG files
Dir. for LOG files Drive
ORIGLOGA D
ORIGLOGB D & enter
Location Mirrored Database LOG files
(Change from D to C)
Dir. for LOG files Drive
MIRRLOGA C
MIRRLOGB C & enter
Accept the default RAM & enter
Location of export CDs dump
CD name Location Copy destination
KERNEL F:\46bker
EXPORT1 E:\dump\db1\1
EXPORT2 E:\dump\db2\2
EXPORT3 E:\dump\db3\3
EXPORT4 E:\dump\db4\4 (Clear this field)
EXPORT5 E:\dump\db5\5
EXPORT6 E:\dump\db6\6 & enter
Enter the Password of TEKADM
No. of parallel process - 1
Start installation.
Wait for 14 to 15 Hrs & installation will come Upto 91% & will ask for SAPr3 password.
Enter the password of TEKADM & enter
This will come upto 95%
Open SAP Management Console from desktop & Right click "TEK" & start the service.
Wait for the service to start & will change from yellow to green.
Come to the r3setup screen & click next.
This will bring upto 100% & the installation is over.
Exit the r3setup & stop the "TEK"service & Restart the system.
POST INSTALLATION TASKS
After SAP installation, install SAPGUI in the server. (CD 9)
Restart the system
Open SAP Management Console & start the sap service.
Start the Sap Frontend from the start\programs\sap frontend\sapsrv.
Logon as
Client 000
User name DDIC
Password 19920706
Language en
* Note : Clear this field
This means if you already have the CD's copied on the the harddrive you don't need to copy them again.. CD Title------CD Location-----------CD copy to this location
kernel--------Dump location1-------clear , don't re copy
cd1-----------Dump2--------- -------clear, this field
cd2-----------........3-----------------clear
cd3-----------.........4----------------clear
Friday, March 22, 2013
BDC Example
**********************************************************************
* TRITH AGRO *
**********************************************************************
* Object Name: ZFI_BDCX_IA05 *
* Description: Task List Creation using BDC *
* Tech. Consultant: Binay Biswakarma *
* Func. Consultant: Anish Ahya *
* Date : 08.09.2011 *
* Initial TR number: DEVK900584 *
**********************************************************************
* Change TR number Change by Change date *
* *
* *
**********************************************************************
REPORT zfi_bdcx_ia05 MESSAGE-ID 8i.
*---Header File Structure
DATA: BEGIN OF ihead OCCURS 0,
comno TYPE i, "Reference / Common Key for Header File & Item File (Internal Use)
plnnr LIKE plpo-plnnr, "Group No
ktext LIKE plkod-ktext, "Task list description
sttag LIKE rc271-sttag, "Key Date
arbpl LIKE rcr01-arbpl, "Work Center
werks LIKE t001w-werks, "Plant
verwe LIKE plkod-verwe, "Usage
statu LIKE plkod-statu, "Status
strat LIKE plkod-strat, "Management Strategy
vfrdt LIKE rc271-sttag, "Valid from Date
anlzu LIKE plkod-anlzu, " Syst.Condition
END OF ihead.
*---Item File Structure
DATA: BEGIN OF iitem OCCURS 0,
comno TYPE i, "Reference / Common Key for Header File & Item File (Internal Use)
ltxa1(100) TYPE c, "Opration Description (Maximum 100 Character)
arbei LIKE plpod-arbei, "Amount of work involved in performing the activity.
arbeh LIKE plpod-arbeh, "Unit for work.
anzzl LIKE plpod-anzzl, "Number of capacities required
dauno LIKE plpod-dauno, "Normal duration of the activity
daune LIKE plpod-daune, "Normal duration/unit
kzyk1 LIKE riewp-kzyk1, "Short text for the maintenance cycle (time/performance)
larnt LIKE plpod-larnt, "Activity Type
END OF iitem.
DATA ifile LIKE iitem OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF imess OCCURS 0,
messa(100) TYPE c,
END OF imess.
*---BDC Structure
DATA : bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE,
msg_tab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE,
gv_flag. " External group indicator
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETER: p_mode TYPE ctu_mode AS LISTBOX VISIBLE LENGTH 30 OBLIGATORY DEFAULT 'N'. "BDC Upload Mode
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETER: p_head LIKE rlgrap-filename OBLIGATORY. "Group Header File Name
SELECTION-SCREEN SKIP 1.
PARAMETER: p_item LIKE rlgrap-filename OBLIGATORY. "Group Item File Name
SELECTION-SCREEN END OF BLOCK b2.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_head.
PERFORM file_f4 USING p_head.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_item.
PERFORM file_f4 USING p_item.
START-OF-SELECTION.
PERFORM upload_header_data.
PERFORM upload_item_data.
PERFORM check_validation.
LOOP AT ihead.
PERFORM call_bdc.
ENDLOOP.
IF imess[] IS NOT INITIAL.
PERFORM display_message.
ENDIF.
*&---------------------------------------------------------------------*
*& Form FILE_F4
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM file_f4 USING p_input LIKE rlgrap-filename.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
IMPORTING
file_name = p_input.
ENDFORM. " FILE_F4
*&---------------------------------------------------------------------*
*& Form UPLOAD_HEADER_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM upload_header_data.
DATA p_file TYPE string.
MOVE p_head TO p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = ihead
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " UPLOAD_HEADER_DATA
*&---------------------------------------------------------------------*
*& Form UPLOAD_ITEM_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM upload_item_data.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = p_item
filetype = 'DAT'
TABLES
data_tab = iitem
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " UPLOAD_ITEM_DATA
*&---------------------------------------------------------------------*
*& Form CHECK_VALIDATION
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM check_validation .
TABLES plko.
LOOP AT ihead.
IF ihead-plnnr IS NOT INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = ihead-plnnr
IMPORTING
output = ihead-plnnr.
SELECT SINGLE * FROM plko
WHERE plnty EQ 'A'
AND plnnr EQ ihead-plnnr.
IF sy-subrc NE 0.
* MESSAGE i000 WITH 'Task List Group ' ihead-plnnr ' Does not Exist'.
* STOP.
gv_flag = 'X'.
ELSE.
SELECT SINGLE datuv FROM plko
INTO ihead-vfrdt
WHERE plnty EQ 'A'
AND plnnr EQ ihead-plnnr
AND datuv LE ihead-sttag.
IF sy-subrc EQ 0.
MODIFY ihead TRANSPORTING vfrdt.
ENDIF.
ENDIF.
ELSEIF ihead-ktext IS INITIAL.
MESSAGE e000 WITH 'Please enter Task list description'.
ELSEIF ihead-sttag IS INITIAL.
MESSAGE e000 WITH 'Please enter Key Date'.
ELSEIF ihead-arbpl IS INITIAL.
MESSAGE e000 WITH 'Please enter Work Center'.
ELSEIF ihead-werks IS INITIAL.
MESSAGE e000 WITH 'Please enter Plant'.
ELSEIF ihead-verwe IS INITIAL.
MESSAGE e000 WITH 'Please enter Usage'.
ELSEIF ihead-statu IS INITIAL.
MESSAGE e000 WITH 'Please enter Status'.
ELSEIF ihead-strat IS INITIAL.
MESSAGE e000 WITH 'Please enter Management Strategy'.
ENDIF.
ENDLOOP.
ENDFORM. " CHECK_VALIDATION
*&---------------------------------------------------------------------*
*& Form CALL_BDC
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM call_bdc .
DATA: p_date(10) TYPE c,
p_anzzl(3) TYPE c,
p_arbei(9) TYPE c,
p_dauno(7) TYPE c,
ltxa2(40) TYPE c,
ltxa3(20) TYPE c.
CLEAR : bdcdata,msg_tab,ifile.
REFRESH: bdcdata,msg_tab,ifile.
LOOP AT iitem WHERE comno EQ ihead-comno.
MOVE-CORRESPONDING iitem TO ifile.
APPEND ifile.
ENDLOOP.
WRITE ihead-sttag TO p_date.
PERFORM bdc_dynpro USING 'SAPLCPDI' '3001'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RC271-PLNNR'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_field USING 'RC271-PLNNR' ihead-plnnr.
PERFORM bdc_field USING 'RC271-STTAG' p_date.
IF ihead-plnnr IS NOT INITIAL AND ihead-vfrdt IS NOT INITIAL AND gv_flag IS INITIAL.
PERFORM bdc_dynpro USING 'SAPLCPDI' '3200'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RC270-HEAD2'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ANLG'.
ENDIF.
PERFORM bdc_dynpro USING 'SAPLCPDA' '3010'.
PERFORM bdc_field USING 'BDC_CURSOR' 'PLKOD-STRAT'.
PERFORM bdc_field USING 'BDC_OKCODE' '=VOUE'.
PERFORM bdc_field USING 'PLKOD-KTEXT' ihead-ktext.
PERFORM bdc_field USING 'PLKOD-WERKS' ihead-werks.
PERFORM bdc_field USING 'RCR01-ARBPL' ihead-arbpl.
PERFORM bdc_field USING 'PLKOD-VERWE' ihead-verwe.
PERFORM bdc_field USING 'PLKOD-STATU' ihead-statu.
PERFORM bdc_field USING 'PLKOD-STRAT' ihead-strat.
* Field Addition
PERFORM bdc_field USING 'PLKOD-ANLZU' ihead-anlzu.
* End Addition
READ TABLE ifile INDEX 1.
CLEAR: p_dauno,ltxa2,ltxa3,p_anzzl,p_arbei.
WRITE ifile-anzzl TO p_anzzl LEFT-JUSTIFIED.
WRITE ifile-arbei TO p_arbei LEFT-JUSTIFIED.
WRITE ifile-dauno TO p_dauno LEFT-JUSTIFIED.
PERFORM bdc_dynpro USING 'SAPLCPDI' '3400'.
PERFORM bdc_field USING 'BDC_CURSOR' 'PLPOD-LTXA1(01)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=PICK'.
MOVE ifile-ltxa1+40(40) TO ltxa2.
MOVE ifile-ltxa1+80(20) TO ltxa3.
PERFORM bdc_field USING 'PLPOD-LTXA1(01)' ifile-ltxa1(40).
PERFORM bdc_field USING 'PLPOD-ARBEI(01)' p_arbei.
PERFORM bdc_field USING 'PLPOD-ARBEH(01)' ifile-arbeh.
PERFORM bdc_field USING 'PLPOD-ANZZL(01)' p_anzzl.
PERFORM bdc_field USING 'PLPOD-DAUNO(01)' p_dauno.
PERFORM bdc_field USING 'PLPOD-DAUNE(01)' ifile-daune.
* Field Addition
PERFORM bdc_field USING 'PLPOD-LARNT(01)' ifile-larnt.
PERFORM bdc_dynpro USING 'SAPLCPDO' '3370'.
PERFORM bdc_field USING 'BDC_OKCODE' '=LTXT'.
PERFORM bdc_dynpro USING 'SAPLSTXX' '1100'.
PERFORM bdc_field USING 'BDC_OKCODE' '=TXBA'.
PERFORM bdc_field USING 'RSTXT-TXLINE(03)' ltxa2.
PERFORM bdc_field USING 'RSTXT-TXLINE(04)' ltxa3.
PERFORM bdc_dynpro USING 'SAPLCPDO' '3370'.
PERFORM bdc_field USING 'BDC_OKCODE' '=BACK'.
PERFORM bdc_dynpro USING 'SAPLCPDI' '3400'.
PERFORM bdc_field USING 'BDC_CURSOR' 'PLPOD-LTXA1(02)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=P+'.
LOOP AT ifile.
IF sy-tabix EQ 1.
CONTINUE.
ENDIF.
CLEAR: p_dauno,ltxa2,ltxa3,p_anzzl,p_arbei.
WRITE ifile-anzzl TO p_anzzl LEFT-JUSTIFIED.
WRITE ifile-arbei TO p_arbei LEFT-JUSTIFIED.
WRITE ifile-dauno TO p_dauno LEFT-JUSTIFIED.
PERFORM bdc_dynpro USING 'SAPLCPDI' '3400'.
PERFORM bdc_field USING 'BDC_CURSOR' 'PLPOD-LTXA1(02)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=PICK'.
MOVE ifile-ltxa1+40(40) TO ltxa2.
MOVE ifile-ltxa1+80(20) TO ltxa3.
PERFORM bdc_field USING 'PLPOD-LTXA1(02)' ifile-ltxa1(40).
PERFORM bdc_field USING 'PLPOD-ARBEI(02)' p_arbei.
PERFORM bdc_field USING 'PLPOD-ARBEH(02)' ifile-arbeh.
PERFORM bdc_field USING 'PLPOD-ANZZL(02)' p_anzzl.
PERFORM bdc_field USING 'PLPOD-DAUNO(02)' p_dauno.
PERFORM bdc_field USING 'PLPOD-DAUNE(02)' ifile-daune.
* field Addition
PERFORM bdc_field USING 'PLPOD-LARNT(01)' ifile-larnt.
PERFORM bdc_dynpro USING 'SAPLCPDO' '3370'.
PERFORM bdc_field USING 'BDC_OKCODE' '=LTXT'.
PERFORM bdc_dynpro USING 'SAPLSTXX' '1100'.
PERFORM bdc_field USING 'BDC_OKCODE' '=TXBA'.
PERFORM bdc_field USING 'RSTXT-TXLINE(03)' ltxa2.
PERFORM bdc_field USING 'RSTXT-TXLINE(04)' ltxa3.
PERFORM bdc_dynpro USING 'SAPLCPDO' '3370'.
PERFORM bdc_field USING 'BDC_OKCODE' '=BACK'.
PERFORM bdc_dynpro USING 'SAPLCPDI' '3400'.
PERFORM bdc_field USING 'BDC_CURSOR' 'PLPOD-LTXA1(02)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=P+'.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPLCPDI' '3400'.
PERFORM bdc_field USING 'BDC_CURSOR' 'PLPOD-LTXA1(03)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=MAAL'.
PERFORM bdc_dynpro USING 'SAPLCPDI' '3400'.
PERFORM bdc_field USING 'BDC_CURSOR' 'PLPOD-LTXA1(03)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=WPLT'.
PERFORM bdc_dynpro USING 'SAPLCPDI' '3600'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RC270-HEAD2'.
PERFORM bdc_field USING 'BDC_OKCODE' '=IWPZ'.
LOOP AT ifile.
PERFORM bdc_dynpro USING 'SAPLCIDI' '3000'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RIEWP-KZYK1(01)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=NEXT'.
PERFORM bdc_field USING 'RIEWP-KZYK1(01)' ifile-kzyk1.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPLCIDI' '3000'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RIEWP-KZYK1(01)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.
CALL TRANSACTION 'IA05'
USING bdcdata
UPDATE 'A'
MODE p_mode
MESSAGES INTO msg_tab.
IF p_mode NE 'A'.
WAIT UP TO 3 SECONDS.
ENDIF.
READ TABLE msg_tab WITH KEY msgtyp = 'E'.
IF sy-subrc EQ 0.
PERFORM display_messages.
ELSE.
IF ihead-plnnr IS NOT INITIAL.
CLEAR imess.
CONCATENATE 'New Conunter is Created for Group ' ihead-plnnr INTO imess-messa SEPARATED BY space.
APPEND imess.
ELSE.
READ TABLE msg_tab WITH KEY msgtyp = 'S'
msgid = 'CI'
msgnr = '317'.
CLEAR imess.
CONCATENATE 'New Group ' msg_tab-msgv1 ' Created' INTO imess-messa SEPARATED BY space.
APPEND imess.
ENDIF.
ENDIF.
ENDFORM. " CALL_BDC
*&---------------------------------------------------------------------*
*& Form BDC_DYNPRO
*&---------------------------------------------------------------------*
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. " BDC_DYNPRO
*&---------------------------------------------------------------------*
*& Form BDC_FIELD
*&---------------------------------------------------------------------*
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. " BDC_FIELD
*&---------------------------------------------------------------------*
*& Form display_messages
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM display_messages .
DATA msg_str(80).
LOOP AT msg_tab.
AT FIRST.
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
NEW-PAGE LINE-SIZE 100.
ENDAT.
PERFORM get_message_text CHANGING msg_str.
CASE msg_tab-msgtyp.
WHEN 'E' OR 'A'. "Error or Abandend
FORMAT COLOR 6. "Red
WHEN 'W'. "Warning
FORMAT COLOR 3. "Yellow
WHEN 'I'. "Information
FORMAT COLOR 1. "Blue
WHEN 'S'. "Information
FORMAT COLOR 5. "Green
ENDCASE.
WRITE: /(5) msg_tab-msgid ,msg_tab-msgnr, msg_str.
ENDLOOP.
CLEAR: imess,msg_tab. REFRESH: imess,msg_tab.
ENDFORM. " display_messages
*&---------------------------------------------------------------------*
*& Form GET_MESSAGE_TEXT
*&---------------------------------------------------------------------*
FORM get_message_text CHANGING p_msg_str.
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = msg_tab-msgid
msgnr = msg_tab-msgnr
msgv1 = msg_tab-msgv1
msgv2 = msg_tab-msgv2
msgv3 = msg_tab-msgv3
msgv4 = msg_tab-msgv4
IMPORTING
message_text_output = p_msg_str.
ENDFORM. " GET_MESSAGE_TEXT
*&---------------------------------------------------------------------*
*& Form DISPLAY_MESSAGE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM display_message .
LOOP AT imess.
AT FIRST.
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
NEW-PAGE LINE-SIZE 100.
FORMAT COLOR 5.
ENDAT.
WRITE:/ imess-messa.
ENDLOOP.
ENDFORM. " DISPLAY_MESSAGE
*Text elements
*----------------------------------------------------------
* 001 BDC Processing Mode
* 002 File Name
*Selection texts
*----------------------------------------------------------
* P_HEAD Group Header File Name
* P_ITEM Group Item File Name
* P_MODE BDC Processing Mode
*Messages
*----------------------------------------------------------
*
* Message class: ZW
*000 & & & & & &
* TRITH AGRO *
**********************************************************************
* Object Name: ZFI_BDCX_IA05 *
* Description: Task List Creation using BDC *
* Tech. Consultant: Binay Biswakarma *
* Func. Consultant: Anish Ahya *
* Date : 08.09.2011 *
* Initial TR number: DEVK900584 *
**********************************************************************
* Change TR number Change by Change date *
* *
* *
**********************************************************************
REPORT zfi_bdcx_ia05 MESSAGE-ID 8i.
*---Header File Structure
DATA: BEGIN OF ihead OCCURS 0,
comno TYPE i, "Reference / Common Key for Header File & Item File (Internal Use)
plnnr LIKE plpo-plnnr, "Group No
ktext LIKE plkod-ktext, "Task list description
sttag LIKE rc271-sttag, "Key Date
arbpl LIKE rcr01-arbpl, "Work Center
werks LIKE t001w-werks, "Plant
verwe LIKE plkod-verwe, "Usage
statu LIKE plkod-statu, "Status
strat LIKE plkod-strat, "Management Strategy
vfrdt LIKE rc271-sttag, "Valid from Date
anlzu LIKE plkod-anlzu, " Syst.Condition
END OF ihead.
*---Item File Structure
DATA: BEGIN OF iitem OCCURS 0,
comno TYPE i, "Reference / Common Key for Header File & Item File (Internal Use)
ltxa1(100) TYPE c, "Opration Description (Maximum 100 Character)
arbei LIKE plpod-arbei, "Amount of work involved in performing the activity.
arbeh LIKE plpod-arbeh, "Unit for work.
anzzl LIKE plpod-anzzl, "Number of capacities required
dauno LIKE plpod-dauno, "Normal duration of the activity
daune LIKE plpod-daune, "Normal duration/unit
kzyk1 LIKE riewp-kzyk1, "Short text for the maintenance cycle (time/performance)
larnt LIKE plpod-larnt, "Activity Type
END OF iitem.
DATA ifile LIKE iitem OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF imess OCCURS 0,
messa(100) TYPE c,
END OF imess.
*---BDC Structure
DATA : bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE,
msg_tab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE,
gv_flag. " External group indicator
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETER: p_mode TYPE ctu_mode AS LISTBOX VISIBLE LENGTH 30 OBLIGATORY DEFAULT 'N'. "BDC Upload Mode
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
PARAMETER: p_head LIKE rlgrap-filename OBLIGATORY. "Group Header File Name
SELECTION-SCREEN SKIP 1.
PARAMETER: p_item LIKE rlgrap-filename OBLIGATORY. "Group Item File Name
SELECTION-SCREEN END OF BLOCK b2.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_head.
PERFORM file_f4 USING p_head.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_item.
PERFORM file_f4 USING p_item.
START-OF-SELECTION.
PERFORM upload_header_data.
PERFORM upload_item_data.
PERFORM check_validation.
LOOP AT ihead.
PERFORM call_bdc.
ENDLOOP.
IF imess[] IS NOT INITIAL.
PERFORM display_message.
ENDIF.
*&---------------------------------------------------------------------*
*& Form FILE_F4
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM file_f4 USING p_input LIKE rlgrap-filename.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
field_name = ' '
IMPORTING
file_name = p_input.
ENDFORM. " FILE_F4
*&---------------------------------------------------------------------*
*& Form UPLOAD_HEADER_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM upload_header_data.
DATA p_file TYPE string.
MOVE p_head TO p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = p_file
filetype = 'DAT'
TABLES
data_tab = ihead
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " UPLOAD_HEADER_DATA
*&---------------------------------------------------------------------*
*& Form UPLOAD_ITEM_DATA
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM upload_item_data.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = p_item
filetype = 'DAT'
TABLES
data_tab = iitem
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE 'I' NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " UPLOAD_ITEM_DATA
*&---------------------------------------------------------------------*
*& Form CHECK_VALIDATION
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM check_validation .
TABLES plko.
LOOP AT ihead.
IF ihead-plnnr IS NOT INITIAL.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = ihead-plnnr
IMPORTING
output = ihead-plnnr.
SELECT SINGLE * FROM plko
WHERE plnty EQ 'A'
AND plnnr EQ ihead-plnnr.
IF sy-subrc NE 0.
* MESSAGE i000 WITH 'Task List Group ' ihead-plnnr ' Does not Exist'.
* STOP.
gv_flag = 'X'.
ELSE.
SELECT SINGLE datuv FROM plko
INTO ihead-vfrdt
WHERE plnty EQ 'A'
AND plnnr EQ ihead-plnnr
AND datuv LE ihead-sttag.
IF sy-subrc EQ 0.
MODIFY ihead TRANSPORTING vfrdt.
ENDIF.
ENDIF.
ELSEIF ihead-ktext IS INITIAL.
MESSAGE e000 WITH 'Please enter Task list description'.
ELSEIF ihead-sttag IS INITIAL.
MESSAGE e000 WITH 'Please enter Key Date'.
ELSEIF ihead-arbpl IS INITIAL.
MESSAGE e000 WITH 'Please enter Work Center'.
ELSEIF ihead-werks IS INITIAL.
MESSAGE e000 WITH 'Please enter Plant'.
ELSEIF ihead-verwe IS INITIAL.
MESSAGE e000 WITH 'Please enter Usage'.
ELSEIF ihead-statu IS INITIAL.
MESSAGE e000 WITH 'Please enter Status'.
ELSEIF ihead-strat IS INITIAL.
MESSAGE e000 WITH 'Please enter Management Strategy'.
ENDIF.
ENDLOOP.
ENDFORM. " CHECK_VALIDATION
*&---------------------------------------------------------------------*
*& Form CALL_BDC
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM call_bdc .
DATA: p_date(10) TYPE c,
p_anzzl(3) TYPE c,
p_arbei(9) TYPE c,
p_dauno(7) TYPE c,
ltxa2(40) TYPE c,
ltxa3(20) TYPE c.
CLEAR : bdcdata,msg_tab,ifile.
REFRESH: bdcdata,msg_tab,ifile.
LOOP AT iitem WHERE comno EQ ihead-comno.
MOVE-CORRESPONDING iitem TO ifile.
APPEND ifile.
ENDLOOP.
WRITE ihead-sttag TO p_date.
PERFORM bdc_dynpro USING 'SAPLCPDI' '3001'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RC271-PLNNR'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_field USING 'RC271-PLNNR' ihead-plnnr.
PERFORM bdc_field USING 'RC271-STTAG' p_date.
IF ihead-plnnr IS NOT INITIAL AND ihead-vfrdt IS NOT INITIAL AND gv_flag IS INITIAL.
PERFORM bdc_dynpro USING 'SAPLCPDI' '3200'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RC270-HEAD2'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ANLG'.
ENDIF.
PERFORM bdc_dynpro USING 'SAPLCPDA' '3010'.
PERFORM bdc_field USING 'BDC_CURSOR' 'PLKOD-STRAT'.
PERFORM bdc_field USING 'BDC_OKCODE' '=VOUE'.
PERFORM bdc_field USING 'PLKOD-KTEXT' ihead-ktext.
PERFORM bdc_field USING 'PLKOD-WERKS' ihead-werks.
PERFORM bdc_field USING 'RCR01-ARBPL' ihead-arbpl.
PERFORM bdc_field USING 'PLKOD-VERWE' ihead-verwe.
PERFORM bdc_field USING 'PLKOD-STATU' ihead-statu.
PERFORM bdc_field USING 'PLKOD-STRAT' ihead-strat.
* Field Addition
PERFORM bdc_field USING 'PLKOD-ANLZU' ihead-anlzu.
* End Addition
READ TABLE ifile INDEX 1.
CLEAR: p_dauno,ltxa2,ltxa3,p_anzzl,p_arbei.
WRITE ifile-anzzl TO p_anzzl LEFT-JUSTIFIED.
WRITE ifile-arbei TO p_arbei LEFT-JUSTIFIED.
WRITE ifile-dauno TO p_dauno LEFT-JUSTIFIED.
PERFORM bdc_dynpro USING 'SAPLCPDI' '3400'.
PERFORM bdc_field USING 'BDC_CURSOR' 'PLPOD-LTXA1(01)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=PICK'.
MOVE ifile-ltxa1+40(40) TO ltxa2.
MOVE ifile-ltxa1+80(20) TO ltxa3.
PERFORM bdc_field USING 'PLPOD-LTXA1(01)' ifile-ltxa1(40).
PERFORM bdc_field USING 'PLPOD-ARBEI(01)' p_arbei.
PERFORM bdc_field USING 'PLPOD-ARBEH(01)' ifile-arbeh.
PERFORM bdc_field USING 'PLPOD-ANZZL(01)' p_anzzl.
PERFORM bdc_field USING 'PLPOD-DAUNO(01)' p_dauno.
PERFORM bdc_field USING 'PLPOD-DAUNE(01)' ifile-daune.
* Field Addition
PERFORM bdc_field USING 'PLPOD-LARNT(01)' ifile-larnt.
PERFORM bdc_dynpro USING 'SAPLCPDO' '3370'.
PERFORM bdc_field USING 'BDC_OKCODE' '=LTXT'.
PERFORM bdc_dynpro USING 'SAPLSTXX' '1100'.
PERFORM bdc_field USING 'BDC_OKCODE' '=TXBA'.
PERFORM bdc_field USING 'RSTXT-TXLINE(03)' ltxa2.
PERFORM bdc_field USING 'RSTXT-TXLINE(04)' ltxa3.
PERFORM bdc_dynpro USING 'SAPLCPDO' '3370'.
PERFORM bdc_field USING 'BDC_OKCODE' '=BACK'.
PERFORM bdc_dynpro USING 'SAPLCPDI' '3400'.
PERFORM bdc_field USING 'BDC_CURSOR' 'PLPOD-LTXA1(02)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=P+'.
LOOP AT ifile.
IF sy-tabix EQ 1.
CONTINUE.
ENDIF.
CLEAR: p_dauno,ltxa2,ltxa3,p_anzzl,p_arbei.
WRITE ifile-anzzl TO p_anzzl LEFT-JUSTIFIED.
WRITE ifile-arbei TO p_arbei LEFT-JUSTIFIED.
WRITE ifile-dauno TO p_dauno LEFT-JUSTIFIED.
PERFORM bdc_dynpro USING 'SAPLCPDI' '3400'.
PERFORM bdc_field USING 'BDC_CURSOR' 'PLPOD-LTXA1(02)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=PICK'.
MOVE ifile-ltxa1+40(40) TO ltxa2.
MOVE ifile-ltxa1+80(20) TO ltxa3.
PERFORM bdc_field USING 'PLPOD-LTXA1(02)' ifile-ltxa1(40).
PERFORM bdc_field USING 'PLPOD-ARBEI(02)' p_arbei.
PERFORM bdc_field USING 'PLPOD-ARBEH(02)' ifile-arbeh.
PERFORM bdc_field USING 'PLPOD-ANZZL(02)' p_anzzl.
PERFORM bdc_field USING 'PLPOD-DAUNO(02)' p_dauno.
PERFORM bdc_field USING 'PLPOD-DAUNE(02)' ifile-daune.
* field Addition
PERFORM bdc_field USING 'PLPOD-LARNT(01)' ifile-larnt.
PERFORM bdc_dynpro USING 'SAPLCPDO' '3370'.
PERFORM bdc_field USING 'BDC_OKCODE' '=LTXT'.
PERFORM bdc_dynpro USING 'SAPLSTXX' '1100'.
PERFORM bdc_field USING 'BDC_OKCODE' '=TXBA'.
PERFORM bdc_field USING 'RSTXT-TXLINE(03)' ltxa2.
PERFORM bdc_field USING 'RSTXT-TXLINE(04)' ltxa3.
PERFORM bdc_dynpro USING 'SAPLCPDO' '3370'.
PERFORM bdc_field USING 'BDC_OKCODE' '=BACK'.
PERFORM bdc_dynpro USING 'SAPLCPDI' '3400'.
PERFORM bdc_field USING 'BDC_CURSOR' 'PLPOD-LTXA1(02)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=P+'.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPLCPDI' '3400'.
PERFORM bdc_field USING 'BDC_CURSOR' 'PLPOD-LTXA1(03)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=MAAL'.
PERFORM bdc_dynpro USING 'SAPLCPDI' '3400'.
PERFORM bdc_field USING 'BDC_CURSOR' 'PLPOD-LTXA1(03)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=WPLT'.
PERFORM bdc_dynpro USING 'SAPLCPDI' '3600'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RC270-HEAD2'.
PERFORM bdc_field USING 'BDC_OKCODE' '=IWPZ'.
LOOP AT ifile.
PERFORM bdc_dynpro USING 'SAPLCIDI' '3000'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RIEWP-KZYK1(01)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=NEXT'.
PERFORM bdc_field USING 'RIEWP-KZYK1(01)' ifile-kzyk1.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPLCIDI' '3000'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RIEWP-KZYK1(01)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.
CALL TRANSACTION 'IA05'
USING bdcdata
UPDATE 'A'
MODE p_mode
MESSAGES INTO msg_tab.
IF p_mode NE 'A'.
WAIT UP TO 3 SECONDS.
ENDIF.
READ TABLE msg_tab WITH KEY msgtyp = 'E'.
IF sy-subrc EQ 0.
PERFORM display_messages.
ELSE.
IF ihead-plnnr IS NOT INITIAL.
CLEAR imess.
CONCATENATE 'New Conunter is Created for Group ' ihead-plnnr INTO imess-messa SEPARATED BY space.
APPEND imess.
ELSE.
READ TABLE msg_tab WITH KEY msgtyp = 'S'
msgid = 'CI'
msgnr = '317'.
CLEAR imess.
CONCATENATE 'New Group ' msg_tab-msgv1 ' Created' INTO imess-messa SEPARATED BY space.
APPEND imess.
ENDIF.
ENDIF.
ENDFORM. " CALL_BDC
*&---------------------------------------------------------------------*
*& Form BDC_DYNPRO
*&---------------------------------------------------------------------*
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. " BDC_DYNPRO
*&---------------------------------------------------------------------*
*& Form BDC_FIELD
*&---------------------------------------------------------------------*
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. " BDC_FIELD
*&---------------------------------------------------------------------*
*& Form display_messages
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM display_messages .
DATA msg_str(80).
LOOP AT msg_tab.
AT FIRST.
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
NEW-PAGE LINE-SIZE 100.
ENDAT.
PERFORM get_message_text CHANGING msg_str.
CASE msg_tab-msgtyp.
WHEN 'E' OR 'A'. "Error or Abandend
FORMAT COLOR 6. "Red
WHEN 'W'. "Warning
FORMAT COLOR 3. "Yellow
WHEN 'I'. "Information
FORMAT COLOR 1. "Blue
WHEN 'S'. "Information
FORMAT COLOR 5. "Green
ENDCASE.
WRITE: /(5) msg_tab-msgid ,msg_tab-msgnr, msg_str.
ENDLOOP.
CLEAR: imess,msg_tab. REFRESH: imess,msg_tab.
ENDFORM. " display_messages
*&---------------------------------------------------------------------*
*& Form GET_MESSAGE_TEXT
*&---------------------------------------------------------------------*
FORM get_message_text CHANGING p_msg_str.
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = msg_tab-msgid
msgnr = msg_tab-msgnr
msgv1 = msg_tab-msgv1
msgv2 = msg_tab-msgv2
msgv3 = msg_tab-msgv3
msgv4 = msg_tab-msgv4
IMPORTING
message_text_output = p_msg_str.
ENDFORM. " GET_MESSAGE_TEXT
*&---------------------------------------------------------------------*
*& Form DISPLAY_MESSAGE
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM display_message .
LOOP AT imess.
AT FIRST.
LEAVE TO LIST-PROCESSING AND RETURN TO SCREEN 0.
NEW-PAGE LINE-SIZE 100.
FORMAT COLOR 5.
ENDAT.
WRITE:/ imess-messa.
ENDLOOP.
ENDFORM. " DISPLAY_MESSAGE
*Text elements
*----------------------------------------------------------
* 001 BDC Processing Mode
* 002 File Name
*Selection texts
*----------------------------------------------------------
* P_HEAD Group Header File Name
* P_ITEM Group Item File Name
* P_MODE BDC Processing Mode
*Messages
*----------------------------------------------------------
*
* Message class: ZW
*000 & & & & & &
Subscribe to:
Posts (Atom)