Skip to Content
0
Mar 29, 2006 at 01:32 AM

need simple code...

17 Views

Hello experts,

I am currently having trouble modifying a report. In the part of the report that I am modifying, it is inside a loop and it gets vbelv and posnv from vbfa comparing it to mseg-mblnr and zeile respectively. now, I cannot use at new statement since vbfa-vbelv and posnv is not part of the itab. I tried using on change it worked but i'm having second thoughts about it. what I want to do is that for example, there are 5 customers and their PO's, I must seperate them according to customers and I must show the footer(where customers will sign) at every end of page. I post below the logic of the code that I am modifying since it is too long to paste. Thanks you very much guys!

loop at traptab.

MOVE-CORRESPONDING traptab TO mkpf.

MOVE-CORRESPONDING traptab TO mseg.

perform get_address

PERFORM wa03_ausgabe.

endloop.

in the subroutine get_address, it gets vbfa-vbelv and vbfa posnv comparing it to mseg-mblnr and zeile. Then I concatenated vbelv and posnv to ls_thead-tdname then I used the function READ_TEXT and put it in ls_lines.

After putting the contents to ls_lines, in the subroutine

wa03_ausgabe, I tried using on change of ls_lines then v_flag = 1. after using the usual WRITE_FORMS at the end of the subroutine I specified that if v_flag = 1, then it would use the function CONTROL_FORM using command NEW-PAGE. An example in subroutine wa03_ausgabe:

IF mseg-bwart EQ '631'.

ON CHANGE OF ls_lines.

v_flag = 1.

ENDON.

ENDIF.

**then a couple of WRITE_FORMS to different windows...

*at end of subroutine wa03_ausgabe:

IF v_flag = 1.

CLEAR v_flag.

CALL FUNCTION 'CONTROL_FORM'

EXPORTING

command = 'NEW-PAGE'.

ENDIF.

Now here are my problems:

1. In the first loop, it detects a change in ls_lines. So this will be a problem for me since what if the first customer has 3 pages and new-page command is called.

2. I am trying to call the subroutine print_footer in every end of a page of a customer(example: print_footer must be called and printed at page 3 of 3 of customer A.)

Well, I hope I stated my problem clear enough. Thanks you very much guys!Help would be greatly appreciated!

Message was edited by: viraylab