2014 Feb 10 4:17 PM
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.
2014 Feb 11 2:02 AM
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
2014 Feb 10 4:31 PM
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,
2014 Feb 10 4:41 PM
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.
2014 Feb 10 4:50 PM
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
2014 Feb 10 4:52 PM
Can you inform the data passed in low and high? Can you inform too, the data returned witch is out of range?
2014 Feb 10 4:55 PM
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
2014 Feb 10 5:14 PM
CHARG is a character field of length10. The data that would be entering ranges between 1 to 99999.
2014 Feb 10 5:15 PM
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
2014 Feb 10 5:42 PM
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
2014 Feb 10 5:50 PM
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...
2014 Feb 11 1:14 AM
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.
2014 Feb 11 1:16 AM
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.
2014 Feb 11 2:02 AM
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
2014 Feb 11 2:21 AM
Hi Mohalkar,
For single values it is working. When giving ranges it is not picking as per the ranges.
BR.
2014 Feb 11 2:28 AM
One more suggestion.
For each entry in your SO, use the conversion exit.CONVERSION_EXIT_CHARG_INPUT
Regards
Abhi
2014 Feb 11 2:40 AM
2014 Feb 11 2:52 AM
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
2014 Feb 11 3:08 AM
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.
2014 Feb 11 3:12 AM
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
2014 Feb 11 3:35 AM
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.
2014 Feb 11 4:23 AM
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
2014 Feb 11 5:16 AM
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?
2014 Feb 11 5:25 AM
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