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

Select statement error.

senthil_kumar29
Participant
0 Likes
2,270

Hello Friends,

I am using a select statement to fetch Bill to Party No. from KNVP table. Here is the select statement.

SELECT SINGLE kunn2 FROM knvp INTO y_kunn2

WHERE kunnr = vbrk-kunag and parvw = 'BP'. " c_bp.

Even though I could able to select with the same value in data dictionary, but in program this statement does not bring the record.

Thank U for ur time.

Cheers,

Sam

10 REPLIES 10
Read only

Former Member
0 Likes
1,609

Hi

try to fetch the same Partner function from VBPA table

Pass the VBRP-AUBEL(sales order No) for this table VBPA and pass the partner function 'BP' you will get the required partner function.

regards,

Anji

Message was edited by:

Anji Reddy Vangala

Read only

Former Member
0 Likes
1,609

Hi,

This code will work only if u have an internal table VBRK and a field in it as kunag and then loop into it and inside the loop place this select statement. Else the other option is

SELECT * from VBRK into VBRK.

SELECT SINGLE kunn2 FROM knvp INTO y_kunn2

WHERE kunnr = vbrk-kunag and parvw = 'BP'.

IF SY_SUBRC = 0.

ENDIF.

ENDSELECT.

If u have done similar thing, then plz paste ur complete code...

Cheers,

Sam

Read only

0 Likes
1,609

Hi, I am bringing the correct value in vbrk-kunag.

I think I need to use some conversion exits.

Cheers,

Sam

Read only

Former Member
0 Likes
1,609

Check if vbrk-kunag has the leading zeroes , if not try this

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    INPUT  = vbrk-kunag 
  IMPORTING
    OUTPUT = vbrk-kunag.

SELECT SINGLE kunn2 FROM knvp INTO y_kunn2
WHERE kunnr = vbrk-kunag and parvw = 'BP'.

Read only

0 Likes
1,609

Hi,

I have used the conversion exit.. but to my wonder its a simplest of the select statements.. still it does not bring the record.

Cheers,

Sam

Read only

Former Member
0 Likes
1,609

Hi Sam,

The problem is not with the inputs you are giving the problem is with the format of KUNNR in KNVP and VBRK-KUNAG.

To solve this issue you need to use the conversion exit before the select query to get the records.

use foolowing conversion exit


CONVERSION_EXIT_ALPHA_INPUT

Regards,

Kunjal

Read only

Former Member
0 Likes
1,609

Hi,

There seems to be a problem with the kunnr value you are using ..

So, you may try it like kunnr = '0000345' checking it out in the dictionary the field length .

Once this is diagnosed , u can use CONVERSION_EXIT_ALPHA_INPUT to add zeros in the beginning.

Pls reward if useful.

Regards,

Shweta

Read only

Former Member
0 Likes
1,609

use FM CONVERSION_EXIT_ALPHA_INPUT


CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    INPUT  = knvp-kunnr 
  IMPORTING
    OUTPUT = knvp-kunnr.

Regards,

Santosh

Read only

former_member378318
Contributor
1,609

Don't use PARVW = 'BP', there is a conversion exit on PARVW. Try using PARVW = 'RE'

You can see the unconverted value using SE16N by double clicking on the row.

Read only

Former Member
0 Likes
1,609

The problem is with the parvw = 'BP' input.

While fetching data using a select query you must provide the internal partner function which is mapped with BP i.e. RE. You can pass RE directly by hardcoding it in your code or else you can use CONVERSION_EXIT_PARVW_INPUT Function Module by passing BP as an input and getting RE as an output.

Reward if it was helpful for you.

Thanks and Regards,

Basim Wangde