cancel
Showing results for 
Search instead for 
Did you mean: 

Scripts Issue

Former Member
0 Kudos

Hi All,

I need your suggestions/help regarding a couple of issues im facing in scripts.

1) While developing cheque printing, I have used the standard program and the standard script but copied the script to a local one and did changes to the same. Now I do not need a page for my development, If i delete the page as a whole im getting an error, if Im deleting all the page windows in that particular page then Im getting a blank page. Kindly suggest me how to go about this.

2) The value of the field DMBTR in the database is stored in correct format as say, 21,400.00

But in the script it is showing me a value of 21.400,00 [The coma and the decimal are interchanged], Ive checked my user settings also and they are fine. Because of this Im unable to do any calculations also in my subroutines which follow. Kindly lemme know how to fix this.

Regards,

Narendra.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

1. If you delete all pages then where you will print the data???

So, dont delete any pages. If you doenot want any page to be displayed. Then delete all page windows from that page.

And delete the next page assignment then your probelm will be solved.

2. To get the , . speparators goto the sytem->userprofiles->userdefaults. choose ., opttion.

Thanks,

former_member188005
Contributor
0 Kudos

Narendra,

The problem of DMBTR values is due to user setting .

If after setting the parameters in user setting still u r facing the problem

then Write the following code in the subroutine in which u r doing calculations:

Eg:

DMBTR = 24.000,00

Declare F1 F2 Final_val etc variables...

Split the Field into 2 .

SPLIT DMBTR AT ', ' INTO F1 F2.

The result is as follows:

F1 ---24.000 and

F2 --- 00.

Now replace the '.' in F1 as follows

REPLACE '.' in F1 WITH ','.

CONCATENATE F1 F2 into Final_Val.

The result for the above code will be

FINAL_VAL -


24,000.00

Remember if after this u get error that will be because of ',' in the value so replace that with space and condense the fields as follows:

REPLACE ',' IN FINAL_VAL with ' '

CONDENSE FINAL_VAL NO-GAPS.

Hope things are clear now..

Have a nice time..

Regards..

Former Member
0 Kudos

Hi Shakeel,

Ive done as you said, inspite of that Im getting the same problem. The problem is even if I dont do anything and just print what ever value is in the database also it is printed in the other way.

as I said if the db has 21,400.00 the output is showing as 21.400,00

Any reason why it is being displayed so??

Please consider this urgent and let me know..

As these are currency fields I need to do some calculations and if taken into char fields Im getting dumps.

Regards,

Narendra.

Former Member
0 Kudos

Hi,

For this you need to declare a variable of character type say v_amount with lenght accorindg to the output length of the decimal field. If you use NETPR then check the data element and domain of that there you will find outptut length.

Then copy the value into v_amount

also declare one more variable with length (decimal length if you have 3 decimals then length will be 3) say v_deci

one more variable for before decimal say v_amt.

now let us say your actual field is v_netpr .

v_amount = v_netpr.

split v_amount at ',' into v_amt v_deci.

replace all occurances of '.' with ',' in v_amt.

clear v_amount.

concatenate v_amt '.' v_deci into v_amount.

and if you have any calculation then do the calculations using v_netpr then convert them into required format using the above logic.

for page error : Let me know what error you are getting.

Reward points if useful.

Regards,

Nageswar

Former Member
0 Kudos

Hi Nageswar,

I did the same thing as you and shakeel suggested, but the problem is after concatenating the final variable, i need to assign this to a currency field of type dmbtr and here is where Im getting the dump.

Regarding the error in scripts, Im getting a blank page if I delete the page or delete all the page windows in that particular page. Plz suggest me how to avoid this.

Regards,

Narendra.

Former Member
0 Kudos

No you should not assign to dmnbtr field. Instead you can print the character type field right? Why do you need to copy it again . Ii will definately give dump it you are trying to assign the values between two uncompatible variables.

For page: Delete the page and let me know the error. If you delete the page then you will not get blank page. And check In the first page what is given as next page . Just change to first page only.

Regards,

Nageswar

Former Member
0 Kudos

If I do not assign to a numeric or integer fields how do I do the calculations on char fields.

And for the pages, I have deleted the pages and in the next page i just left it blank. Inspite of that Im getting an extra page.

Kindly suggest how to go about this.

Regards,

Narendra

Former Member
0 Kudos

Hi,

Thats why I mentinoed earlier post that dont use character type fields for calculation. For that you have main fields right?

If you dont understand what I mean to say, just paste the coding lines here. Otherwise send me the print program code to my id.

Regards,

Nageswar

Former Member
0 Kudos

Hi ,

Below is my code:

FORM get_vat TABLES in_tab STRUCTURE itcsy out_tab STRUCTURE itcsy.

DATA: lv_var(255) TYPE c, "dmbtr,

lv_var1(255) TYPE c, "qsshb,

lv_var2(255) TYPE c, "dmbtr.

var(15) TYPE c,

var1(15) TYPE c,

var2(15) TYPE c.

DATA: lv_var4 TYPE dmbtr,

lv_var5 TYPE qsshb,

lv_var6 TYPE dmbtr.

READ TABLE in_tab WITH KEY 'REGUP-DMBTR'.

IF sy-subrc EQ 0.

lv_var = in_tab-value.

SPLIT lv_var AT ',' INTO var1 var2.

REPLACE '.' IN var1 WITH ','.

CONCATENATE '.' var2 INTO var2.

CONCATENATE var1 var2 INTO var.

CONDENSE var NO-GAPS.

