‎2008 May 01 9:01 AM
HI
Salesorg----
Sales doc----
to -
Period----
to -
Suppose I enter sales org vbak-vkorg as 3050 and give range for sales doc and period it should show all the sales doc in that given range whose
Vbak-auart type is zje or zjr wrt to the given range period.( only for sales org 3050).
How to write a select query for this.
‎2008 May 01 9:08 AM
Hi Daniel,
TABLES:
VBAK.
SELECT-OPTIONS:
s_vbeln FOR vbak-vbeln,
s_period FOR vbak-agrzr. " Your Period Field
DATA:
t_vbak TYPE TABLE OF vbak WITH HEADER LINE.
SELECT *
FROM vbak
INTO TABLE t_vbak
WHERE vbeln IN s_vbeln
AND agrzr IN s_period " Your Period Field
AND auart = 'ZJE'
OR auart = 'ZJR'
AND vkorg = '3050'.
LOOP AT t_vbak.
WRITE:
/ t_vbak-vbeln,
t_vbak-kunnr.
ENDLOOP.Regards,
Sunil
‎2008 May 01 9:08 AM
Hi,
For ranges first u need to create a structure and u need to populate the values in to that table of ranges.
then only u can use them.
RANGES <rangetab> FOR <f>.DATA: BEGIN OF <rangetab> OCCURS 0,
sign(1) TYPE c,
option(2) TYPE c,
low LIKE <f>,
high LIKE <f>,
END OF <rangetab>.select *
from <database table>
into table <internal table>
where vkorg = p_vkorg
and salesdoc in r_salesdoc
and date in r_dateHope this helps...
regards,
raam
‎2008 May 01 9:28 AM
Hi Daniel,
TABLES vbak.
DATA : itab LIKE TABLE OF vbak.
PARAMETERS :
p_vkorg LIKE vbak-vkorg.
SELECT-OPTIONS:
s_vbeln FOR vbak-vbeln,
s_erdat FOR vbak-erdat.
SELECT vbeln
vkorg
auart
erdat
FROM vbak
INTO CORRESPONDING FIELDS OF TABLE itab
WHERE vkorg EQ p_vkorg
AND vbeln IN s_vbeln
AND erdat IN s_erdat
AND ( auart EQ 'ZJE' OR auart EQ 'ZJR' ).the above query will retrive data as per your condition.
regards,
Brijesh.