08-20-2007 8:11 AM
Hi,
While working with smartforms, for each delivery note (vbeln), a new page should be printed with corresponding item level information.
Now the internal table is having all the data.
How to generate new page for each new VBELN....??????
Regards
Pavan
08-20-2007 8:22 AM
Hi ,
You can use following tips to print multiple delivery note for individual sales order using select-options.
To print the sales order range in smartform do the following things:
1.Define the structure,workarea and internal table for sales order header and details and also define
select-options for sales order.
2.Also define the one STRUCTURE which has type as ssfctrlop.
e.g. control type ssfctrlop.
This variable we have to define because we are going to use this in
SSF_OPEN function.This is used to avoid print preview while openning smartform
for every sales order.
3. Select data from vbak for sales header.
4. Call function SSF_FUNCTION_MODULE_NAME.
e.g.*CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = w_formname
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = w_functionname
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.
5.Now here define the various features or field in control structure.
This is controls for smartform.
e.g. control-no_dialog = 'X'.
control-preview = 'X'.
control-no_open = 'X'.
control-no_close = 'X'.
6. Call function SSF_OPEN.
Here you have to pass the control structure which you have define in declaration.
e.g.
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.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
7. Take loop at header internal table .
8. Select data from vbak for sales details. Also select data from respective tables
like makt,kna1 here.
9.Then call function module which generated after executing smartform. And also pass the control structure
in import parameter in this function module.
e.g. CALL FUNCTION '/1BCDWB/SF00000397'
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
control_parameters = control
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
wa_vbak = wa_vbak
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
it_vbak = it_vbak
it_vbap = it_vbap
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.
10.After endloop call function SSF_CLOSE.
Regards,
Santosh.
08-20-2007 8:14 AM
Hi pavan,
try to use the AT BEGIN of event in smartform..so that when VBELN is changed just got to next page..ie increment SFSY-PAGE by 1.
hope this may be usefull...
reward points incase usefull...
regards,
prashant
08-20-2007 8:15 AM
It's only logic,
if you want for each delivery a page, you must not use the TABLE. Instead you have to play with LOOP and window.
The more simple, if you just start with smartforms, it's to modify the calling program to make a loop. And to change the form to print only for one delivery (no any loop).
Fred
08-20-2007 8:20 AM
In d main window in the code write page flag = x.
then in d loop,in the data tab
write table to wa.
And in the FOLDER, in the main Area define the workarea for the corresponding
field ...it will take every value for vbeln
regards..
Award if helpful
08-20-2007 8:22 AM
Hi ,
You can use following tips to print multiple delivery note for individual sales order using select-options.
To print the sales order range in smartform do the following things:
1.Define the structure,workarea and internal table for sales order header and details and also define
select-options for sales order.
2.Also define the one STRUCTURE which has type as ssfctrlop.
e.g. control type ssfctrlop.
This variable we have to define because we are going to use this in
SSF_OPEN function.This is used to avoid print preview while openning smartform
for every sales order.
3. Select data from vbak for sales header.
4. Call function SSF_FUNCTION_MODULE_NAME.
e.g.*CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
EXPORTING
formname = w_formname
VARIANT = ' '
DIRECT_CALL = ' '
IMPORTING
fm_name = w_functionname
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.
5.Now here define the various features or field in control structure.
This is controls for smartform.
e.g. control-no_dialog = 'X'.
control-preview = 'X'.
control-no_open = 'X'.
control-no_close = 'X'.
6. Call function SSF_OPEN.
Here you have to pass the control structure which you have define in declaration.
e.g.
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.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
7. Take loop at header internal table .
8. Select data from vbak for sales details. Also select data from respective tables
like makt,kna1 here.
9.Then call function module which generated after executing smartform. And also pass the control structure
in import parameter in this function module.
e.g. CALL FUNCTION '/1BCDWB/SF00000397'
EXPORTING
ARCHIVE_INDEX =
ARCHIVE_INDEX_TAB =
ARCHIVE_PARAMETERS =
control_parameters = control
MAIL_APPL_OBJ =
MAIL_RECIPIENT =
MAIL_SENDER =
OUTPUT_OPTIONS =
USER_SETTINGS = 'X'
wa_vbak = wa_vbak
IMPORTING
DOCUMENT_OUTPUT_INFO =
JOB_OUTPUT_INFO =
JOB_OUTPUT_OPTIONS =
TABLES
it_vbak = it_vbak
it_vbap = it_vbap
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.
10.After endloop call function SSF_CLOSE.
Regards,
Santosh.
08-20-2007 10:19 AM
Hi,
Check the following code:
LOOP AT int_final.
MOVE-CORRESPONDING int_final TO int_final1.
APPEND int_final1.
AT END OF lifnr.
CALL FUNCTION fm_name
EXPORTING
control_parameters = control
income = p_rtit
municipal = p_rtmt
TABLES
zven_whtax_cert = int_final1.
CLEAR int_final1.
REFRESH: int_final1.
ENDAT.
ENDLOOP.
Hope this helps.
Reward if helpful.
Regards,
Sipra