‎2005 Dec 14 12:28 PM
Hi all
I am trying to build either a range or an internal table for cost center and profit centers from thier groups. I have used a couple of function modules to get the setid and setvalues. I need to build the either ranges or internal tables from it. The problem is i have 4 ranges to build and i am using perform using changing. How do i pass ranges to the forms?? as setvalue-from setvalue-option setvalue-to have to be populated and i dont understand how to pass the ranges in
PERFORM BUILD_RANGE USING SETVALUES(which is a table with form to) CHANGING RANGES
FORM BUILD_RANGE USING CHANGING ..
appreciate any help.
thanks
‎2005 Dec 14 12:36 PM
Hi Dp,
1. try using this simple funda :
REPORT abc.
ranges a for pa0001-bukrs.
*----
form abc using p like a.
endform.
2. In the above way, u can pass the required
range in a form.
I hope it helps.
Regards,
Amit m.
‎2005 Dec 14 12:50 PM
ranges range1 for pa0001-bukrs.
perform build_ranges using range1[] .
form build_ranges using p_selection type table .
FIELD-SYMBOLS: <fs>, <fs_sign>, <fs_option>, <fs_low>, <fs_high>.
DO.
READ TABLE p_selection INDEX sy-index ASSIGNING <fs>.
IF sy-subrc NE 0.
EXIT.
ENDIF.
ASSIGN COMPONENT 'SIGN' OF STRUCTURE <fs> TO <fs_sign>.
ASSIGN COMPONENT 'OPTION' OF STRUCTURE <fs> TO <fs_option>.
ASSIGN COMPONENT 'LOW' OF STRUCTURE <fs> TO <fs_low>.
ASSIGN COMPONENT 'HIGH' OF STRUCTURE <fs> TO <fs_high>.
enddo.
Alexandre Nogueira
endform.
‎2005 Dec 14 12:41 PM
DP,
What exactly is your question? Are you asking what will you refer the parameters of the form to?
Regards,
Ravi
‎2005 Dec 14 6:20 PM
If I understand the question, you are having trouble passing a range table into a form routine.
First off, a range is a table just like any other table it has a defined structure. When you pass a table or structure into a form SAP sees is as just a long string of characters unless you tell it what fields it contains and where are their offsets. You do this by typing the table when you pass it in.
for example.
ranges: r_order for vbak-vbeln.
This statement creates a range table that will contain 4
sign
option
low
high
sign and option contain the relationship of the values in Low and High. For example you want all records between the low and high values ( sign will be "I" and option will be "BT" (between)
Low and high will be of type vbeln.
if you want to use this in a perform you must tell the perform about how your range table is structured in the parameters.
For example.
perform some_stuff tables i_order.
form some_stuff tables p_order_range structure i_order.
select (some fields) from vbak into table (some table)
where vbeln in p_order_range.
endform
Hope that helps.
Brent
‎2005 Dec 14 6:22 PM
Sorry DP, I think I had a typo there instead of passing in i_order to the perform that should have been the original range table r_order. I hope that didnt' confuse you.
Brent
‎2005 Dec 14 6:24 PM
you can have 2 options in this.
you can use the macros and the other one as follows.
1)
2)
FORM fill_range USING i_parameter TYPE any
CHANGING et_range TYPE table.
CONSTANTS:
lc_sign TYPE bapisign VALUE 'I',
lc_option TYPE bapioption VALUE 'EQ'.
FIELD-SYMBOLS:
<sign> TYPE bapisign,
<option> TYPE bapioption,
<low> TYPE ANY,
<ls_range> TYPE ANY.
DATA:
lr_range TYPE REF TO data.
You may want to catch exceptions starting from here
CREATE DATA lr_range LIKE LINE OF et_range.
ASSIGN lr_range->* TO <ls_range>.
ASSIGN COMPONENT 'SIGN' OF STRUCTURE <ls_range> TO <sign>.
ASSIGN COMPONENT 'OPTION' OF STRUCTURE <ls_range> TO <option>.
ASSIGN COMPONENT 'LOW' OF STRUCTURE <ls_range> TO <low>.
<sign> = lc_sign.
<option> = lc_option.
<low> = i_parameter.
ENDCATCH.
APPEND <ls_range> TO et_range.
ENDFORM. " fill_range
Assuming that your parameter is called p_matnr, and the range you want to fill is lr_matnr, you would call this routine as follows:
PERFORM fill_range
USING
p_matnr
CHANGING
lr_matnr[].