Select options and internal table
Hi,
I have requirement for which I was coding...
On the selction screen, I have an object field... say I have multiple values like 101, 102, 103
select-options: s_3 for hrp1000-objid.
i_1001 type standard table of HRP1001 with header line
i_temp_1001 type standard table of HRP1001 occurs 0.
Need to create an hrp1001 record for these based on a template record available in hrp1001.
I need to read all the records of the template record (say 100) from hrp1001 and need to create the same set for the objects 101, 102 and 103. How to do that? ofcourse I need to replace the object id 100 with 101, 102 and so on for the complte set..
How can I accomplish without using nested loops.
tried something like this..
select * from HRP1001 into corresponding fields of i_1001 where otype = '51' and objid = '100' and endda = '99991231'.
if sy-subrc = 0.
clear i_hrp1000-objid.
append i_1001.
endselect.
loop at s_3.
loop at i_1001.
move-corresponding i_1001 to i_temp_1001.
endloop.
i_temp_1001-objid = s_brd3-low.
append i_temp_1001.
endloop..
Looking to avoid nested loops... Any thoughts?
Thanks,
VG
Moderator message -
When closing old threads, there is no need to add a comment. Adding a pasted answer like "Resolved myself " only brings old threads to the top of the forum list and pushes current ones down. If you do add a comment, please indicate just how the problem was resolved.
And please use code tags to format code.
Rob
Similar Messages
-
Passing SELECT-OPTIONS and Internal Tables to SUBROUTINES
Hi Guys
In the code below my colleague has created her own table types in order to pass a select option and internal tables to her subroutine. Is there an easier way of making them known to the subroutine.
data : v_vbeln type vbeln_vf,
it_bdoc type table of vbrp,
it_t006 type table of t006a,
wa_bdoc type vbrp,
wa_t006 type t006a,
it_bdoc2 type table of zsswathi_st_vbeln,
wa_bdoc2 type zsswathi_st_vbeln
select-options s_vbeln for v_vbeln matchcode object zswathi_vbeln obligatory.
start-of-selection.
perform bdoc using s_vbeln[]
changing it_bdoc
it_bdoc2
it_t006.
loop at it_bdoc2 into wa_bdoc2.
form bdoc using f_s_vbeln type ZSWATHI_ST_SELECT_OPTION_TA_TY " all these are table types. for select options, a structure is created and then a table type for it is created.
changing f_it_bdoc type zswathi_vbrp_ty_ta
f_it_bdoc2 type zswathi_vbeln_ty_ta
f_it_t006 type ZSWATHI_T006_TA_TY.
select * from vbrp into table f_it_bdoc where vbeln in f_s_vbeln.
if f_it_bdoc is not initial.
select vbeln sum( netwr ) prsdt from vbrp into table f_it_bdoc2 where vbeln in f_s_vbeln group by vbeln prsdt.
sort f_it_bdoc2 by vbeln.
"select * from t006a into table it_t006 for all entries in it_bdoc where msehi = it_bdoc-vrkme.
select * from t006a into table f_it_t006 for all entries in f_it_bdoc where msehi = f_it_bdoc-vrkme.
endif.
endform.Hi Brett,
1. you can use a select-options-range in a FORM subroutine also without passing it as a parameter because parameters and select-option range tables are global fields in their program.
2. If you need a parameter, declare it as type table or type standard table or type any table. You do not need any special table type.
Regards
Clemens -
Move the data in select options to internal table
I have the code as in the fillowing
SELECT-OPTION:S_MATNR FOR MARA-MATNR.
DATA:BEGIN OF IT_MATNTR OCCURS 0,
MATNR LIKE MARA-MATNR,
END OF IT-MATNR.
NOW HOW CAN I ADD THE MATNER VALUES IN THE SELECT-OPTIONS IN INTERNAL TABLEHi Vamsikrishna,
Yes. You can move the values from S_MATNR to IT_MATNR.
you can try either it_matnr[] = s_matnr[].
if not then you can loop in to the select-options as follows.
Define LS_MATNR as a structure type of s_matnr.
Define LS_IT_MATNR as a structure type of it_matnr.
LOOP S_MATNR INTO LS_MATNR.
MOVE LS_MATNR to LS_IT_MATNR.
APPEND LS_IT_MATNR to IT_MATNR.
CLEAR: LS_MATNR, LS_IT_MATNR.
ENDLOOP.
<b>Reward points for helpful answers.</b>
Best Regards,
Ram. -
How to get all values in the range of select option into internal table?
Hi,
I need to capture all entries coming in the range of select option into one internal table.
How to do get that?
For E.g
select-options: matnr for mara-matnr.(select option)
IF I enter G0100013507892 as lower value of matnr and G0100014873947 as higher value
and if there are 10,000 materials in the above range, then I want to capture all theses 10000 materails in one internal table. How to do that?
Regards,
MrunalHello Mrunal Mhaskar ,
What i understand you can do one thing go in debug mode
Try this code : -
LOOP AT s_matnr_ex.
IF s_matnr_ex-low IS NOT INITIAL.
i_matnr-matnr = s_matnr_ex-low.
i_matnr-option = s_matnr_ex-option.
APPEND i_matnr.
CLEAR : i_matnr.
ENDIF.
ENDLOOP.
LOOP AT s_matnr_ex.
IF s_matnr_ex-high IS NOT INITIAL.
i_matnr-matnr = s_matnr_ex-high.
i_matnr-option = s_matnr_ex-option.
APPEND i_matnr.
CLEAR : i_matnr.
ENDIF.
ENDLOOP.
In the i_matnr table high and low values are there.
Regards,
Vandana. -
SELECT-OPTION to internal table
Hi,
I need to convert the select-option values into an internal table.
For example, if there is a select-option S_WERKS... i need all the values entered for S_WERKS into the internal table. The internal table structure contains only WERKS.
My actual requirement is, for the given plant values as select-option, i need to fetch all details of the plants. And I should not use any SELECT statements at any stage. Only through function module/ BAPI/BADI/Class methods.
I found one function module T001W_READ, but i need to pass the plant for that.
Please suggest.
Thanks in advance.
kishoreHi Kishore
Why can't you use any SELECTs? If it is so required why not writing your own FM to select them? You can pass your select-option via a generic parameter and assign it to a range at the beginning of your FM. Or you can assign it to a select-option-like table (you can find structure names of similar type from DDIC)
<i><b>e.g.</b></i>
TABLES t001w .
RANGES s_werks for t001w-werks .
DATA: BEGIN OF lt_werks ,
werks LIKE t001w-werks ,
END OF lt_werks .
s_werks[] = it_werks_so[] .
SELECT werks FROM t001w
INTO lt_werks
WHERE werks IN s_werks .
As another thing, let me introduce you the SDN Forums pointing system: You can assign points to posts which you find helpful while solving your problem. You can reward points by pressing the yellow star icon at header of each post. You can assign;
- one 10 points (solved)
- two 6 points (very helpful answer)
- many 2 points (helpful answer)
*--Serdar -
Select options to internal table
i have selected some values in the range say 100 to 200 using select options....is there any way to get these values in an internal table?
also does select option work with alpha numeric values
eg : if i want to select between a100 and b200?>
VR ARVIND wrote:
> i mean to say if i have 100 to 200.. i need 101 102 103 etc..continuosly till 200
Select-options are really only useful for selecting data that matches the select-options from some other dataset. They don "expand out" into a set of values.
If you are always specifying a range in the selection screen, use two parameters - p_low, p_high.
You then will need to build your itab entry by entry. So
l_count = p_low.
WHILE l_count LE p_high.
INSERT l_count INTO t_itab.
ADD 1 to l_count.
ENDWHILE.
For a100 to a200, you'd have to do some string slicing and concatenation to get the desired result. -
Create select-options using internal table
Hello,
I have number of table-fields in one internal table.
I need to create select-options on screen for each of the table field in that internal table.
Can anybody please provide a code for it ?
Thanks.hi,
you can create in this way :
select-options: <name> for itab-<field name>.
example code:
TABLES: vbak. " standard table
TYPE-POOLS: slis.
*-- Structure to hold data from table
TYPES: BEGIN OF tp_itab1,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
werks LIKE vbap-werks,
lgort LIKE vbap-lgort,
END OF tp_itab1.
*-- Data Declaration
DATA: t_itab1 TYPE TABLE OF tp_itab1.
DATA : i_fieldcat TYPE slis_t_fieldcat_alv.
* Selection Screen *
*--Sales document-block
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS: s_vbeln FOR vbak-vbeln,
s_posnr FOR vbap-posnr,
s_werks FOR vbap-werks,
s_lgort FOR vbap-lgort.*
SELECTION-SCREEN END OF BLOCK b1.
hope it will help you
regards
Rahul sharma
Edited by: RAHUL SHARMA on Sep 19, 2008 8:25 AM -
Hi all,
Belated Happy Holi.
Can u explain me the difference between
Select-options and ranges?
When, where and how to use them ?
I know the basic differences, but i need to know in deep .
could u give me the informatin with a scenario please ?
Thanks in advance
RaviHI
<u>SELECT-OPTIONS:</u> Declare an internal table that is also linked to input fields on a selection screen
<u>RANGES:</u> Declare an internal table with the same structure as in select-options, but without linking it to a selection screen.
FOR FURTHER DOCUMENTATION PLEASE GO THROUGH THE LINK
<a href="http://72.14.203.104/search?q=cache:btyoj86smhEJ:www.sap-img.com/abap/difference-between-select-options-ranges.htmSelect-optionsandrangesIN+ABAP&hl=en&gl=in&ct=clnk&cd=1">Difference Between Select-Options & Ranges</a>
<a href="http://72.14.203.104/search?q=cache:EJgiHLpghDEJ:help.sap.com/saphelp_nw04/helpdata/en/fc/eb3034358411d1829f0000e829fbfe/content.htmSelect-optionsandrangesIN+ABAP&hl=en&gl=in&ct=clnk&cd=4">Statical Declaration</a>
<a href="http://72.14.203.104/search?q=cache:VWS1erlabRIJ:help.sap.com/saphelp_nw04/helpdata/en/9f/dba71f35c111d1829f0000e829fbfe/content.htmSelect-optionsandrangesIN+ABAP&hl=en&gl=in&ct=clnk&cd=5">Selection tables</a>
REGARDS
ANOOP
Message was edited by: ANOOP R.S -
SELECT-OPTIONS and data collection
Hi All,
I have one inputfield (say users) via SELECT-OPTIONS and it goes to an internal table called "userlist" with values USER1, USER2 etc...(Example)
Now, when I query the database with "userlist" as the input, I'm not able to do so because SELECT-OPTIONS contains an Internal table with values LOW, HIGH etc...
So my input value goes like this IEQUSER1, IEQUSER2 etc......
Could anyone tell me what should I do in order to get USER1, USER2 etc.
Thanks in advance,
PradeepHi All,
Sorry. I'm getting the error: 'Line structure of table USERLIST is incorrect'.
My coding is as follows:
tables : usr02.
data: begin of users,
users type XUBNAME,
end of users.
data : it_usr02 like table of usr02.
data : l_userlist type xubname, "This is a data elemnt thats already in the system of type BNAME
p_userlist like l_userlist.
select-options: userlist for users.
loop at userlist into l_userlist.
select * from usr02 into corresponding fields of table it_usr02 where bname in userlist.
endloop.
ENDFUNCTION.
Could you please help?
Thanks and Regards, Pradeep -
hi,
In How many ways we can define select-options and parameters.hi uday,
Usually we use PARAMETERS for single value input and
SELECT-OPTIONS is used to give a range of input values for a single field
SELECT-OPTIONS implicitly consists of internal table with fields
OPTIONS
LOW
HIGH
SIGN
eg:
DATA: G_VBELN TYPE VBAK-VBELN.
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME.
PARAMETERS : P_VBELN LIKE VBAK-VBELN.
SELECT-OPTIONS: S_VBELN FOR G_VBELN.
SELECTION-SCREEN END OF BLOCK B1.
o/p:
P_VBELN: _________________.
S_VBELN:___________ TO ____________.
reward if helpful
regards.
shashikanth naram. -
HI major diffrence in select-options and parameters
Hi,
Can any one explain me the major diffrence between select options and parameters.
I know that in select options we can give a range of values and in parameter one value.
ThanksHello Hari,
I would see following differences:
1. As you have mentioned, many values/ranges can be given in the SELECT-OPTIONS. However, the parameter can hold only one value.
2. In the run time, we see the data w.r.t a select option as an Internal table and Parameter may be accessed as a global variable.
3. Consider following statements:
a. select-options: s_matnr for mara-matnr no-extension no intervals.
b. parameters: P_MATNR like mara-matnr.
Both the statements look same on the selection screen.
consider the SQLs:
<b>select * into corresponding fields of table g_t_mara
from mara
where
matnr in s_matnr.</b>
and
<b>select * into corresponding fields of table g_t_mara
from mara
where
matnr eq p_matnr.</b>
both the SQLs give the same output if the user gives a material number on Selection screen.
If the user does NOT give any input in selection screen, the first SQL will fetch all data from DB, whereas the SQL with the PARAMETER will fail.
So I think we should keep in mind the requirement and code accordingly.
I hope this helps you.
Best Regards,
Murugesh AS -
SAP QUERY LOOPS AND INTERNAL TABLE
Hi All, I have a query which i have made. It runs from Table EKPO which has PO details and what I want to do is now via ABAP Code pull through the total of goods receipt for the PO and Line Item into a field. Sounds Easy enough..Problem now,
The table which contains the GR data is EKBE which agains a PO and Line Item can have many 101 movements and 102 movements so what I want is an ABAP Statent to basically sum up the total of 101 for the PO & LINE ITEMS and then minus this from the total of 102 for the PO & LINE ITEMS and post the result in to this new field I have created.
I am pretty decent with ABAP Code in Querys I.e Select statements etc but from what I can see i need to create an internal table and do a loop and collect statement but I keep on failing due to not enough knowledge. Please can some one help me with this and provide me with the code and explanation as i would like to understand,
POINTS WILL BE REWARDED
Thanks
Kind Regards
Adeel SarwarHi,
This is the full code i have entered but its not working. Any help would be appreciated. If you could rectify the code and internal tables that would be great.
Thanks
TABLES: EKBE.
DATA: PurO LIKE EKPO-EBELN,
POLI LIKE EKPO-EBELP.
*New Table and Vars defined
DATA: BEGIN OF IT_EKBE,
IT_EKBE LIKE EKBE,
END OF IT_EKBE.
DATA: BEGIN OF IT_SUM OCCURS 0,
EBELN TYPE EBELN,
EBELP TYPE EBELP,
DMBTR TYPE DMBTR,
MENGE TYPE MENGE,
END OF IT_SUM.
CLEAR: QTYD.
MOVE: EKPO-EBELN TO PurO,
EKPO-EBELP TO POLI.
SELECT * FROM EKBE INTO IT_EKBE
WHERE EBELN = PurO
AND EBELP = POLI
AND BEWTP = 'E'
LOOP AT IT_EKBE.
MOVE CORRESPOING IT_EKBE TO IT_SUM.
IF IT_EKBE-BWART = '102'.
IT_SUM-DMBTR = IT_SUM-DMBTR * -1.
IT_SUM-MENGE = IT_SUM-MENGE * -1.
ENIDF.
COLLECT IT_SUM.
CLEAR IT_SUM.
ENDLOOP.
ENDSELECT.
If sy-subrc = 0.
QTYD = IT_SUM.
ELSE.
QTYD = 0.
ENDIF. -
Difference between the Field Group and Internal Table.
Hi all,
Can anybody tell me the difference between the Field group and Internal table and when they will used?
Thanks,
Sriram.Hi
Internal Tables: They are used to store record type data in tabular form temporarily in ABAP programming. Or we can say, it stores multiple lines of records for temporary use in ABAP programming.
A field group is a user-defined grouping of characteristics and basic key figures from the EC-EIS or EC-BP field catalog.
Use
The field catalog contains the fields that are used in the aspects. As the number of fields grows, the field catalog becomes very large and unclear. To simplify maintenance of the aspects, you can group fields in a field group. You can group the fields as you wish, for example, by subject area or responsibility area. A field may be included in several field groups.
When maintaining the data structure of an aspect, you can select the field group that contains the relevant characteristics and basic key figures. This way you limit the number of fields offered.
Regards
Ashish -
DATA BASE TABLE AND INTERNAL TABLE
Dear Friends,
please help me out in getting complete information about database table and internal table.
you can email me at < Removed by moderator - please maintain e-mail iDs in Business Card>
Message was edited by:
Arun VaradarajanHi Hazi,
<b>DATABASE Tables :</b>
This are the tables which are stored in the database (eg Oracle , informix , DB2 etc..) Physically. u can view it from T-codes SE11 or SE16. here in SE11 u can create ur own Transparent table.
for more information...
http://www.sapbrainsonline.com/TUTORIALS/TECHNICAL/dictionary_tutorial.html
<b>Internal Tables.</b>
While generating reports or other objects we are not modifying the database tables directly first we are selecting the data of the database table into the internal tables... so that we can reduce the database access time and network traffic .. which is highly needed in R/3 system..
internal tables are not exist phyiscally in the system. its like a array. the existance of the internal tables is upto the program execution in which u r declaring nd using it...
for more information..
http://www.sapbrainsonline.com/TUTORIALS/TECHNICAL/internaltables_tutorial.html
Hope it will solve ur problem..
<b>Reward points if useful..</b>
Thanks & Regards
ilesh 24x7 -
Select options and radio button problem
Hi All,
In selection screen I have a select option and two radio button default is disable when I input value on select option, it will enable radio button. How can I do this?
Thanks.
mlaiPlease go through the below code and reward points if u find it useful:
tables : pa0000.
selection-screen begin of block b1 with frame title text-001.
select-options : s_pernr for pa0000-pernr.
parameters : r1 radiobutton group g1 modif id abc.
parameters : r2 radiobutton group g1 modif id abc.
selection-screen end of block b1.
at selection-screen output.
if s_pernr[] is initial.
loop at screen.
if screen-group1 = 'ABC'.
screen-invisible = 1.
modify screen.
endif.
endloop.
else.
loop at screen.
if screen-group1 = 'ABC'.
screen-invisible = 0.
modify screen.
endif.
endloop.
endif.
Thanks
Vasu
Maybe you are looking for
-
I am trying to FaceTime with my daughter in Sweden. I am using OS 10.9.4 on a MacBook Pro with Facetime 3.0. She is using an iPad mini with the current software. The query initally goes through and says "connecting" then fails to connect. I have chec
-
Update Open Shared Excel spreadsheet from SSIS using SQL task
I propose to call a SSIS package from excel and update a single cell in a sheet. The spreadsheet is shared so it can be referenced by SSIS even though it is open. The update succeeds but the problem is the cell is not updated unless the spreadsheet
-
I bought a Canon refurbished x3i from Canon last Summer after my Ritz Camera extended warranty became useless and my xTi (400D) died. The camera has been excellent until very recently. About a week or so ago, the autofocus stopped working. I think it
-
Are digital signatures 21CFR11 compliant?
Are Acrobat's built in digital sigatures features FDA compliant with 21CFR11 code of Federal Regulations?
-
How to display "age of employee"?
Hi, Can you pls tell me the procedure to display "age of employee" in IT 0002? I appreciate your helping nature. Thanks Yogi