cancel
Showing results for 
Search instead for 
Did you mean: 

SMartform printing

Former Member
0 Kudos

Hi all,

there is one requirement in which i need to print header details(VBRK) in one secondary window and item detials(VBRP) in main window.

in the print program there is a select option for VBELN. so i selected some VBELNs present in VBRK table and for them i selected data from vbrp .

Now i looped at the internal table t_vbrk and pass t_vbrk-vbeln and table t_vbrp to the smartform.

here i am able to see only the data belonging to the first vbeln and its corresponding item data .If i want to next vbeln i need to go back and again press the print preview .This process i am doing for all the vbelns present in t_vbrk.

But i dont want to do this.I want to display all the pages continuely means first for the first vbeln of vbrk and next it should display next vbrk and its iem data .Like this it should continue all the vbelns of the t_vbrk.

How to do this.

if i pass two tables t_ VBRK and t_VBRP then it becomes difficult to print header and item data.

Please suggest me the solution.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

What is the nessecity of taking two internal tables?

u can implement in one internal table.

take all the data into one internal table <ITAB> .

1. In smartform put main window first.

then write code in program lines like below.

ITAB1[] = ITAB[].

SORT ITAB1 BY vbeln posnr.

DELETE ADJACENT DUPLICATES FROM ITAB1 COMPARING vbeln.

then take loop on internal table <ITAB1>

next again loop on internal table <ITAB> where vbeln = <ITAB1>-vbeln.

like this u can proceed for items.

Regards,

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Try this code. I think your problem will be solve.

DATA : count TYPE i."Counter for Printing Multiple page.

DATA : line TYPE i . "For Storing line number of internal table.

DATA : control TYPE ssfctrlop.

DATA : output_options TYPE ssfcompop.

DESCRIBE TABLE Internal Table LINES line .

LOOP AT Internal Table .

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

count = count + 1.

control-no_open = 'X'. "X

control-no_close = 'X'. "X

IF count = 1.

CALL FUNCTION 'SSF_OPEN'

EXPORTING

control_parameters = control

output_options = output_options

user_settings = space

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

OTHERS = 5.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

EXIT.

ENDIF.

CALL FUNCTION fm_nam

EXPORTING

control_parameters = control

output_options = output_options

user_settings = space

TABLES

t_qals_1 = p_t_qals.

ENDIF.

IF count < line AND count NE 1 .

CALL FUNCTION fm_nam

EXPORTING

control_parameters = control

output_options = output_options

user_settings = space

TABLES

t_qals_1 = p_t_qals.

ENDIF.

IF count EQ line AND NOT count EQ 1.

CALL FUNCTION fm_nam

EXPORTING

control_parameters = control

output_options = output_options

user_settings = space

TABLES

t_qals_1 = p_t_qals.

CALL FUNCTION 'SSF_CLOSE'

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDIF.

IF count EQ line AND count EQ 1.

CALL FUNCTION 'SSF_CLOSE'

EXCEPTIONS

formatting_error = 1

internal_error = 2

send_error = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

ENDIF.

Endloop.

Reward points if useful.

Thanks,

Saroj.

Former Member
0 Kudos

Hi..

Try the following code : It will surely work --

&----


*& Report Z8AC_SF_RANGES

*&

&----


*&

*&

&----


REPORT Z8AC_SF_RANGES.

***********data declaration********************

data: w_ekko type ekko-ebeln,

fm_name type rs38l_fnam,

control type ssfctrlop,

header type ZHEAD_TT,

details type ZDETAILS_TT,

head type ekko.

************selection screen******************

select-options: s_ekko for w_ekko.

*************logic**************************

start-of-selection.

*&----


fetching the header data

select * from ekko

into table header

where ebeln in s_ekko.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'Z8AC_SF_RANGES'

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = fm_name

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

******************setting the control parameters

control-no_dialog = 'X'.

control-preview = 'X'.

control-no_open = 'X'.

control-no_close = 'X'.

call function 'SSF_OPEN'

exporting

  • ARCHIVE_PARAMETERS =

  • USER_SETTINGS = 'X'

  • MAIL_SENDER =

  • MAIL_RECIPIENT =

  • MAIL_APPL_OBJ =

  • OUTPUT_OPTIONS =

control_parameters = control

  • IMPORTING

  • JOB_OUTPUT_OPTIONS =

exceptions

formatting_error = 1

internal_error = 2

send_error = 3

user_canceled = 4

others = 5.

if sy-subrc <> 0.

  • error handling

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

exit.

endif.

*&----


fetching the details data

loop at header into head.

select * from ekpo

into table details

where ebeln = head-ebeln

and ebeln in s_ekko.

CALL FUNCTION '/1BCDWB/SF00000253'

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

CONTROL_PARAMETERS = control

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

head_info = head

details_info = details

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • JOB_OUTPUT_OPTIONS =

  • EXCEPTIONS

  • FORMATTING_ERROR = 1

  • INTERNAL_ERROR = 2

  • SEND_ERROR = 3

  • USER_CANCELED = 4

  • OTHERS = 5

.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

endloop.

call function 'SSF_CLOSE'

  • IMPORTING

  • JOB_OUTPUT_INFO =

exceptions

formatting_error = 1

internal_error = 2

send_error = 3

others = 4.

if sy-subrc <> 0.

  • error handling

message id sy-msgid type sy-msgty number sy-msgno

with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

endif.

Reward points if useful..

Thanks

Arun