2008 Apr 12 9:02 AM
Hello,
How can i get my range in select-option into an internal table ?
Thanks and Best Regards,
Shehryar Dahar
Hello,
How can i get my range in select-option into an internal table ?
Thanks and Best Regards,
Shehryar Dahar
2008 Apr 12 9:21 AM
Hi,
Select-Option means that is internal table with with the following structure
DATA: BEGIN OF <select_op> OCCURS 0,
SIGN(1),
OPTION(2)
LOW LIKE <f>,
HIGH LIKE <f>,
END OF <select_op>.
example
define structure like this for s_matnr.
SELECT-OPTIONS: s_matnr for mara-matnr.
Internal table
data: w_matnr like line of s_manr.
data:begin of i_mara occurs 0 with header line,
matnr type mara-matnr,
end of i_matnr.
Use the loop like this for range if u have given.
I hope that it helps you .
Regards,
Venkat.O
data:l_times type i,
l_count type i.
LOOP AT s_matnr into w_matnr.
if w_matnr-option = 'BT' and w_matnr-sign = 'I'."Inclusive.
l_times = w_matnr-high - w_matnr-low.
l_count = 0.
do l_times times.
i_mara-matnr = w_matnr-low + l_count.
l_count = l_count + 1.
enddo.
if w_matnr-option = 'BT' and w_matnr-sign = 'E'."Exclusive.
l_times = w_matnr-high - w_matnr-low.
l_count = 1.
do l_times times.
i_mara-matnr = w_matnr-low + l_count.
l_count = l_count + 1.
enddo.
endif.
ENDLOOP.
2008 Apr 12 9:41 AM
Hello Venkat,
Thanks for the reply, but the above logic will work for numbers only, my data(in the range) can either be alpha-numeric or numbers or both.
?
Best Regards,
Shehryar Dahar
2008 Apr 12 11:17 AM
Shehryar dahar,
If it is not number how do u give Range in Select-OPtion non-numbers.
If you give multiple values, in the select-options.
follow the this.
Regards,
Venkat.O
LOOP AT s_matnr INTO w_matnr.
IF w_matnr-option = 'EQ' AND w_matnr-sign = 'I'.
i_mara-matnr = w_matnr-low.
APPEND i_mara.
CLEAR i_mara.
ENDIF.
ENDLOOP.
2008 Apr 14 7:52 AM
Dear Venkat,
I am using the ekpo-bednr field (Requirement Tracking Number) which is actually a PO external number range from A0000 to AZZZZ (which is alpha numeric). I am using this field in the select-options.
Best Regards,
Shehryar Dahar
2008 Apr 14 8:03 AM
Hi shehryar,
1. If i understand properly, then we
have to use a select query for the master table,
which contains all the field values.
2. suppose itab contains one field only,
in which u want all the values.
Select field
from dbtab
into itab
where field in seloption.
regards,
amit m.
2008 Apr 14 8:45 AM
Hello,
Sorry for not explaining the scenario clearly, my bad !
We have two system. Old and New SAP systems. I want to get the details of all PO's in the old system and for that i am using BAPI_PO_GETDETAIL(thru RFC dest command), in the new system. I cannot carry out developments in the old system so i am bound on developing a customer BAPI to access all the PO's in the old system.
In the new system, i have created a report which input a PO or range of PO numbers in the select-options, which then uses the above BAPI to get the PO detail. This PO number can be inputted as '45XXXXXXXX' or as 'A0XXXX'. Now i want to transfer my range in select-options IN internal table so that i can loop on it and get detail of the PO's.
Or if anyone has a workaround on it, kindly advise.
Best Regards,
Shehryar Dahar
2008 Apr 14 10:00 AM
Hi Shehryar dahar, PO number ranges are maintained in sometable. I dont remember. Just write select query like this. ex: select-options: s_ebeln for ekpo-ebeln. "Write one query to get PO number from number range table. Select <field> from <database table> into table i_pos where <field> in s_ebeln. Ask Functional guyz to PO number range table or where they maintain. Actuall Amit explained clearly. Regards, Venkat.O
2008 Apr 12 10:17 AM
Hello
If you just want to "copy" the values from the select-option into a range variable then use the following approach:
DATA: gr_matnr TYPE RANGE OF matnr,
gs_rng LIKE LINE OF gr_matnr. " SIGN / OPTION / LOW / HIGH
SELECT-OPTIONS:
o_matnr FOR mara-matnr.
START-OF-SELECTION.
gr_matnr = o_matnr[]. " NOTE: select-option = itab with header line
LOOP AT gr_matnr INTO gs_rng.
...
ENDLOOP.
Regards
Uwe
2008 Apr 12 11:26 AM
Hi,
select-options and ranges are the internal tables having same structure.
You can transfer from select-options to ranges and viceversa.
select-options: s_matnr for mara-matnr.
ranges: r_matnr for mara-matnr.
*---to transfer data from select-options to ranges.
loop at s_matnr.
r_matnr-sign = s_matnr-sign.
r_matnr-option = s_matnr-option.
r_matnr-low = s_matnr-low.
r_matnr-high = s_matnr-high.
append r_matnr.
endloop.
Like this we can transfer data from ranges to select-options.
Reward.
2008 Apr 14 1:16 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |