Application Development and Automation 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: 
Read only

sap-script line space

Former Member
0 Likes
2,345

hi to all,

help me in this issue

in form i am doing like this

if bsid-wears = 'eur'

&BSID-BLDAT&,,&G_NETDT& &RF140-BELEGNUM(20)&,,&BSID-SGTXT(17)&

&bsid-waers&

elseif bsid-waers = 'nok'

&BSID-BLDAT&,,&G_NETDT& &RF140-BELEGNUM(20)&,,&BSID-SGTXT(17)&

&bsid-waers&.

else

&BSID-BLDAT&,,&G_NETDT& &RF140-BELEGNUM(20)&,,&BSID-SGTXT(17)&

&bsid-waers&.

now my peoblem is i need a space after each currecncy values how can i do it

EUR 12,000.00

EUR 1,000.00

EUR 12,000.00

GBP 20,000.00

GBP 10,000.00

GBP 5,000.00

USD 10,000.00

USD 5,000.00

like this

is there any syst command to do this

thanks in advance

kirna kumar

Message was edited by:

kiran kumar

Message was edited by:

kiran kumar

Message was edited by:

kiran kumar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,107

Hi,

Did the you add the code that I mentioned in my earlier post..

curr_stc = v_curr.

Please add that it should work fine..

Also it will work if the internal table is sorted with currency field WAERS..

Thanks,

Naren

25 REPLIES 25
Read only

Former Member
0 Likes
2,107

Hi,

If you need a blank line use / .

/

P1if bsid-wears = 'eur'

&BSID-BLDAT&,,&G_NETDT& &RF140-BELEGNUM(20)&,,&BSID-SGTXT(17)&

&bsid-waers&

Thanks,

Naren

Read only

0 Likes
2,107

hi narendren i dont need after each and every line item i need after all values of particular currency.

thanks in advance

kiran kumar

Read only

Former Member
0 Likes
2,107

Hi,

If you can change the print program..

Do the following..

IF the currency changes with in the loop..

Then the write_form function module to have a blank line..

Example..

-


Sapscript

-


/E NEW_LINE

/

Print program

-


  • IF the currency changes..

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'NEW_LINE'

WINDOW = 'MAIN'.

Thanks,

Naren

Read only

0 Likes
2,107

hi narendran,

it is a standard print program i cant change that is ther any other alternative

thanks in advance

kiran kumar

Read only

Former Member
0 Likes
2,107

If you need a blank line use / .

/

PLIF BSID-WAERS = 'EUR'

&BSID-BLDAT&,,&G_NETDT& &RF140-BELEGNUM(20)&,,&BSID-SGTXT(17)&

&BSID-WAERS&

Message was edited by:

Ramesh Babu Chirumamilla

Read only

0 Likes
2,107

hi i dont need after each and every line item i need a space after line items of one currency r over.

thanks in advance

kiran kumar

Read only

Former Member
0 Likes
2,107

Hi,

Try this ....

Sap script form

-


/: DEFINE &V_NEWLINE& := ''

/: PERFORM CHECK_NEW_CURR IN PROGRAM Z_REPORT_SUB

/: USING &BSID-WAERS&

/: CHANGING &V_NEWLINE&

/: ENDPERFORM

/: IF &V_NEWLINE& = 'X'

/

/: ENDIF

Create a new report program Z_REPORT_SUB and have the following code

-


FORM check_new_curr TABLES in_par STRUCTURE itcsy

out_par STRUCTURE itcsy.

STATICS: v_curr_stc LIKE bsid-waers.

DATA: v_curr LIKE bsid-waers.

  • Get the input parameter

READ TABLE in_par WITH KEY 'BSID-WAERS'.

CHECK sy-subrc = 0.

v_curr = in_par-value.

  • Get the output parameter

READ TABLE out_par WITH KEY 'V_NEWLINE'.

CHECK sy-subrc = 0.

  • IF the currency is not equal to previous curr in the variable

  • V_CURR_STC..If so set the flag to 'X'.

IF v_curr <> v_curr_stc.

out_par-value = 'X'.

MODIFY out_par INDEX sy-tabix.

ENDIF.

ENDFORM.

Thanks,

Naren

Read only

0 Likes
2,107

hi narendran thanks for ur answer i will try this.

one dought

should i keep the condition

if new-line 'x'

blank

endif

before the if conditons or last

thanks

kiran kumar

Message was edited by:

kiran kumar

Read only

Former Member
0 Likes
2,107

Hi,

Please let me know if it works..

Thanks,

Naren

Read only

Former Member
0 Likes
2,107

Hi,

You should have it before the if the conditions..

Have my code here (means before the IF conditions)..

<b>if bsid-wears = 'eur'

&BSID-BLDAT&,,&G_NETDT& &RF140-BELEGNUM(20)&,,&BSID-SGTXT(17)&

