cancel
Showing results for 
Search instead for 
Did you mean: 

Sapscript Help

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Andy,

Thanx for d suggestion.

I cannot create a new window since the driver program is a std PO program.

If I create a new window how would I call it.

Kindly suggest changes in script.

Regards,

Anil.

birendra_chatterjee
Active Participant
0 Kudos

Below is the solution...

Concatenate L_V1WORDS 'Rupees' L_V2WORDS 'Paise' into some variable separated by space (XYZ, say).

Based on the font size You are using, check at most how many characters of amount can fit in the first line. (I think this You should already be aware off). Say this is 40.

Use function module RKD_WORD_WRAP, pass the amount (XYZ) in TEXTLINE, 40 in OUTPUTLEN, and

retrieve the splitted words in table OUT_LINES.

Say the entire amount (XYZ) is now splitted into variables XYZ1, XYZ2, XYZ3 and XYZ4.

Now You can print like:

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

/: IF &XYZ2& NE ' '

TL ,,&XYZ2&

/: ENDIF

/: IF &XYZ3& NE ' '

TL ,,&XYZ3&

/: ENDIF

/: IF &XYZ4& NE ' '

TL ,,&XYZ4&

/: ENDIF

Remember, the entire logic needs to be built, in a subroutine in subroutine pool which you need to call from the SAPSCRIPT. (As You are using Standard SAP Program).

Rgds,

Birendra

birendra_chatterjee
Active Participant
0 Kudos

Below is the solution...

Concatenate L_V1WORDS 'Rupees' L_V2WORDS 'Paise' into some variable separated by space (XYZ, say).

Based on the font size You are using, check at most how many characters of amount can fit in the first line. (I think this You should already be aware off). Say this is 40.

Use function module RKD_WORD_WRAP, pass the amount (XYZ) in TEXTLINE, 40 in OUTPUTLEN, and

retrieve the splitted words in table OUT_LINES.

Say the entire amount (XYZ) is now splitted into variables XYZ1, XYZ2, XYZ3 and XYZ4.

Now You can print like:

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

/: IF &XYZ2& NE ' '

TL ,,&XYZ2&

/: ENDIF

/: IF &XYZ3& NE ' '

TL ,,&XYZ3&

/: ENDIF

/: IF &XYZ4& NE ' '

TL ,,&XYZ4&

/: ENDIF

Remember, the entire logic needs to be built, in a subroutine in subroutine pool which you need to call from the SAPSCRIPT. (As You are using Standard SAP Program).

Rgds,

Birendra

Former Member
0 Kudos

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.

Former Member
0 Kudos

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:)

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.