Application Development 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: 

Abnormal behaviour of SAPScript form

former_member220801
Participant
0 Kudos
171

I have set the format of a field that shown in the form to underlined. When I am using font 'Courier', it looks fine. But when I changed time new romans, the underlined output became broken i.e. only the words are underlined but the space is not...e.g. <u>United Kingdom</u>, the space in between United and Kingdom do not being underlined. Can anyone please help?

Besides, if I want to change the output of number to word, e.g. 100 -> One hundred, the only way to do so is to translate in the program and then pass it to the form?

Can I translate it in the SAPScript form?

Thanks for your reply!

1 ACCEPTED SOLUTION

sridhar_k1
Active Contributor
0 Kudos
104

Are you using SAP printer defined with PCL device type, check it in SPAD, I've seen it happen with PCL device type, but POST2 device type prints the underline fine.

Check oss note 379075, descripbes similar issue with kyocera device type.

There's no sapscript command to covert number to word, you've to do it in print program or call a perform from sapscript to do that.

Regards

Sridhar

8 REPLIES 8

Former Member
0 Kudos
104

hi gundam,

I want to change the output of number to word, e.g. 100 -> One hundred, the only way to do so is to translate in the program and then pass it to the form?

Can I translate it in the SAPScript form?

for this write a Perform in the Sapscript and in the driver program write the code..

form...

call the FM SPELL_AMOUNT

endform...

hope this helps,

priya.

sridhar_k1
Active Contributor
0 Kudos
105

Are you using SAP printer defined with PCL device type, check it in SPAD, I've seen it happen with PCL device type, but POST2 device type prints the underline fine.

Check oss note 379075, descripbes similar issue with kyocera device type.

There's no sapscript command to covert number to word, you've to do it in print program or call a perform from sapscript to do that.

Regards

Sridhar

0 Kudos
104

I would like to ask how to call a function in SAPScript which exists in the printing program?

I have written a function in the printing program.


FORM sub_spell_amount USING VALUE(amount).
  DATA: word TYPE spell.

  CALL FUNCTION 'SPELL_AMOUNT'
    EXPORTING
      AMOUNT          = amount
      CURRENCY        = 'HKD'
      FILLER          = ' '
      LANGUAGE        = SY-LANGU
    IMPORTING
      IN_WORDS        = word
    EXCEPTIONS
      NOT_FOUND       = 1
      TOO_LARGE       = 2
      OTHERS          = 3.
  IF SY-SUBRC <> 0.
*   MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*           WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    WRITE 😕 sy-subrc.
  ELSE.
    IF word-decword = 'ZERO'.
      amt = word-word. "amt is a global variable
    ELSE.
      CONCATENATE word-word ',' word-decword
             INTO amt.
    ENDIF.
  ENDIF.
ENDFORM.

In the main window of the SAPScript form, I call the command

/: PERFORM SUB_SPELL_AMOUNT USING '100'.

  • &amt&

However, nothing can be displayed.... Do I mis-understand your meaning? Thanks!

0 Kudos
104

Hi Gundam,

In the sapscript form

use

/:PERFORM GET_DATA IN PROGRAM Ztest

/:USING &amt&

/:CHANGING &word&

/:ENDPERFORM

where ZTEST is your print program name

0 Kudos
104

I really got frustrated... I have followed the instructions that given... but still can't do it... Is there something wrong with my codes?

My printing program (ZTEST):


REPORT  ZTEST.

DATA: amt_word(100) VALUE 'aa'.
DATA: amt LIKE bseg-wrbtr VALUE '100.00'.

START-OF-SELECTION.

END-OF-SELECTION.
  CALL FUNCTION 'OPEN_FORM'
    EXPORTING
      FORM      = 'ZTEST01'
      LANGUAGE  = SY-LANGU.

  CALL FUNCTION 'WRITE_FORM'
    EXPORTING
      ELEMENT   = 'HEADER'
      WINDOW    = 'MAIN'.

  CALL FUNCTION 'CLOSE_FORM'.

