07-04-2007 7:13 AM
Helo all,
My req is i have to insert the new field in selection screen , and based on that inputs fetch the data ..suppose if no input mentioned in my new field, it should display the data along with matched records ...if i enter the input in my new field it shoudl display only with related entered input matching data..My problem is it is fetching all the data and displying...how can filter the output data????
07-04-2007 7:17 AM
Hi Mahendar,
Check out the primary select statements' where conditions, you will see that they are filtered on the input parameters that come from the selection screen. Now add your new parameter to those where conditiond to filter the data accordingly. If you donot keep the field as mandatory (obligatory) even if the selection screen field is initial, the select will bring records based on the rest of the filters.
Hope this helps. If it does, do reward accordingly.
Regards,
Karthik
07-04-2007 9:02 AM
This is the primary select stmt...
SELECT * FROM ekpo
FOR ALL ENTRIES IN it_ekko
WHERE ebeln = it_ekko-ebeln
AND matnr IN r_matnr
AND werks IN s_werks
AND wepos IN r_wepos
AND repos IN r_repos
AND retpo IN r_rtpos
AND loekz IN r_loekz
AND pstyp IN r_pstyp
AND knttp IN s_knttp
AND matkl IN s_matkl
AND ean11 IN s_ean11
AND idnlf IN s_idnlf
AND ltsnr IN s_ltsnr
AND aktnr IN s_aktnr
AND saiso IN s_saiso
AND saisj IN s_saisj.
PERFORM berechtigungen_pos(sapfm06d).
IF sy-subrc NE 0.
xauth = 'X'.
CHECK sy-subrc EQ 0. "nächster EKPO
ENDIF.
it_ekpo-ebeln = ekpo-ebeln.
it_ekpo-ebelp = ekpo-ebelp.
APPEND it_ekpo.
lekpo = ekpo.
APPEND lekpo.
endif.
endif.
ENDSELECT.
My new code is
SELECT tnumber
werks
matkl
FROM zbuyerrole
INTO TABLE t_buyer
WHERE werks = lekpo-werks
AND matkl = lekpo-matkl
AND knttp = lekpo-knttp
AND ( role = c_pr OR role = c_tb )
AND tnumber IN s_t#.
So how can i my selectoption fiels S_t# in primary select stmt....Pls help me urgent???
07-04-2007 7:22 AM
hi
on press of fetch button or execute button check if ur field value is empty then retrieve all records else retrireve the data corresponding to the field.
for example
move field value into <variable of type field>.
if sy-subrc eq 0.
fetch corres data
else
fetch all data
regards
ravish
<b>reward if useful</b>
07-04-2007 7:30 AM
Hi,
You might have faced a problem in your Select query, Check the WHERE conditions properly....
Please check this sample code.
select *
from spfli
into table t_spfli
where carrid eq 'AA'
and connid eq P_CONNID.
where P_CONNID is the parameter on the selection screen
Regards,
Pavan P.
07-04-2007 9:06 AM
Hi,
To add new selection you will have to make input variables on the characteritics upon which you want selections and then will have to include those variables into the rows or drilldown in the reports in which you want then to appear.
To make variables just go to the char and right click on it.
for more help on variables go through it.
http://help.sap.com/saphelp_nw04/helpdata/EN/cf/579b3c494d8e15e10000000a114084/content.htm
execute the code .
you will get sel option for s_lgort only when there is a value in s_werks.
tables mard.
select-options: s_matnr for mard-matnr,
s_werks for mard-werks,
s_lgort for mard-lgort modif id abc.
at selection-screen output.
if not s_werks[] is initial and s_matnr[] is initial.
loop at screen.
if screen-group1 = 'ABC'.
screen-active = '1'.
modify screen.
endif.
endloop.
else.
loop at screen.
if screen-group1 = 'ABC'.
screen-active = '0'.
modify screen.
endif.
endloop.
endif.
Thanks
07-04-2007 10:37 AM
Hi,
Use Primary key in table then you could not able to get dublicate value and then if you enter any dublicated values in table you should display error message.