05-25-2006 10:54 AM
Hi,
I have one doubt.The doubt is like this:
I have defined one button in one list using pf-status. Now in that output list there is matnr field and check boxes with it. When i will check multiple boxes and press the button then it will go to another selection screen with the help of call transaction and populate the data of multiple matnrs in the select option of the screen as we know that we can store multiple values in select option field.
Experts pls help me in solving this.
I am working on it.
With regards,
Abir.
05-25-2006 10:58 AM
HI Abir,
in the user_command sub routien,
assume that you have the internal table with an additional field for the check box and the changes that are made in the list(selection and deselection) are captured.
case ok_code.
when 'BUT1'.
loop at itab where check = 'X'.
r_matnr-low = itab-matnr.
r_natnr-sign = 'I'.
r_matnr-high = 'EQ'.
append r_matnr.
endloop.
submit zreport with s_matnr in r_matnr. "S_matnr is in the other program
endcase.
Regards,
Ravi
05-25-2006 10:58 AM
HI Abir,
in the user_command sub routien,
assume that you have the internal table with an additional field for the check box and the changes that are made in the list(selection and deselection) are captured.
case ok_code.
when 'BUT1'.
loop at itab where check = 'X'.
r_matnr-low = itab-matnr.
r_natnr-sign = 'I'.
r_matnr-high = 'EQ'.
append r_matnr.
endloop.
submit zreport with s_matnr in r_matnr. "S_matnr is in the other program
endcase.
Regards,
Ravi
05-25-2006 11:38 AM
Hi,
just a small addition you may use whenever you want to populate a range. What about
loop at itab where check = 'X'.
perform append_range using itab-matnr '' 'IEQ' changing r_matnr[].
endloop.
This works for ranges of any structure. Just give the SIGN and OPTION as a string, the low and high values and the range table.
And here comes the form to be uesed in all kind of programs:
&----
*& Form append_range
&----
append selection range
----
FORM append_range USING p_signopt TYPE c
p_low TYPE any
p_high TYPE any
CHANGING pt_range TYPE table.
FIELD-SYMBOLS:
<range> TYPE ANY,
<sign> TYPE ANY,
<option> TYPE ANY,
<low> TYPE ANY,
<high> TYPE ANY.
DATA:
l_ref TYPE REF TO data.
CREATE DATA l_ref LIKE LINE OF pt_range.
ASSIGN l_ref->* TO <range>.
CHECK sy-subrc = 0.
ASSIGN COMPONENT 'SIGN' OF STRUCTURE <range> TO <sign>.
CHECK sy-subrc = 0.
ASSIGN COMPONENT 'OPTION' OF STRUCTURE <range> TO <option>.
CHECK sy-subrc = 0.
ASSIGN COMPONENT 'LOW' OF STRUCTURE <range> TO <low>.
CHECK sy-subrc = 0.
ASSIGN COMPONENT 'HIGH' OF STRUCTURE <range> TO <high>.
CHECK sy-subrc = 0.
<sign> = p_signopt(1).
<option> = p_signopt+1(2).
<low> = p_low.
<high> = p_high.
APPEND <range> TO pt_range.
ENDFORM. " append_range
If you like call functions better, put it in a function once and have a reusable piece of software.
Regards,
Clemens
05-25-2006 10:58 AM