cancel
Showing results for 
Search instead for 
Did you mean: 

don't get the right langu-key

kaiser_michael
Explorer
0 Kudos

Hello,

I got a problem to query the proper language in my smartform so I can print my delivery cards either in German or in English - dependend what customer it is.

This code delivers 'd' (German) but it's an British customer:

select single langu
      into gv_langu
      from adrc
      where DATE_FROM lt sy-datum
      and addrnumber eq ps_vbpa-adrnr.

Table 'adrc' actually got 'd' instead of 'e' in 'langu'.

Tried to fix it in XD03 (customer, general data). In the tab 'Address' I found 'Language'='German' in topic 'Communication'. Changed it to English but it didn't work out. adrc-langu still shows 'd'.

Where's the field to put the right language?

How do I get the right language key at all? Is it the wrong way I'm going (code)?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

It is recommended to use all key field when you are going to use select single ..

As I can see, NATION is also key field in table ADRC ..

so must have to pass NATION field value in the select query ..

Like below:

select single langu 
      into gv_langu 
      from adrc 
      where DATE_FROM lt sy-datum 
      and addrnumber eq ps_vbpa-adrnr 
      and NATION = ADRC-NATION . " ---> Pass the field value

But from the functional part .. I am not aware from where you can fix it.

Edited by: Lokesh Tarey on Jul 20, 2010 11:59 AM

kaiser_michael
Explorer
0 Kudos

Thanks, I will consider it but as you said unfortunately it doesn't solve my problem.

Former Member
0 Kudos

what about goinf for KNA1-SPRAS?

this should be the communication language of your customer.

Former Member
0 Kudos

I'm stuck!

For sure a simple beginner mistake but I can't figure out.

select single spras
      into gv_langu
      from kna1
      where v_kunnr eq kunnr
      and DATE_FROM lt sy-datum
      and DATE_to gt sy-datum.

That code gives me an error ('Field v_kunnr unknown').

v_kunnr is defined in 'Global Definition' and it got filled before it gets an

'Input Parameters' of the mentioned code.

It's even used one step later in an 'Alternative'.

What's going wrong?

Former Member
0 Kudos

holy cow, almost everything is going wrong here.

You might want to place your cursor over SELECT and press F1.

at first you have switched v_kunnr and kunnr. It seems you did not have done too much select statements before, but well we all learn.

at second, you didnt bother to check KNA1 in SE11. You might had noticed that this table has no field like "Date_from" and "Date_to".

in my eyes you overflew this thread, didnt take your time to read and understand it and then tried to make up something of your own, while you could have solved all this problems by just using F1 help and SE11.

My advice would be to take at least TAW10/12 courses at SAP before you start programming ABAP.

regards

kaiser_michael
Explorer
0 Kudos

That's it, thank you.

I switched v_kunnr and kunnr and deleted the last 2 rows. As I said, an 'easy one'.

Now I don't get any errors.

Yes, I blindly took Selvakumar Krishnans code and modified it with the KNA1-table. Guilty!

I looked into KNA1 but didn't regard the other fields.

ABAP training is quite some time ago (few years) and if you are in a 2-men department and you're not doing this all the time you start to forget.

Thank you again for helping me out what would have cost me a lot of time and nerves.

Consider it as easy earned points.

Best Regards.

Former Member
0 Kudos

No offense

it seems i´m just having a bad day and lost temper a bit. But still, you are a developer, and so you NEED to make use of your brain from time to time

regards

kaiser_michael
Explorer
0 Kudos

Sometimes using my brain doesn't work out.

have a nice day.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

It should be updated in the ADRC table. Could you please add the field date_to in the select statement and in the sequence as below:

select single langu

into gv_langu

from adrc

where addrnumber eq ps_vbpa-adrnr

and DATE_FROM lt sy-datum

and DATE_to gt sy-datum. -


> Add this field also.

Reason, we can have different version number of address in different validity period.

If you just want the communication language, then you can check with the field KNA1-SPRAS.

Regards,

Selva K