Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

corret the coding

Former Member
0 Likes
532

hi to all,

please go through the below coding and everything is ok if im entertin data with select options..the problem is with if im entered data in parameters (ex: im selecting item category for a particular period it is giving all the list without considering the dates and customer)

can you link this both....in the programme the parameters are not linked ...tell me how can i do this....

Tables: vbap,vbak.

data: begin of wa.

include structure vbap.

data: end of wa.

data: begin of wa1.

include structure vbak.

data: end of wa1.

data: itab like standard table of wa with header line.

data: itab1 like standard table of wa1 with header line.

SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.

selection-screen begin of block 2 with frame.

select-options: s_audat for vbap-audat no-extension , "Document Date.

s_kunnr for vbak-kunnr no-extension. " DEFAULT '5525' .

selection-screen end of block 2.

selection-screen begin of block 3 with frame.

parameters : p_vtweg like vbak-vtweg. " Distribution channel.

parameters : p_vkorg like vbak-vkorg. " Sales Organisation.

parameters : p_pstyv like vbap-pstyv. " Item Category.

selection-screen end of block 3.

SELECTION-SCREEN END OF BLOCK blk1.

format intensified.

write: sy-vline, 'Material' color 3,sy-vline, 14 'Sales Ord' color 5,

sy-vline, 30 'Net Price' color 1, sy-vline, 44 'Unit' color 6,sy-vline,

54 'Currency' color 3, sy-vline, 66'Doc Date' Color 5,sy-vline, 84

'NetValue' color 7,sy-vline, 96 'Item Catg' color 1, 107 sy-vline.

format intensified off.

uline (107).

*select * from vbap into corresponding fields of table itab where pstyv

*in s_pstyv.

select * from vbap into corresponding fields of table itab where audat

in s_audat.

sort itab by vbeln.

select * from vbak into corresponding fields of table itab1 where kunnr

in s_kunnr.

sort itab1 by vbeln.

loop at itab1.

format color 2.

read table itab with key vbeln = itab1-vbeln.

if sy-subrc = 0.

wa = itab.

uline (107).

write: / sy-vline, wa-matnr, 13 wa-vbeln,23 wa-netpr,45 wa-vrkme,56

wa-waerk,72 wa-netwr,65 wa-audat, 97 wa-pstyv, 107 sy-vline.

endif.

format color off.

endloop.

uline (107).

advanced thanks,

raju

2 REPLIES 2
Read only

Former Member
0 Likes
378

Hi Raju,

When you post threads please check them work on the solutions given, and reward points if they are helpful. This thread is never check by you...

We all spend time to help you resolve your problem, but leaving it open with out checking it is something the SDN community doesn't want.

<b>The Solution is in the previous thread.</b>

Thanks

Kathirvel

Message was edited by: Kathirvel Balakrishnan

Read only

Former Member
0 Likes
378

Hi,

I already posted the solution,

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.

in that query you include all the necessary fields.

either you can use inner join as i mentioned above, or you can use for all entries also.

Cheers,

Sasi