‎2005 Aug 28 12:01 PM
In selection screen in want customer ( kunnr), distribution channel(vtweg) , sales organisation (vkorg) and document date (audat)...........
by selecting any one or two of the above................... i want these results
sales order -
VBELN -
VBAP
net price -
NETPR----
VBAP
net value -
NETWR----
VBAP
material--
VBAP
division----
SPART -
VBAP
unit--
VBAP
currency--
VBAP
sales organisation----VKORG--
VBAK
distribution channel--VTWEG--
VBAK
doc date--
VBAK
customer -
KUNNR----
KNA1
please give me the coding for the above..
thanks in advance.
raju
‎2005 Aug 28 12:15 PM
Hi Raju,
Please use this code.
TABLES: vbak,
vbap,
kna1.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_vbeln FOR vbap-vbeln,
s_netpr FOR vbap-netpr,
s_netwr FOR vbap-netwr,
s_matnr FOR vbap-matnr,
s_spart FOR vbap-spart,
s_vrkme FOR vbap-vrkme,
s_waerk FOR vbap-waerk.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS: s_vkorg FOR vbak-vkorg,
s_vtweg FOR vbak-vtweg,
s_audat FOR vbak-audat.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS: s_kunnr FOR kna1-kunnr.
SELECTION-SCREEN END OF BLOCK blk1.
After activating the program you can give meaningful description to the selection screen fields (S_VBELN, S_NETPR etc) by going to menu Goto -> Text Elements -> Selection Texts.
You can then come back to the program and double click on text-001 to create a title.
Thanks
Vinod
Message was edited by: Vinod C
‎2005 Aug 28 12:15 PM
Hi Raju,
Please use this code.
TABLES: vbak,
vbap,
kna1.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_vbeln FOR vbap-vbeln,
s_netpr FOR vbap-netpr,
s_netwr FOR vbap-netwr,
s_matnr FOR vbap-matnr,
s_spart FOR vbap-spart,
s_vrkme FOR vbap-vrkme,
s_waerk FOR vbap-waerk.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS: s_vkorg FOR vbak-vkorg,
s_vtweg FOR vbak-vtweg,
s_audat FOR vbak-audat.
SELECTION-SCREEN SKIP 1.
SELECT-OPTIONS: s_kunnr FOR kna1-kunnr.
SELECTION-SCREEN END OF BLOCK blk1.
After activating the program you can give meaningful description to the selection screen fields (S_VBELN, S_NETPR etc) by going to menu Goto -> Text Elements -> Selection Texts.
You can then come back to the program and double click on text-001 to create a title.
Thanks
Vinod
Message was edited by: Vinod C
‎2005 Aug 28 1:30 PM
Hi Raju,
Welcome to SDN. You can try this one,
report zkb_test_prg .
tables: kna1,vbap,vbak.
data: begin of i_vbak,
vbeln type vbak-vbeln,
kunnr type vbak-kunnr,
vkorg type vbak-vkorg,
vtweg type vbak-vtweg,
audat type vbak-audat,
end of i_vbak.
data: begin of i_vbap,
vbeln type vbap-vbeln,
netpr type vbap-netpr,
netwr type vbap-netwr,
matnr type vbap-matnr,
spart type vbap-spart,
vrkme type vbap-vrkme,
waerk type vbap-waerk,
end of i_vbap.
data: i_vbak_tab like table of i_vbak with header line,
i_vbap_tab like table of i_vbap with header line.
select-options: s_kunnr for kna1-kunnr obligatory,
s_vkorg for vbak-vkorg,
s_vtweg for vbak-vtweg,
s_audat for vbak-audat,
s_vbeln for vbap-vbeln no-display.
start-of-selection.
perform select_vbak.
perform compute_vbeln_range.
perform select_vbap.
&----
*& Form select_vbak
&----
text
----
--> p1 text
<-- p2 text
----
form select_vbak.
select vbeln kunnr vkorg vtweg audat from vbak into corresponding
fields of table i_vbak_tab where kunnr in s_kunnr
and vkorg in s_vkorg
and vtweg in s_vtweg
and audat in s_audat.
if sy-subrc <> 0.
write:/ 'ERROR SELECTING DATA FROM VBAK'.
endif.
endform. " select_vbak
&----
*& Form compute_vbeln_range
&----
text
----
--> p1 text
<-- p2 text
----
form compute_vbeln_range.
s_vbeln-sign = 'I'.
s_vbeln-option = 'BT'.
sort i_vbak_tab by vbeln ascending.
read table i_vbak_tab index 1.
s_vbeln-low = i_vbak_tab-vbeln.
sort i_vbak_tab by vbeln descending.
read table i_vbak_tab index 1.
s_vbeln-high = i_vbak_tab-vbeln.
write:/ s_vbeln.
endform. " compute_vbeln_range
&----
*& Form select_vbap
&----
text
----
--> p1 text
<-- p2 text
----
form select_vbap.
select vbeln netpr netwr matnr spart vrkme waerk from vbap into
corresponding fields of table i_vbap_tab where vbeln in s_vbeln.
if sy-subrc <> 0.
write:/ 'ERROR SELECTING DATA FROM VBAP'.
endif.
endform. " select_vbap
I think you can take it on your own from here.
Thanks
Kathirvel
‎2005 Aug 28 3:43 PM
Raj, please reward points for helpful answers here as these guys have written your program for you. Next time, you might consider trying to code it yourself. You can learn a lot by doing this. Having others write the code for you does not teach you anything. If you need help with syntax and/or logic, you are welcomed to ask your questions here, but this is not really a code factory.
Thanks and welcome to SDN.
Regards,
Rich Heilman
‎2005 Aug 29 7:42 AM
Hi,
First define one intenal table as per your requirement,
you requirement can be fulfilled with VBAK and VBAP table.
SELECT-OPTIONS:
s_date FOR vbak-audat, "Date
s_vkorg FOR vbak-vkorg, "Sales Org
s_vtweg FOR vbak-vtweg, "Distribution channel
s_spart FOR vbak-spart, "Division
s_kunnr for vbak-KUNNR.
Data : Begin of Itab Occurs 0,
Vbeln like vbak-vbeln,
Posnr like vbap-posnr,
-
-
end of Itab.
select avbeln bposnr into table itab from
vbak as a inner join
vabp as b on avbeln = bvbeln
where a~audat in s_audat and
a~vkorg in s_vkorg and
a~vtweg in s_vtewg and
a~spart in s_spart and
a~kunnr in s_kunnr.
Hope this will help for u.
Cheers,
Sasi