FORM sub_amt
   USING VALUE(amount) LIKE bseg-wrbtr.

  DATA: l_word TYPE spell.

  CALL FUNCTION 'SPELL_AMOUNT'
    EXPORTING
      AMOUNT          = amount
      CURRENCY        = 'HKD'
      FILLER          = ' '
      LANGUAGE        = 'E'
    IMPORTING
      IN_WORDS        = l_word
    EXCEPTIONS
      NOT_FOUND       = 1
      TOO_LARGE       = 2
      OTHERS          = 3.

  IF l_word-decword = 'ZERO'.
    amt_word = l_word-word.
  ELSE.
    CONCATENATE l_word-word ',' l_word-decword
           INTO amt_word.
  ENDIF.
ENDFORM.

My code in the main window of my SAPScript form (ZTEST01)


/E   HEADER
/:   PERFORM SUB_AMT IN PROGRAM ZTEST
/:   USING &AMT&
/:   CHANGING &AMT_WORD&
/:   ENDPERFORM
*    Hello world 1!

But I got short dump when I execute it.... really need your help. Thanks!

0 Kudos
104

Hi Gundam,

change at the places

FORM sub_amt changing amount LIKE bseg-wrbtr.

/E HEADER

/: PERFORM SUB_AMT IN PROGRAM ZTEST

/: changing &amt&

/: ENDPERFORM

  • Hello world 1!

/: &amt_word&

even if you are getting dump then send the dump analysis

0 Kudos
104

You are really a nice guy!

But I still get short dump even I have made the changes you mentioned.

The dump is

Too many parameters specified with PERFORM.

<u>What happened?</u>

In a subroutine call, there were more parameters than in the routine definition.

Error in ABAP application program.

The current ABAP program "SAPLSTXC" had to be terminated because one of the statements could not be executed.

This is probably due to an error in the ABAP program.

<u>Error analysis</u>

An exception occurred. This exception is dealt with in more detail below. The exception, which is assigned to the class 'CX_SY_DYN_CALL_PARAM_NOT_FOUND', was neither

caught nor passed along using a RAISING clause, in the procedure "CO_ENDPERFORM" "(FORM)".

Since the caller of the procedure could not have expected this exception to occur, the running program was terminated.

The reason for the exception is:

A PERFORM was used to call the routine "CO_ENDPERFORM" of the program "SAPLSTXC".

This routine contains exactly 1 formal parameters, but the current call contains 4 actual parameters.

parameters.

But when I changed to

/E HEADER

/: PERFORM SUB_AMT IN PROGRAM ZTCTEST08 CHANGING &AMT&

/: ENDPERFORM

  • Hello world 1!

  • &AMT_WORD&

There is no error, but it gave

Hello word 1!

aa <- the original value of amt_word

It seems that the function is not executed.

0 Kudos
104

hi gundam,

ur form should be like this

/: PERFORM MY_FORM IN PROGRAM ZPROGRAM

/: USING &VAR1&

/: USING &VAR2&

/: USING &VAR3&

/: .............

/: USING &VARN&

/: CHANGING &VAR_OUT1&

/: ................

/: CHANGING &VAR_OUTN&

The interface of the form has to be:

FORM MY_FORM tables in_tab structure itcsy

out_tab structure itcsy.

  • Get value of VARN

data: varn like ....

read table in_tab with key name = 'VARN'.

if sy-subrc = 0.

move in_tab-value to varn.

endif.

  • Update the value of VAR_OUTN

read table out_tab with key name = 'VAR_OUTN'.

if sy-subrc = 0.

move <value> to ot_tab-value.

modify out_tab index sy-tabix.

endif.

ENDFORM.

check this also....

http://help.sap.com/saphelp_erp2005/helpdata/en/d1/803279454211d189710000e8322d00/frameset.htm