&bsid-waers&

elseif bsid-waers = 'nok'

&BSID-BLDAT&,,&G_NETDT& &RF140-BELEGNUM(20)&,,&BSID-SGTXT(17)&

&bsid-waers&.

else

&BSID-BLDAT&,,&G_NETDT& &RF140-BELEGNUM(20)&,,&BSID-SGTXT(17)&

&bsid-waers&.</b>

Thanks,

Naren

Read only

0 Likes
2,107

hi narendren for every record it v_newline is becoming x

and there is no differnce in output.

thanks in advance

kiran kumar

Read only

Former Member
0 Likes
2,107

Hi,

I missed this line...

Please add in the program....The changes are marked in bold..

FORM check_new_curr TABLES in_par STRUCTURE itcsy

out_par STRUCTURE itcsy.

STATICS: v_curr_stc LIKE bsid-waers.

DATA: v_curr LIKE bsid-waers.

  • Get the input parameter

READ TABLE in_par WITH KEY 'BSID-WAERS'.

CHECK sy-subrc = 0.

v_curr = in_par-value.

  • Get the output parameter

READ TABLE out_par WITH KEY 'V_NEWLINE'.

CHECK sy-subrc = 0.

  • IF the currency is not equal to previous curr in the variable

  • V_CURR_STC..If so set the flag to 'X'.

IF v_curr <> v_curr_stc.

out_par-value = 'X'.

MODIFY out_par INDEX sy-tabix.

ENDIF.

<b>v_curr_stc = v_curr.</b>

ENDFORM.

Thanks,

Naren

Read only

Former Member
0 Likes
2,107

Hi,

Check this change..As mentioned in my last post..

I missed this line...

Please add in the program....The changes are marked in bold..

FORM check_new_curr TABLES in_par STRUCTURE itcsy

out_par STRUCTURE itcsy.

STATICS: v_curr_stc LIKE bsid-waers.

DATA: v_curr LIKE bsid-waers.

  • Get the input parameter

READ TABLE in_par WITH KEY 'BSID-WAERS'.

CHECK sy-subrc = 0.

v_curr = in_par-value.

  • Get the output parameter

READ TABLE out_par WITH KEY 'V_NEWLINE'.

CHECK sy-subrc = 0.

  • IF the currency is not equal to previous curr in the variable

  • V_CURR_STC..If so set the flag to 'X'.

IF v_curr <> v_curr_stc.

out_par-value = 'X'.

MODIFY out_par INDEX sy-tabix.

ENDIF.

<b>v_curr_stc = v_curr.</b>

ENDFORM.

Thanks,

Naren

Read only

0 Likes
2,107

hi naren,

i debugged the script it is going to this subroutine only once at first time and keeping blank at first positon and and nver coming to the subroutine again.

thanks & Regards

kiran kumar

Read only

Former Member
0 Likes
2,107

Hi,

Put a break point in the subroutine...

Also are you displaying the contents in the main window..

I checked this code it is working fine for me...

Thanks,

Naren

Read only

0 Likes
2,107

hi naren,

everytime out_par-value = 'X' is becoming x and not evening keeping blank space

anyway thanks Naren i i will debug it thank u very much for ur help.

thanks in advance

kiran kumar

Read only

Former Member
0 Likes
2,108

Hi,

Did the you add the code that I mentioned in my earlier post..

curr_stc = v_curr.

Please add that it should work fine..

Also it will work if the internal table is sorted with currency field WAERS..

Thanks,

Naren

Read only

0 Likes
2,107

thank you very much narendren the problem was solved

can u give ur mail id narenden.

thanks & regards

kiran kumar.

Read only

Former Member
0 Likes
2,107

Hi,

Please get my email-id from my business card..

Thanks,

Naren

Read only

0 Likes
2,107

hi narenden,

when statics will be decalared in which cases it will declared

thanks in advance

kiran kumar

Read only

Former Member
0 Likes
2,107

Hi,

I don't get your question....If you declare the variable as STATICS in a subroutine..Then if the subroutine is called multiple times...The value set in the previous call will be retained..

Thanks,

Naren

Read only

0 Likes
2,107

hi

if we use data :v_curr_stc how can we retain the value.

Read only

0 Likes
2,107

hi naren sorry for asking this

if u use data:

how to retain the value.

thanks in advance

kiran kumar

Read only

Former Member
0 Likes
2,107

Hi,

IF we <b>data :v_curr_stc how can we retain the value</b>, the value will not be retained...Everytime a new variable will be created...

Thanks,

Naren

Read only

Former Member
0 Likes
2,107

Hi,

You cannot retain value using DATA statement in a subroutine..Please let me know your requiement..Why do you want to retain value using DATA statement..

Thanks,

Naren