Skip to Content
avatar image
Former Member

Sapscript Help

Hello experts,

I am printing PO sapcript by modifying z-medruck sapscript in our project.The driver program is the standard PO program.

We are printing amount inwords in Main Window.

For printing the same, I have created a paragraph format TL which have 2 tab with 18 and 58 char each.

In the editor, it is as follows:

-


TL Total net val. in words in &EKKO-WAERS& :,,&L_V1WORDS& Rupees

&L_V2WORDS& Paise

-


When i am printing, output is as follows:

Total net val. in words in INR: TEN MILLION HUNDRED NINETY-SEVEN THOUSAND

Rupees SEVENTY-FIVE paise.

But the user need output as follows:

Total net val. in words in INR: TEN MILLION HUNDRED NINETY-SEVEN THOUSAND

Rupees SEVENTY-FIVE paise.

I cannot put delimiter as I do not know at what point the output goes to the next line.

I tried using std para formats for the subsequent line like =, space, / etc but I am not able to get the reuuired output.

Kindly suggest me with some solution.

Regards,

Anil.

Moderator message: please use more descriptive subject lines from now on.

Edited by: Thomas Zloch on Sep 16, 2010 9:48 AM

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

7 Answers

  • avatar image
    Former Member
    Sep 16, 2010 at 07:23 AM

    Small change...

    But the user need output as follows:

    Total net val. in words in INR: TEN MILLION HUNDRED NINETY-SEVEN THOUSAND

    -


    space----


    Rupees SEVENTY-FIVE paise.

    Regards,

    Anil.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 16, 2010 at 11:39 AM

    Hi,

    Currently you are using one tab in your code.You can use the second tab at the desired place where the space is required with the requested length. Try it.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 16, 2010 at 04:15 PM

    Hi,

    Could you let me know one thing that, in which place the amount would be displayed in main window (like will it be displayed alone / inbetween some values / how it is displaying)?, and will it be displaying in that same place always? or will it move up or down or some other page at sometimes? And if possible please attach one snapshot.

    Please let me know, and i give solution.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      @ Sheik

      The amount in words is in main window and it comes after all the item details are displayed.

      It is diaplayed after that amount in figures.The position of the element is not fixed.

      @Harikrishna

      I cannot put tab space since if the value of the amount is too big the entire alignment gets disturbed.

      Kindly suggest something.

      Regards,

      Anil.

  • avatar image
    Former Member
    Sep 17, 2010 at 07:05 AM

    Hi,

    I think there will not be any alignment issue, if you use tab. Because you will define the required space positions in the tab.

    Try it once.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      I do not know where the line break will take place.

      If the amount is small it will be printed on single line but if the amount is huge, then the overflow can occur at any place and therefore I cannot put a tab at any fixed place. Because if I put a tab at fixed palce and if amount is small then also the tab space will be present on a same line.I have already tried that.

      Regards,

      Anil.

  • avatar image
    Former Member
    Sep 17, 2010 at 08:55 AM

    Hi,

    you can do one thing, create a paragraph format with one tab, then create one subroutine and pass the amount in word as an using param, try to use 4 to 5 changing params to get wrapped text, then disply the result with tab, it will work for sure, if you not able to understand this description then just refer the below code snippets,

    /: DEFINE &AMOUNT& = &L_V1WORDS& Rupees &L_V2WORDS& Paise

    /: DEFINE &FIRST_LINE& = ''

    /: DEFINE &SECON_LINE& = ''

    /: DEFINE &THIRD_LINE& = ''

    /: DEFINE &FOURT_LINE& = ''

    /: DEFINE &FIFTH_LINE& = ''

    /: PERFORM <SUB ROUTINE> IN PROGRAM <PROGRAM>

    /: USING &AMOUNT&

    /: CHANGING &FIRST_LINE&

    /: CHANGING &SEON_LINE&

    /: CHANGING &THIRD_LINE&

    /: CHANGING &FOURT_LINE&

    /: CHANGING &FIFTH_LINE&

    /: ENDPERFORM

    /: IF &FIRST_LINE& NE ''

    <P> Total price in word &WAKERS&: ,,&FIRST_LINE&

    /: IF &SECON_LINE& NE ''

    <P> ,,&SECON_LINE&

    /: IF &THIRD_LINE& NE ''

    <P> ,,&THIRD_LINE&

    /: IF &FOURT_LINE& NE ''

    <P> ,,&FOURT_LINE&

    /: IF &FIFTH_LINE& NE ''

    <P> ,,&FIFTH_LINE&

    /: ENDIF

    /: ENDIF

    /: ENDIF

    /: ENDIF

    /: ENDIF

    Notes:- <P> Paragraph format which having one tab key

    -


    <PROGRAM>

    FORM <SUBROUTINE> TABLES IN_PAR STUCTURE ITCSY OUT_PAR STRUCTURE ITCSY.

    READ AMOUNT

    PASS AMOUNT TO FM "RKD_WORD_WRAP" (this is not yet released version, you can use else choose other fm with this functionality)

    GET INTERNAL TABLE, which will have wrapped text

    ASSIGN each row to one variable, then pass back to SAP Script

    ENDFORM.

    Thats all dude. If you find any other best solution please share with me:)

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Sep 21, 2010 at 03:43 AM

    Hi,

    Will this text always appear in the same position on your output page? If so, why not create 2 windows; one to hold the "Total net val. in words in INR:" literal and another window to contain the written amount value. This second window would be aligned with the end of the fixed literal and, any text within it should naturally wrap with correct alignment.

    Regards, Andy

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Birendra Chatterjee

      Hi,

      I too had thought abt using d same logic of splitting it with fixed characters according to fixed length of the form.

      But if I do so, der can be a problem of word splitting too.

      Suppose if the line break occurs at 40 char and if the word around 40th character is seventy-five

      then it may happen the output would be 'SEV' on d 1st line and then next line where it will print 'ENTY-FIVE' which the user

      don't want. There will be no hyphen between SEV nad ENTY.

      I hope u understood d problem.

      Regards,

      Anil.

  • avatar image
    Former Member
    Sep 21, 2010 at 11:14 AM

    Hi Anil,

    If your variables are global in your print program (ie. the field which contains the "TEN MILLION HUNDRED NINETY-SEVEN THOUSAND Rupees SEVENTY-FIVE paise" value, then you could create CONSTant (fixed) windows and they should automatically get output when the form is called.

    If your number (text format) is not global then you may be able to get away with DEFINEing a variable in the new window (to contain the text), then PERFORM an ABAP routine, USING the numeric field and using ABAP code to generate the number (in words).

    Regards, Andy

    Add comment
    10|10000 characters needed characters exceeded