lv_var4 = var.-------> (Dump at this place.)

ENDIF.

READ TABLE in_tab WITH KEY 'REGUP-QSSHB'.

IF sy-subrc EQ 0.

lv_var1 = in_tab-value.

lv_var5 = lv_var1.

ENDIF.

lv_var6 = lv_var4 - lv_var5.

lv_var2 = lv_var - lv_var1.

READ TABLE out_tab WITH KEY 'LV_VAT'.

IF sy-subrc EQ 0.

out_tab-value = lv_var2.

MODIFY out_tab INDEX 1.

ENDIF.

ENDFORM. "get_vat

Former Member
0 Kudos

Ok You are writing it in subroutine. I thought you are writing it in Print program.

Cant you change the print program?

Anyway I will come back with the solution . I have done with similar requirement but long back . Have to check it.

Regards,

Nageswar

Former Member
0 Kudos

Hi

You are getting the extra blank page in the last beacuse while running the driver prograon RFFOUS_C for the check printing you are printing teh payment summery too.

To avoid this just check the check box "No Form Summery Section" maintained in teh "Output Control" block of drever's program selection screen. I hope this will remover teh extra page printing.

Another issue ragrading the the commas/dots in teh DMBTR value,this you hav to manipulate in the subroutine pool only.

do something like this.

v1 = strlen(dmbtr)

then replace all the commas/dots with space and the put commas and dots appropriately.

Do reward if useful

Cheers

Anup S.

Former Member
0 Kudos

Nope, cant change the driver program.

If you can let me know how to go about this, it would be great.

Regards,

Narendra.

Former Member
0 Kudos

Hi Anup,

Thanks a zillion!!! It helped....for the blank page of the summary section....

and regarding the commas can you please explain me in detail. Actually without doing any manipulation and just simply printing those values also are resulting in the improper display of the values as 21.400,00

Regards,

Narendra.

Former Member
0 Kudos

Hi Narendra

Its gr8 the suggestions are working fine with you.:-)

For converting the amount to required format I will suggest to use the

first of all remove all the dots and commas from the amount variable

pls find sample code

FORM convert_amt USING fp_l_v_amt

fp_l_v_waers

CHANGING fp_l_v_amt_val

***Local Constant Declarations

CONSTANTS : l_c_xof TYPE waers VALUE 'XOF'.

v_len = STRLEN( fp_l_v_amt ).

v_len1 = v_len - 1.

***FOR NEGATIVE VALUES

IF fp_l_v_amt+v_len1(1) = c_minus.

v_len = v_len - 3.

ELSE.

v_len = v_len - 2.

ENDIF.

v_dec = fp_l_v_amt+v_len(2).

v_int = fp_l_v_amt+0(v_len).

REPLACE ALL OCCURRENCES OF c_dot IN v_int WITH c_space.

REPLACE ALL OCCURRENCES OF c_comma IN v_int WITH c_space.

CONDENSE v_int.

v_int1 = v_int.

fp_l_v_amt_val+0(13) = v_int1.

fp_l_v_amt_val+13(1) = c_dot.

fp_l_v_amt_val+14(2) = v_dec.

IF fp_l_v_amt+v_len1(1) = c_minus.

fp_l_v_amt_val = fp_l_v_amt_val * -1.

ENDIF.

CLEAR : v_len,

v_len1,

v_dec,

v_int,

v_int1.

ENDFORM.

then and do the calculation.

Then finally writing it back to the layout set

Do like below

Set Country 'UK' and write the amount to the char variable using below code

WRITE v_dmbtr TO var2 CURRENCY space .

Set Country ' '

this take care of the commas/dots issue.

DO REWARD IF FOUND USEFUL

Cheers

Anup S.

Former Member
0 Kudos

Hi Anup,

Can we put it simpler, or is this the only solution. If so can you please explain me what we are trying to do.

Regards,

Narendra.

Former Member
0 Kudos

Hi Narendra

I am doing nothing taking tha strlen of the amount entered say REGUH-DMBTR in your case. then i changing the amount in to 13 char variable like 0000000100023

then I will do some calculations over this and while writeing back to the layour set i am doing the set country as it will provide the amount value in correct format.

Can plss tell in which format you want to print the amount value in script ?????

Former Member
0 Kudos

Hi Anup,

I want the amount to be displayed in 21,400.00 format.

I have used set country 'SG' in the script and when I comment all my external subroutines it is working fine.

But once I uncomment my subroutines, then as I get into the subroutine the format is again changed.

In the subroutine also I have used the command set country 'SG', but of no use.

Kindly lemme know how to go about this.

Regards,

Narendra.

Former Member
0 Kudos

Hi Narendra

Then there must be data coming from your subroutines ar having the format like 00.000,00.

Do one thing set country 'UK' in the start of subroutine pool and write all the final amount values to the char varables like i said in the my second last post and then pass those variable to the layout set.

Do let me knwo if you any concern

you can chat me doubts in anup.sharma4u@gmail.com

Cheers

Anup S.

Former Member
0 Kudos

Hi Anup,

The problem is writing char values to amount fields is resulting in a dump. Im in ECC version and this doesnt support i believe.

Regards,

Narendra.

Former Member
0 Kudos

hey Dude

I am tellin you to write currency value to the char var..i think this can be done...

I am tellin do the calaculation hwat u wnat but just before writing it to layout set write it to the char varaible as i said..

Cheers

Anup S.

Former Member
0 Kudos

Hi Narendra,

Could you please tell me what Error you are getting when deleting the page and executing the Form.

Thanks,

Karthik