Application Development 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: 

Issue with the Select-Options - Batch Field

former_member207873
Participant
0 Kudos

Hi Experts,

I am facing a strange issue with the select-option field with BATCH number.  This is my join statement.

SELECT VBRK~FKDAT

         VBRK~SPART

         VBRK~NETWR

         VBRK~KUNAG

         VBRK~KUNRG

         VBRK~SFAKN

         VBRP~VBELN

         VBRP~VKBUR

         VBRP~POSNR

         VBRP~MATNR

         VBRP~ARKTX

         VBRP~FKIMG

         VBRP~VRKME

         VBRP~VGBEL

         VBRP~VGPOS

         LIPS~POSNR

         LIPS~VBELN

         LIPS~LFIMG

         LIPS~CHARG

         LIPS~PSTYV

         INTO TABLE IT_VBRK2

         FROM VBRP JOIN VBRK ON VBRP~VBELN = VBRK~VBELN

                     JOIN LIPS ON VBRP~VGBEL = LIPS~VBELN

                   AND VBRP~MATNR = LIPS~MATNR

         WHERE     VBRK~FKDAT IN SO_FKDAT

               AND VBRP~MATNR IN SO_MATNR

               AND VBRP~VKBUR IN SO_VKBU2

               AND VBRP~VBELN IN SO_VBELN

               AND VBRK~KUNAG IN SO_KUNAG

               AND VBRP~SPART IN SO_SPART

               AND LIPS~CHARG IN SO_CHARG.



But the select-options is not working when CHARG is given in range. But for individual values it is working. I wrote a simple select query to study the issue as below.


DATA: W_CHARG TYPE LIPS-CHARG.

SELECT-OPTIONS: SO_MCHA FOR W_CHARG.

TYPES: BEGIN OF TY_LIPS,

        CHARG TYPE MCHA-CHARG,

   END OF TY_LIPS.

   DATA: IT_LIPS TYPE STANDARD TABLE OF TY_LIPS,

         WA_LIPS LIKE LINE OF IT_LIPS.

SELECT CHARG FROM LIPS INTO TABLE IT_LIPS WHERE CHARG IN SO_MCHA.

   LOOP AT IT_LIPS INTO WA_LIPS.

     WRITE: / WA_LIPS-CHARG.

     ENDLOOP.

But then also CHARG is not showing as per the values given in the select-options. It is showing superfluous values also. Any thoughts on this?

BR.


1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Can you attach screen shots for a single batch?

Show the batch screenshot in batch master, passing the batch in SE16N and the results in same t-code and finally actual VBELN having that batch in Display Invoice.

This will make things lot clear.

Regards

Abhi

22 REPLIES 22

balbino_soaresferreirafil
Active Participant
0 Kudos

I am not sure about your error... Your problem is the select statement return charge values not passed in select-options?

How do you passed values to select-options? Do you inform low and high fields? Is using single value, between values, list of values?

Can you inform the data passed in select-options?

Regards,

0 Kudos

Hi Balbino,

I am passing select-options with the low and high values.  But the output also shows values which do not fall in this range.

BR.

0 Kudos

Hello BR,

Did you check LIPS table whether any CHARG value exists or not? If you check with blank in selection screen then data is populating.

Thanks & Regards,

Abhijit

0 Kudos

Can you inform the data passed in low and high? Can you inform too, the data returned witch is out of range?

0 Kudos

Yes Abhijith, there is data in the LIPS table. If I run without any value in CHARG field all the batches are getting fed.

BR

0 Kudos

CHARG is a character field of length10. The data that would be entering ranges between 1 to 99999.

0 Kudos

Hi

What did you supplied in the batch range value. Did you Cross check whether for the LIPS entries for Batch you have any entries in VBRP table

Nabheet

0 Kudos

Hello,

Try below it is working. So, there is some restrictions as Nabheet as said. You need to check VBRP table.

DATA: w_charg TYPE lips-charg.

SELECT-OPTIONS: so_mcha FOR w_charg.

TYPES: BEGIN OF ty_lips,

         charg TYPE mcha-charg,

    END OF ty_lips.

DATA: it_lips TYPE STANDARD TABLE OF ty_lips,

       wa_lips LIKE LINE OF it_lips.

