Age: 34 Joined: 12 Dec 2011 Posts: 47 Location: Рязань
Posted: Sat Feb 11, 2012 2:26 am Post subject:
Сергей wrote:
Мне нужно любой range нужно передать, потому что в качестве второго параметра нужно передать имя set, а он может быть любым.
Вот сделал. Резвитесь
Code:
REPORT z_convert_set_to_range.
*----------------------------------------------------------------------*
* CLASS cl_convert DEFINITION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS cl_convert_set_to_range DEFINITION ABSTRACT.
PUBLIC SECTION.
CLASS-METHODS convert
IMPORTING
value(set) TYPE char30
EXPORTING
it_range TYPE INDEX TABLE.
ENDCLASS. "cl_convert DEFINITION
*----------------------------------------------------------------------*
* CLASS cl_convert IMPLEMENTATION
*----------------------------------------------------------------------*
*
*----------------------------------------------------------------------*
CLASS cl_convert_set_to_range IMPLEMENTATION .
METHOD convert.
DATA: gt_set_values TYPE TABLE OF rgsb4,
range_temp TYPE RANGE OF char24,
ls_range_main LIKE LINE OF range_temp.
FIELD-SYMBOLS <ls_rgsb4> TYPE rgsb4.
FIELD-SYMBOLS <ls_range> TYPE ANY .
FIELD-SYMBOLS <ls_range_low> TYPE ANY.
FIELD-SYMBOLS <ls_range_high> TYPE ANY.
FIELD-SYMBOLS <ls_range_option> TYPE ANY.
FIELD-SYMBOLS <ls_range_sign> TYPE ANY.
CALL FUNCTION 'G_SET_GET_ALL_VALUES'
EXPORTING
setnr = set
class = '0000'
TABLES
set_values = gt_set_values.
LOOP AT gt_set_values ASSIGNING <ls_rgsb4>.
APPEND INITIAL LINE TO it_range ASSIGNING <ls_range>.
ASSIGN COMPONENT 'LOW' OF STRUCTURE <ls_range> TO <ls_range_low>.
ASSIGN COMPONENT 'HIGH' OF STRUCTURE <ls_range> TO <ls_range_high>.
ASSIGN COMPONENT 'OPTION' OF STRUCTURE <ls_range> TO <ls_range_option>.
ASSIGN COMPONENT 'SIGN' OF STRUCTURE <ls_range> TO <ls_range_sign>.
INITIALIZATION.
DATA ranger TYPE RANGE OF marc-matnr.
cl_convert_set_to_range=>convert( EXPORTING set = 'Z_ABAPER2_SET1' IMPORTING it_range = ranger ).
Age: 48 Joined: 25 Jan 2008 Posts: 580 Location: Москва
Posted: Mon Feb 13, 2012 11:58 am Post subject:
Mania4e11o wrote:
на счет append, там все легально проверенно "MANIA4E11O"
Ну использовать то можно, об этом и help.sap.com пишет:
Quote:
If a generic table type with the index table access type is used as the parameter of a function module, you can pass either a sorted table or a standard table in the call.
Просто зачем писать "INDEX TABLE", если можно написать "TABLE"? _________________ С уважением,
Удав.
Age: 34 Joined: 12 Dec 2011 Posts: 47 Location: Рязань
Posted: Mon Feb 13, 2012 8:15 pm Post subject:
Удав wrote:
Просто зачем писать "INDEX TABLE", если можно написать "TABLE"?
ну я это писал просто для наглядности И хотелось как-то более универсально) И вообще я месяц как только начал изучать,мне можно))Но теперь я учту это))
All times are GMT + 4 Hours Goto page Previous1, 2
Page 2 of 2
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.