07-10-2007 10:32 AM
Hello friends,
I am doing a screen program where the user will enter a range of sales orders,and i have to select from vbap the corresponding materials against that sales order number,but i am finding it difficult to use the select statement.
suppose my screen fields are vbeln-low and vbeln-high,so here i cant use the select statement select * from vbap into corresponding fields of iatb where
vbeln >= vbeln-low and vbeln <=vbeln-high, bcoz if the user doesnt enter vbeln-high then select statement goes wrong,other option i making a structure with fields like sign option low high,but if i have more select options that again beocmes a problem,is there anyway that i can solve this with a single select statement
07-10-2007 10:38 AM
07-10-2007 10:38 AM
07-10-2007 10:40 AM
Hi,
Use <b>select * from vbap into corresponding fields of iatb where
vbeln in vbeln.</b>
Regards,
PAdmam.
07-10-2007 10:41 AM
hi,
When u are using select-options u should use IN operator in the select statement.
07-10-2007 10:41 AM
Hi
U can create a SELECTION-SCREEN in a module pool defining it in the TOP-INCLUDE:
SELECTION-SCREEN BEGIN OF SCREEN 0100.
SELECT-OPTIONS: SO_VBELN FOR VBAK-VBELN.
SELECTION-SCREEN END OF SCREEN 0100.
In your MAIN SCREEN
PROCESS PBO.
MODULE CALL_SEL_SCREEN.
MODULE CALL_SEL_SCREEN.
CALL SELECTION-SCREEN 100.
IF SY-SUBRC = 0.
---> User has pressed F8
SELECT * FROM VBAP INTO TABLE T_VBAP WHERE VBELN IN SO_VBELN.
ELSE.
----> User wants to exit from selection-screen.
ENDIF.
ENDMODULE.
Max
07-10-2007 10:43 AM
<b>select * from vbap into corresponding fields of iatb where vbeln in s_vbeln.
Don't use the comparision operators...</b>
Regards,
Pavan P.
07-10-2007 10:48 AM
07-10-2007 10:50 AM
In ur screen(let say 100), draw a SUBSCREEN area and name it SUB1.
now in your program write a code like this:-
tables vbak.
selection-screen begin of screen 101 as subscreen.
select-options s_vbeln for vbak-vbeln.
selection-screen end of screen 101.
now in PBO of ur screen write:-
call subscreen sub1 including sy-repid '101'.
and in PAI write select statement:
select * from vbap into corresponding fields of iatb where
vbeln in s_vbeln.
Rewards points if helpful.
07-10-2007 10:56 AM
select options form an internal table with sign, option, low , high so a range
of values will be selected when u use select options, so in select query
use 'IN' , then it works perfect
07-10-2007 12:25 PM
hi
use the following syntax.
select * from vbap into corresponding fields of itab where vbeln in s_vbeln.
reward if useful