SELECT charg FROM MCH1 INTO TABLE it_lips WHERE charg IN so_mcha.

LOOP AT it_lips INTO wa_lips.

   WRITE: / wa_lips-charg.

ENDLOOP.


Thanks & Regards,


Abhijit

0 Kudos

I simulated the error in my environment and do the same error. It is because the CHARG is character field. Because this it´s not select correct values, using fields with numeric values.

This error occurs inclusive in se16 transaction.

Try to complete the fields with zeros 0 before the select statement.

For example, not pass 1 to 9999.... pass 0000000001 to 0000099999.


But I think the best way is check VBRP table... for performance reasons...

0 Kudos

Hi

Suppose I have given the batch range as below.

I am getting data which do not fall between this range.

I checked the record with batch number 356688, and there is record with the same VBELN in VBRP.

NB: I have checked in LIPS table in SE16N and gave batch range. It is showing data which do not fall in between the range. Can you please check in your system. So is it a standard behaviour?

BR.

0 Kudos

Hi Balbino,

I checked with the leading zeroes in my report as well as in the database table. In both scenarios it is not giving the expected result.

BR.

Former Member
0 Kudos

Hi,

Can you attach screen shots for a single batch?

Show the batch screenshot in batch master, passing the batch in SE16N and the results in same t-code and finally actual VBELN having that batch in Display Invoice.

This will make things lot clear.

Regards

Abhi

0 Kudos

Hi Mohalkar,

For single values it is working. When giving ranges it is not picking as per the ranges.

BR.

Former Member
0 Kudos

One more suggestion.

For each entry in your SO, use the conversion exit.CONVERSION_EXIT_CHARG_INPUT

Regards

Abhi

0 Kudos

Tried with leading zeroes. But still not working.

0 Kudos

Hi,

Precisely for this reason I am requesting screenshot so that I can see in the field and the value passed and actual data holding that batch number.

I suggest using the conversion routines as well. Batch is 10 characters field, so you need append 0 for characters that are blank. So if your batch has 2 characters then ad 8 times 0, when batch no crosses 99, append only 7 0. Code snippet for your reference.

data t_batch type charg_d.

data:  ls_lips type lips,

       lt_lips type STANDARD TABLE OF lips.

SELECT-OPTIONS s_batch for t_batch.

if not s_batch is INITIAL.

  loop at s_batch.

      CALL FUNCTION 'CONVERSION_EXIT_CHARG_INPUT'

      EXPORTING

        input         = s_batch-low

      IMPORTING

       OUTPUT        = s_batch-low              .

    modify s_batch.

  endloop.

endif.

Regards

Abhi

0 Kudos

I have posted screen shots above. If it is regarding the select options declaration you are asking, I have typed it with LIPS-CHARG

Select-options: SO_CHARG FOR LIPS-CHARG.

I do not understand the screen shot you are asking.

0 Kudos

Hi,

I am assuming the screenshots are of your report.

I want to see screen shots of SE16N, where you pass the data(with leading 0) and see the result.

and VL02N.

Regards

Abhi

0 Kudos

Hi Abhi,

Here I am passing values with leading zeroes.

The result I am getting is ''No value available".

Then I am passing without leading zeroes.

I am getting data which do not fall in the range also.

BR.

0 Kudos

Hi,

I think, in the tables batches are stored without leading 0 is that correct? If so, adding leading 0 will not help as per my experience.

In the second screen shot, the column you have displayed is of batches or invoices?

If you enter without leading zero, if you are getting invalid data as well, please check the documents again, somewhere there has to be a link or it can be a data consistency

Regards

Abhi

0 Kudos

Yes in database table it is being stored without leading zeroes. The coloumn screen shot is that of batches. So you mean this is data inconsistency? In that case what can be done?

0 Kudos

Hi,

Data inconsistency is just my guess based on the information that if pass range (for example)of batch no.1 to 10, it shows data with batch no 20,25 as well. In my experience and even if considering any database, why this should happen? Why should it return such values? I tried in my system and if I add leading zeros it works perfectly well. I doubt if there is a bug in SAP code.In that case many would have experienced this. In fact,I think it is a good idea to check your SELECT query.Sorry I totally forgot to consider that. Just check whether the values returned in your code fall under ANY other criteria mentioned in query.

Regards

Abhi