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

problem with sapscript.

aris_hidalgo
Contributor
0 Likes
1,132

Hello experts,

Please take a look at my code below. In the code, I want to print the footer only if the condition is satisified but it the footer window prints on every page. Here is my code guys:

IF v_flag = 1.

PERFORM print_footer.

CLEAR v_flag.

CLEAR v_print.

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

command = 'NEW-PAGE'.

ENDIF.

v_flag is 1, then a new page is called meaning a new customer is found but before creating a new page, I want to print the footer at last page of the current customer.

Thank you very much guys!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,114

Hi viraylab,

1. how is your footer window defined ?

2. is it a constant window, variable window,

or main window ?

regards,

amit m.

10 REPLIES 10
Read only

Former Member
0 Likes
1,114

should the endif come after the clear stmts..?

IF v_flag = 1.

PERFORM print_footer.

CLEAR v_flag.

CLEAR v_print.

ENDIF.

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

command = 'NEW-PAGE'.

Read only

former_member186741
Active Contributor
0 Likes
1,114

show us is the logic which sets v_flag and the form print_footer.

Read only

Former Member
0 Likes
1,115

Hi viraylab,

1. how is your footer window defined ?

2. is it a constant window, variable window,

or main window ?

regards,

amit m.

Read only

0 Likes
1,114

Hello guys!

Below is the code for the print footer:

FORM print_footer.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'LLCOR'

window = 'LLCOR'.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

element = 'LRCOR'

window = 'LRCOR'.

ENDFORM.

Read only

0 Likes
1,114

The footer window is defined as a VAR window.

Read only

0 Likes
1,114

Hi again,

1. try with CONST window.

2. <b>In that,

give one ELEMENT (/E)</b>

<b>and print that element

on the requried conditoion,

using WRITE_FORM function module.</b>

3. <b>Don't write anything in the layout,

outside this element (in this footer window)</b>

regards,

amit m.

Read only

0 Likes
1,114

Hi Amit,

Thanks for your replies. I am kinda new to ABAP so sorry for so many questions.What do you mean in your suggestion no. 3?

Thanks you very much!

Read only

0 Likes
1,114

Hi again,

1. in layout, u must have created

a new window (variable window u are saying)

2. Now, go this window,

3. u must have put some text

in it for printing purpose.

4. what i m saying is put text like this.

/E MYELEMENT

  • ASDFASD JASDLFKJ;FLDJ;ASD

  • ASDFA 234 KLSDAFJASD923 KLASDF

  • ANY DATA...

5. This will make sure

that this data isprinted

<b>ONLY WHEN THE ELEMENT (MYELEMENT)

IS PRINTED

USING THE WRITE_FORM FUNCTION MODULE.

(in write form we have to pass

the VARIABLE WINDOW NAME

and also the ELEMENT NAME (myelement in this case))</b>

regards,

amit m.

Read only

0 Likes
1,114

Hi Amit,

I tried doing what u said but unfortunately it still prints in every page.

Read only

Former Member
0 Likes
1,114

Hello Viraylab,

As u say it is getting printed on each page meaning that the flag is set to 1 irrespective of customer!! Or the call to the footer window is also happening from some other place Or debug and c from where this footer is getting called.