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

Is this a correct if.. else.. statement using in Call Function?

Former Member
0 Likes
699

Hi All,

Is this a correct way by using IF and ELSE statement to call the function call?

IF SY-LANGU = 'N'.

l_header = 'Vennligst '(007).

l_txtques = 'Er du sikker '(008).

ELSEIF SY-LANGU = 'E'.

l_header = 'PLEASE SELECT REASON'(006).

l_txtques = 'Are you sure want to enter reason code?'(004).

ENDIF.

DO.

CALL FUNCTION 'POPUP_TO_DECIDE_LIST'

EXPORTING

mark_flag = ' '

mark_max = 1

start_col = 80

start_row = 5

textline1 = l_header

titel = 'REASON FOR CHANGE'(002)

IMPORTING

answer = l_ans

TABLES

t_spopli = i_spopli

EXCEPTIONS

not_enough_answers = 1

too_much_answers = 2

too_much_marks = 3

OTHERS = 4.

Thanks in advance.

Regards,

Alice

4 REPLIES 4
Read only

JackGraus
Active Contributor
0 Likes
646

It will work and syntactically it is correct but better would be something like:

*IF SY-LANGU = 'N'.
 l_header = 'Vennligst '(007).
 l_txtques = 'Er du sikker '(008).
 
*ELSEIF SY-LANGU = 'E'.
* l_header = 'PLEASE SELECT REASON'(006).
* l_txtques = 'Are you sure want to enter reason code?'(004).
* ENDIF.

Then translate the texts 007 and 008 into language 'N' and 'E'. You can do that in transaction SE38 with 'Goto -> Translation'.

The benefit is cleaner, shorter coding and the ability to possibly translate into more languages winthout changing the coding.

Regards Jack

Read only

Former Member
0 Likes
646

Hi Jack

what do I need to include in the temporary worklist after I selected SE38 -> Goto -> translation ?

Thanks.

Read only

JackGraus
Active Contributor
0 Likes
646

Hi, when you go to translation you translate texts from the original langauge into the required languages. So you need to translate to 'E' ('EN') and 'N' ('NL') for texts 007 and 008.

Not sure what 2 languages you need here. 'N' is the SAP internal language code length 1 for 'NL' (Dutch). But you might need 'O' here. 'O' is the SAP internal language code length 1 for 'NO' (Norwegian).

Regards Jack

Read only

Kiran_Valluru
Active Contributor
0 Likes
646

Hi.,

SY-LANGU will return 2 char ., ie if logon language is English it will return EN not E.,

so u have to use

IF SY-LANGU = 'EN'.

hope this helps u.,

Thanks & Regards

Kiran