cancel
Showing results for 
Search instead for 
Did you mean: 

about SAPSCRIPT-SUBRC

Former Member
0 Kudos

I've been asked to output the item text of a PO according the language, when there is French text in system, print out directly, if not ,print the English version as well,

i am in the French version of the SAPscript ,and the original code is :

INCLUDE &EKPO-EMATN& OBJECT MATERIAL ID BEST PARAGRAPH TX

then i changed to

INCLUDE &EKPO-EMATN& OBJECT MATERIAL ID BEST PARAGRAPH TX

IF &SAPSCRIPT-SUBRC& ne 0

INCLUDE &EKPO-EMATN& OBJECT MATERIAL ID BEST PARAGRAPH TX LANGUAGE 'E'

ENDIF

after that i opened the scipt debug to track ,it seems too strange that whether SAPSCRIPT-SUBRC equals 0 or not ,the second include command always runs out .

why there is no use of if condition

appreciate your help urgently

Accepted Solutions (0)

Answers (4)

Answers (4)

gherfurth
Discoverer

Note that the format of SAPSCRIPT-SUBRC seems to be character, not numeric.

That makes the actual value not 0 but ' 0'. Compare value in Sapscript debugger:

Test in IF statement like this and it should work:

IF &SAPSCRIPT-SUBRC& EQ ' 0'

Former Member
0 Kudos

Hi,

Why you are goin with sy-subrc instead of going with language option. as per anji solution better to check the language and based on that print the output.

i belive you got the point.

Hope this helps you. Reply for queries, shall post the updates.

Regards.

Kumar

Former Member
0 Kudos

Hi

You can use the condition based on the Logon language

for example

/: IF &SY-LANGU& = 'FR' (france)

/: INCLUDE &EKPO-EMATN& OBJECT MATERIAL ID BEST PARAGRAPH TX

/: ELSEIF &SY-LANGU& = 'EN'

/: INCLUDE &EKPO-EMATN& OBJECT MATERIAL ID BEST PARAGRAPH TX

LANGUAGE 'E'

/: ENDIF.

Reward points for useful Answers

Regards

Anji

Former Member
0 Kudos

Anji

i dont mean to display the text just according to the logon language ,because if there is no French version,i should output the English as well

Former Member
0 Kudos

Hi,

Did you give the IF condition as a control command...meaning did you give /:

Also try giving = 4 instead of NE 0

/: IF &SAPSCRIPT-SUBRC& = 4

/:INCLUDE &EKPO-EMATN& OBJECT MATERIAL ID BEST PARAGRAPH TX LANGUAGE 'E'

/:ENDIF

Thanks

Naren

Former Member
0 Kudos

Naren ,

it didn't work well to chang 0 to 4 ,all the result seems strange that if there are two INCLUDE, the If , endif can't work as expected.