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

selection option

Former Member
0 Likes
735

hi all,

i have done MARC-PRCTR in selection screen

but while executing the report the extra values are also comming in report

For eg 100 to200 is range then it shows only this number in column and rest all is disable but the line items for rest all is displayed

what should i do to remove the disable line items.

below is the code for that (bold items are related to MARC-PRCTR)

-----------------------------------------------------------------------------------------------

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE title1.

SELECT-OPTIONS :s_vkorg FOR vbrk-vkorg,

                 s_werks FOR vbrp-werks,

                 s_vtweg FOR vbrk-vtweg,

                 s_spart FOR vbrk-spart,

*                s_vkgrp FOR vbrp-vkgrp,

                 s_vkbur FOR vbrp-vkbur,

                 s_vbeln FOR vbrk-vbeln,

                 s_prctr FOR marc-prctr,

                 s_charg FOR vbrp-charg.

SELECT-OPTIONS : s_dt FOR vbrk-fkdat OBLIGATORY.   "FOR sy-datum .

SELECTION-SCREEN END OF BLOCK b1.


DATA : v_cnt TYPE i,

          g_netprice TYPE kwert.

*********************** Changes in <culprit name removed by moderator> 20.06.2007***************

   SELECT a~vbeln a~fkart a~waerk a~vkorg a~vtweg a~kurrf a~kunrg a~spart a~fkdat

  a~netwr a~mwsbk a~knumv b~posnr b~fkimg b~matnr b~vkgrp b~vkbur b~aubel

   b~aupos

   b~vgbel b~vtweg_auft b~ntgew b~gewei b~werks

                             INTO TABLE it_sale

                             FROM vbrk AS a INNER JOIN vbrp AS b ON

                             a~vbeln = b~vbeln

                             WHERE a~fkdat IN s_dt

*                          AND a~vkorg IN s_vkorg

*                           OR b~werks IN s_werks

*                           OR a~vtweg IN s_vtweg

*                           OR a~spart IN s_spart

*                           OR a~vbeln IN s_vbeln

*                           OR b~vkbur IN s_vkbur

*                           OR b~charg IN s_charg    "added

*&--DEVK904894

****************************Edited by <culprit name and company removed by moderator>) on 04-01-2013 *****************************

                             AND a~fksto NE 'X'            "Cancelled

