Estimado,
navegando por los foros me encontré con alguien que necesitaba eliminar programas z de una lista que tenia, aquí les dejo el codigo que elimina programas y sus includs.
REPORT y_eliminar_programas MESSAGE-ID 00.
TABLES:d010inc,tadir.
TYPES: BEGIN OF t_abapcode,
row(72) TYPE c,
END OF t_abapcode.
DATA: gtd_d010inc TYPE STANDARD TABLE OF d010inc,
gv_ctu_params TYPE ctu_params,
gtd_bdcdata TYPE STANDARD TABLE OF bdcdata,
gwa_bdcdata LIKE LINE OF gtd_bdcdata.
*&--------------------------------------------------------------------&*
*& S E L E C T I O N - S C R E E N &*
*&-------------------by: Luis Farro-----------------------------------&*
SELECTION-SCREEN : BEGIN OF BLOCK b_00 WITH FRAME TITLE text-t00.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(23) pro.
SELECT-OPTIONS: s_prog FOR d010inc-master.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(36) inc.
PARAMETERS: p_chk AS CHECKBOX USER-COMMAND chk.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN : END OF BLOCK b_00.
*&--------------------------------------------------------------------&*
*& I N I T I A L I Z A T I O N &*
*&----------------------by: LuisFarro---------------------------------&*
INITIALIZATION.
pro = 'Nombre del Programa'.
inc = 'Borrar Includs'.
*&--------------------------------------------------------------------&*
*& S T A R T - O F - S E L E C T I O N &*
*&-----------------------by: LuisFarro--------------------------------&*
START-OF-SELECTION.
SELECT *
INTO TABLE gtd_d010inc
FROM d010inc
WHERE master IN s_prog
AND ( include LIKE 'Z%'
OR include LIKE 'Y%' ).
FIELD-SYMBOLS: <fs_d010inc> LIKE LINE OF gtd_d010inc.
CLEAR gv_ctu_params.
gv_ctu_params-updmode = 'S'.
gv_ctu_params-defsize = 'X'.
gv_ctu_params-dismode = 'A'.
LOOP AT gtd_d010inc ASSIGNING <fs_d010inc>.
ON CHANGE OF <fs_d010inc>-master.
PERFORM bdc_dynpro USING 'SAPLWBABAP' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RS38M-PROGRAMM'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=DELP'.
PERFORM bdc_field USING 'RS38M-PROGRAMM'
<fs_d010inc>-master.
PERFORM bdc_field USING 'RS38M-FUNC_EDIT'
'X'.
PERFORM bdc_dynpro USING 'SAPLSEU2' '0201'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
PERFORM bdc_field USING 'BDC_CURSOR'
'WITH_INCLUDES_GLOBAL'.
PERFORM bdc_dynpro USING 'SAPLWBABAP' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RS38M-PROGRAMM'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
PERFORM bdc_field USING 'RS38M-PROGRAMM'
<fs_d010inc>-master.
PERFORM bdc_field USING 'RS38M-FUNC_EDIT'
'X'.
CALL TRANSACTION 'SE38' USING gtd_bdcdata
OPTIONS FROM gv_ctu_params.
FREE gtd_bdcdata.
ENDON.
IF p_chk EQ 'X'.
PERFORM bdc_dynpro USING 'SAPLWBABAP' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RS38M-PROGRAMM'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=DELP'.
PERFORM bdc_field USING 'RS38M-PROGRAMM'
<fs_d010inc>-include.
PERFORM bdc_field USING 'RS38M-FUNC_EDIT'
'X'.
PERFORM bdc_dynpro USING 'SAPLSPO1' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=YES'.
PERFORM bdc_dynpro USING 'SAPLWBABAP' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RS38M-PROGRAMM'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
PERFORM bdc_field USING 'RS38M-PROGRAMM'
<fs_d010inc>-include.
PERFORM bdc_field USING 'RS38M-FUNC_EDIT'
'X'.
CALL TRANSACTION 'SE38' USING gtd_bdcdata
OPTIONS FROM gv_ctu_params.
FREE gtd_bdcdata.
ENDIF.
ENDLOOP.
*&---------------------------------------------------------------------*
*& Form bdc_dynpro
*&---------------------------------------------------------------------*
* text BY LuisFarro
*----------------------------------------------------------------------*
* -->PROGRAM text
* -->DYNPRO text
*----------------------------------------------------------------------*
FORM bdc_dynpro USING program TYPE any
dynpro TYPE any.
CLEAR gwa_bdcdata.
gwa_bdcdata-program = program.
gwa_bdcdata-dynpro = dynpro.
gwa_bdcdata-dynbegin = 'X'.
APPEND gwa_bdcdata TO gtd_bdcdata.
ENDFORM. " bdc_dynpro
*&---------------------------------------------------------------------*
*& Form bdc_field BY LuisFarro
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->FNAM text
* -->FVAL text
*----------------------------------------------------------------------*
FORM bdc_field USING fnam TYPE any
fval TYPE any.
IF fval <> space.
CLEAR gwa_bdcdata.
gwa_bdcdata-fnam = fnam.
gwa_bdcdata-fval = fval.
APPEND gwa_bdcdata TO gtd_bdcdata.
ENDIF.
ENDFORM. " bdc_field
saludos,
Luis Farro
************************************************** *****************
programar es una cosa de niños
navegando por los foros me encontré con alguien que necesitaba eliminar programas z de una lista que tenia, aquí les dejo el codigo que elimina programas y sus includs.
REPORT y_eliminar_programas MESSAGE-ID 00.
TABLES:d010inc,tadir.
TYPES: BEGIN OF t_abapcode,
row(72) TYPE c,
END OF t_abapcode.
DATA: gtd_d010inc TYPE STANDARD TABLE OF d010inc,
gv_ctu_params TYPE ctu_params,
gtd_bdcdata TYPE STANDARD TABLE OF bdcdata,
gwa_bdcdata LIKE LINE OF gtd_bdcdata.
*&--------------------------------------------------------------------&*
*& S E L E C T I O N - S C R E E N &*
*&-------------------by: Luis Farro-----------------------------------&*
SELECTION-SCREEN : BEGIN OF BLOCK b_00 WITH FRAME TITLE text-t00.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(23) pro.
SELECT-OPTIONS: s_prog FOR d010inc-master.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 5(36) inc.
PARAMETERS: p_chk AS CHECKBOX USER-COMMAND chk.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN : END OF BLOCK b_00.
*&--------------------------------------------------------------------&*
*& I N I T I A L I Z A T I O N &*
*&----------------------by: LuisFarro---------------------------------&*
INITIALIZATION.
pro = 'Nombre del Programa'.
inc = 'Borrar Includs'.
*&--------------------------------------------------------------------&*
*& S T A R T - O F - S E L E C T I O N &*
*&-----------------------by: LuisFarro--------------------------------&*
START-OF-SELECTION.
SELECT *
INTO TABLE gtd_d010inc
FROM d010inc
WHERE master IN s_prog
AND ( include LIKE 'Z%'
OR include LIKE 'Y%' ).
FIELD-SYMBOLS: <fs_d010inc> LIKE LINE OF gtd_d010inc.
CLEAR gv_ctu_params.
gv_ctu_params-updmode = 'S'.
gv_ctu_params-defsize = 'X'.
gv_ctu_params-dismode = 'A'.
LOOP AT gtd_d010inc ASSIGNING <fs_d010inc>.
ON CHANGE OF <fs_d010inc>-master.
PERFORM bdc_dynpro USING 'SAPLWBABAP' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RS38M-PROGRAMM'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=DELP'.
PERFORM bdc_field USING 'RS38M-PROGRAMM'
<fs_d010inc>-master.
PERFORM bdc_field USING 'RS38M-FUNC_EDIT'
'X'.
PERFORM bdc_dynpro USING 'SAPLSEU2' '0201'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
PERFORM bdc_field USING 'BDC_CURSOR'
'WITH_INCLUDES_GLOBAL'.
PERFORM bdc_dynpro USING 'SAPLWBABAP' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RS38M-PROGRAMM'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
PERFORM bdc_field USING 'RS38M-PROGRAMM'
<fs_d010inc>-master.
PERFORM bdc_field USING 'RS38M-FUNC_EDIT'
'X'.
CALL TRANSACTION 'SE38' USING gtd_bdcdata
OPTIONS FROM gv_ctu_params.
FREE gtd_bdcdata.
ENDON.
IF p_chk EQ 'X'.
PERFORM bdc_dynpro USING 'SAPLWBABAP' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RS38M-PROGRAMM'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=DELP'.
PERFORM bdc_field USING 'RS38M-PROGRAMM'
<fs_d010inc>-include.
PERFORM bdc_field USING 'RS38M-FUNC_EDIT'
'X'.
PERFORM bdc_dynpro USING 'SAPLSPO1' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=YES'.
PERFORM bdc_dynpro USING 'SAPLWBABAP' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RS38M-PROGRAMM'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
PERFORM bdc_field USING 'RS38M-PROGRAMM'
<fs_d010inc>-include.
PERFORM bdc_field USING 'RS38M-FUNC_EDIT'
'X'.
CALL TRANSACTION 'SE38' USING gtd_bdcdata
OPTIONS FROM gv_ctu_params.
FREE gtd_bdcdata.
ENDIF.
ENDLOOP.
*&---------------------------------------------------------------------*
*& Form bdc_dynpro
*&---------------------------------------------------------------------*
* text BY LuisFarro
*----------------------------------------------------------------------*
* -->PROGRAM text
* -->DYNPRO text
*----------------------------------------------------------------------*
FORM bdc_dynpro USING program TYPE any
dynpro TYPE any.
CLEAR gwa_bdcdata.
gwa_bdcdata-program = program.
gwa_bdcdata-dynpro = dynpro.
gwa_bdcdata-dynbegin = 'X'.
APPEND gwa_bdcdata TO gtd_bdcdata.
ENDFORM. " bdc_dynpro
*&---------------------------------------------------------------------*
*& Form bdc_field BY LuisFarro
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->FNAM text
* -->FVAL text
*----------------------------------------------------------------------*
FORM bdc_field USING fnam TYPE any
fval TYPE any.
IF fval <> space.
CLEAR gwa_bdcdata.
gwa_bdcdata-fnam = fnam.
gwa_bdcdata-fval = fval.
APPEND gwa_bdcdata TO gtd_bdcdata.
ENDIF.
ENDFORM. " bdc_field
saludos,
Luis Farro
************************************************** *****************
programar es una cosa de niños