Sub routine pool is used when you don't want to call another screen.
If there is any syntax error in appended code , subroutine pool starting with %_ will not generate.
*************************************************************************************
REPORT zmrs_down_special.
TABLES: zbi_table_list.
DATA: BEGIN OF it_fields OCCURS 0 ,
tablename LIKE zbi_table_list-tablename,
field LIKE zbi_table_list-field,
END OF it_fields.
DATA: BEGIN OF it_all_fields OCCURS 0,
tablename LIKE zbi_table_list-tablename,
field LIKE zbi_table_list-field,
END OF it_all_fields.
TYPES: BEGIN OF tab_type,
fcode LIKE rsmpe-func,
END OF tab_type.
DATA: tab TYPE STANDARD TABLE OF tab_type WITH
NON-UNIQUE DEFAULT KEY INITIAL SIZE 10,
wa_tab TYPE tab_type.DATA itab(72) OCCURS 0.
DATA flag.
**********************************************************************************
DATA: BEGIN OF dict OCCURS 0,
tabname TYPE dntab-tabname,
fieldname TYPE dntab-fieldname,
langu TYPE dntab-langu,
position TYPE dntab-position,
offset TYPE dntab-offset,
keyflag TYPE dntab-keyflag,
fieldtext TYPE dntab-fieldtext,
datatype TYPE dntab-datatype,
inttype TYPE dntab-inttype,
ddlen TYPE dntab-ddlen,
intlen TYPE dntab-intlen,
decimals TYPE dntab-decimals,
checktable TYPE dntab-checktable,
reftable TYPE dntab-reftable,
reffield TYPE dntab-reffield,
precfield TYPE dntab-precfield,
logflag TYPE dntab-logflag,
memoryid TYPE dntab-memoryid,
lowercase TYPE dntab-lowercase,
sign TYPE dntab-sign,
valexi TYPE dntab-valexi,
noforkey TYPE dntab-noforkey,
convexit TYPE dntab-convexit,
set(60),
whr(60),
relop(3),
END OF dict.
*****************************************************************************
PARAMETERS : filepath(132) LOWER CASE MODIF ID 006
DEFAULT '/oracle/WE3/sapreorg/abap/' OBLIGATORY.
SELECT-OPTIONS : s_table FOR zbi_table_list-tablename.
DATA fn(128).
DATA : BEGIN OF it_fdata OCCURS 0,
fn(128),
END OF it_fdata.
DATA : sid TYPE string.
START-OF-SELECTION.
PERFORM prepare_data_decl USING filepath.
********************************************************************************
FORM prepare_data_decl USING filepath.
DATA dict_wa LIKE dntab.
DATA wa_dict LIKE LINE OF dict.
DATA zname(8).
DATA wa(72).
CLEAR itab[].
DATA: l_tablename LIKE dntab-tabname.
READ TABLE s_table INDEX 1.
l_tablename = s_table-low.
CALL FUNCTION 'NAMETAB_GET'
EXPORTING
langu = sy-langu
tabname = l_tablename
TABLES
nametab = dict
EXCEPTIONS
internal_error = 1
table_has_no_fields = 2
table_not_activ = 3
no_texts_found = 4
OTHERS = 5.
CASE sy-subrc.
WHEN 1.
WRITE 'Internal Error!'.
WHEN 2.
WRITE 'Table has no fields!'.
WHEN 3.
WRITE 'Table not active!'.
WHEN 4.
WRITE 'No Text Found!'. ENDCASE.
IF dict[] IS INITIAL.
WRITE 'Error! Please check the table name'.
EXIT
ENDIF.
DELETE dict WHERE fieldname = 'MANDT'.
REFRESH it_all_fields.
LOOP AT dict INTO wa_dict.
CLEAR it_all_fields.
it_all_fields-tablename = wa_dict-tabname.
it_all_fields-field = wa_dict-fieldname.
APPEND it_all_fields.
ENDLOOP.
.........................................................
...........................................................
..........................................................
GENERATE SUBROUTINE POOL itab NAME zname SHORTDUMP-ID sid .
PERFORM data_upload IN PROGRAM (zname) USING l_tablename filepath IF FOUND.
****************************
But in my openion this is not a good way of calling another program rather use SUBMIT statement.
Rahul gupta
No comments:
Post a Comment