*                            AND ( a~vbtyp NE 'N'

*****************************End of editing *****************************************

     AND a~fkart NE 'S3'.

*&--DEVK904894

*                             or a~fkart NE 'S2'.

   DELETE it_sale WHERE vkorg NOT IN s_vkorg

                              OR werks NOT IN s_werks

                              OR vtweg NOT IN s_vtweg

                              OR spart NOT IN s_spart

                              OR vbeln NOT IN s_vbeln

                              OR vkbur NOT IN s_vkbur.

*********************************************************************

   SELECT matnr werks prctr

   INTO TABLE it_marc

   FROM marc

   FOR ALL ENTRIES IN it_sale

   WHERE prctr in s_prctr and matnr = it_sale-matnr and werks = it_sale-werks.

   SELECT knumv kposn kschl kbetr kwert FROM konv

                          INTO TABLE it_konv

                          FOR ALL ENTRIES IN it_sale

                          WHERE knumv EQ it_sale-knumv

                          AND   kposn EQ it_sale-posnr.

   SELECT matnr maktx

   INTO TABLE it_makt

   FROM makt

   FOR ALL ENTRIES IN it_sale

   WHERE matnr = it_sale-matnr AND

         spras EQ 'EN'.

   SELECT kunnr name1

   INTO TABLE it_kna1

   FROM kna1

   FOR ALL ENTRIES IN it_sale

   WHERE kunnr = it_sale-kunrg.

   SELECT * FROM tvkbt

   INTO TABLE it_tvkbt

   FOR ALL ENTRIES IN it_sale

   WHERE vkbur = it_sale-vkbur AND

         spras EQ 'EN'.

   SELECT * FROM tspat

   INTO TABLE it_tspat

   FOR ALL ENTRIES IN it_sale

   WHERE spart = it_sale-spart AND

         spras EQ 'EN'.

   SELECT * FROM tvgrt

   INTO TABLE it_tvgrt

   FOR ALL ENTRIES IN it_sale

   WHERE vkgrp = it_sale-vkgrp AND

         spras EQ 'EN'.

   SELECT * FROM vbkd

   INTO TABLE it_vbkd

   FOR ALL ENTRIES IN it_sale

   WHERE vbeln = it_sale-vbeln.

   SELECT * FROM tvtwt

   INTO TABLE it_tvtwt

   FOR ALL ENTRIES IN it_sale

   WHERE vtweg = it_sale-vtweg AND

         spras EQ 'EN'.

***Add by <culprit's name removed by moderator> on 07/10/2008

***Display of Doc Text as per the Billing Doc Type

   SELECT * FROM tvfkt

   INTO TABLE it_tvfkt

   FOR ALL ENTRIES IN it_sale

   WHERE fkart = it_sale-fkart AND

         spras EQ 'EN'.

***End by <culprit's name removed by moderator> on 07/10/2008

   SELECT matnr

          j_1ichid

          FROM j_1imtchid

          INTO TABLE it_chpt

          FOR ALL ENTRIES IN it_sale

          WHERE matnr = it_sale-matnr.

   DATA: l_count(4) TYPE c.

   DESCRIBE TABLE it_sale LINES l_count.

   IF l_count NE '0'.

     SELECT trntyp

            exnum

            rdoc

            status

            FROM j_1iexchdr

           INTO TABLE it_excise

            FOR ALL ENTRIES IN it_sale

           WHERE rdoc = it_sale-vbeln.

   ENDIF.

Message was edited by: Matthew Billingham - personal and professional information of the people responsible for this code removed to protect the guilty

Message was edited by: Matthew Billingham

5 REPLIES 5
Read only

matt
Active Contributor
0 Likes
693

Please use a meaningful subject in future. Also, if there are names of people and companies in the code, remove them. This is one of the worst pieces of code I've seen in a long while, so you need to protect the guilty!

The person who wrote it the first time didn't even understand how to construct the first SQL statement. It'll cost more to fix this than just re-write it. Frankly, throw this code away entirely and write something new from the original spec. It's so bad, it's not worth fixing.

But... if you insist.

That first select - uncomment all those "OR" conditions in the WHERE clause, and make them AND. Remove the egregious DELETE... WHERE.... Replace all the FAE with sensible INNER JOINS.

Then try to figure out what's wrong.

Read only

rosenberg_eitan
Active Contributor
0 Likes
693

Hi,

You also need to check if it_sale contain data.

  DELETE it_sale WHERE vkorg NOT IN s_vkorg

                              OR werks NOT IN s_werks

                              OR vtweg NOT IN s_vtweg

                              OR spart NOT IN s_spart

                              OR vbeln NOT IN s_vbeln

                              OR vkbur NOT IN s_vkbur.

check it_sale[] is not initial.

Regards.

Read only

Former Member
0 Likes
693

HI Nilesh,

Have analysed your code till the mentioned point and you need to do the shown changes -

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE title1.

SELECT-OPTIONS :s_vkorg FOR vbrk-vkorg,

                 s_werks FOR vbrp-werks,

                 s_vtweg FOR vbrk-vtweg,

                 s_spart FOR vbrk-spart,

*                s_vkgrp FOR vbrp-vkgrp,

                 s_vkbur FOR vbrp-vkbur,

                 s_vbeln FOR vbrk-vbeln,

                 s_prctr FOR marc-prctr,

                 s_charg FOR vbrp-charg.

SELECT-OPTIONS : s_dt FOR vbrk-fkdat OBLIGATORY.   "FOR sy-datum .

SELECTION-SCREEN END OF BLOCK b1.


DATA : v_cnt TYPE i,

          g_netprice TYPE kwert.

*********************** Changes in <culprit name removed by moderator> 20.06.2007***************

   SELECT a~vbeln a~fkart a~waerk a~vkorg a~vtweg a~kurrf a~kunrg a~spart a~fkdat

  a~netwr a~mwsbk a~knumv b~posnr b~fkimg b~matnr b~vkgrp b~vkbur b~aubel

   b~aupos

   b~vgbel b~vtweg_auft b~ntgew b~gewei b~werks

                             INTO TABLE it_sale

                             FROM vbrk AS a INNER JOIN vbrp AS b ON

                             a~vbeln = b~vbeln

                             WHERE a~fkdat IN s_dt

*                          AND a~vkorg IN s_vkorg

                          OR AND b~werks IN s_werks

                          OR AND a~vtweg IN s_vtweg                          

OR AND a~spart IN s_spart                         

OR AND a~vbeln IN s_vbeln                          

OR AND b~vkbur IN s_vkbur                         

OR AND b~charg IN s_charg    "added

*&--DEVK904894

****************************Edited by <culprit name and company removed by moderator>) on 04-01-2013 *****************************

                             AND a~fksto NE 'X'            "Cancelled

*                            AND ( a~vbtyp NE 'N'

*****************************End of editing *****************************************

     AND a~fkart NE 'S3'.

*&--DEVK904894

*                             or a~fkart NE 'S2'.

   DELETE it_sale WHERE vkorg NOT IN s_vkorg

                              OR werks NOT IN s_werks

                              OR vtweg NOT IN s_vtweg

                              OR spart NOT IN s_spart

                              OR vbeln NOT IN s_vbeln

                              OR vkbur NOT IN s_vkbur.

*********************************************************************

if it_sale is not initial.

   SELECT matnr werks prctr

   INTO TABLE it_marc

   FROM marc

   FOR ALL ENTRIES IN it_sale

   WHERE prctr in s_prctr and matnr = it_sale-matnr and werks = it_sale-werks.

endif.

BR.

Read only

Former Member
0 Likes
693

thnks for rply sir,

but the where condition in select is already in comment.

Read only

matt
Active Contributor
0 Likes
693

So uncomment it.