‎2013 Sep 03 10:51 AM
Hello experts,
I am new to smartforms.
I have a requirement where i have to print smartforms equal to the no. of records in the internal table which will be passed from a driver program;
and the logo which will be displayed in the form will change according to the data in the internal table.
For example :
if there are 4 records in the internal table it_final :
| Vinnr | model | dealer |
|---|---|---|
| WV12345 | abc | abc |
| WA12345 | abc | abc |
| TM12345 | abc | abc |
| WV12345 | abc | abc |
The logo will be different for first 3 records and the same for 4th and 1st one .
there will be a condition like :
LOOP AT it_final INTO wa_final.
if wa_final-vinnr cp 'WV*'.
logo = 'V_W'.
ELSEIF wa_final-vinnr cp 'TM*'.
logo = 'VW_SK_LOGO'.
ELSEIF wa_final-vinnr cp 'WA*'.
logo = 'VW_A_LOGO'.
endif.
ENDLOOP.
is it possible ?
if yes then how ?
Where to put this condition ?
‎2013 Sep 04 5:34 AM
Hi ,
May I suggest that you do your business logic in your print program .
call the form in a loop and pass individual records and the logo name to be used.
Regards.
Eitan.
Some "code" (Every thing in your print program) .
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
CALL FUNCTION 'SSF_OPEN'
LOOP AT it_final INTO wa_final.
* find out what logo to use for given record .
if wa_final-vinnr cp 'WV*'.
logo = 'V_W'.
ELSEIF wa_final-vinnr cp 'TM*'.
logo = 'VW_SK_LOGO'.
ELSEIF wa_final-vinnr cp 'WA*'.
logo = 'VW_A_LOGO'.
endif.
CALL FUNCTION fm_name
EXPORTING
control_parameters = st_control_parameters
output_options = st_output_options
user_settings = abap_false
wa_final = wa_final
logo = logo .
ENDLOOP.
CALL FUNCTION 'SSF_CLOSE'
‎2013 Sep 03 11:18 AM
Hi Jay,
Create Variable name as logo in global definition like this
AND DO LIKE THIS
WRITE CODE LIKE THIS
Before that you should upload logos with this name in sap
V_W
VW_SK_LOGO
VW_A_LOGO
‎2013 Sep 03 12:37 PM
Thanks .
it has been solved to some extent.
But if there are multiple records in the internal table then variable logo takes the latest value .
The requirement states that after printing the first record of it_final the logo should change for the second record to be printed depending on the condition.
‎2013 Sep 03 11:35 AM
Hi Jay Kamdar
See the below youtube video for STEP by STEP approach
‎2013 Sep 03 12:33 PM
HI jay ,
Please follow the attached smartforms and ........... in program logic do your desired logic.
like ...................
LOOP AT it_final INTO wa_final.
if wa_final-vinnr cp 'WV*'.
logo = 'V_W'.
ELSEIF wa_final-vinnr cp 'TM*'.
logo = 'VW_SK_LOGO'.
ELSEIF wa_final-vinnr cp 'WA*'.
logo = 'VW_A_LOGO'.
endif.
ENDLOOP.
and please don't forget to upload all logos into sap system (SE78).......
Enjoy.....................
‎2013 Sep 04 4:47 AM
‎2013 Sep 04 6:14 AM
just download the xml file from here and create one demo from then follow the path
UTILITIES-> upload ..............
it will ask for file name browse the directory and give the xml file path ...............
‎2013 Sep 03 12:37 PM
The condition must be given in the smartform.
In the logo window, add all the logos as graphic nodes and put a condition for each logo.
Only the logo corresponding to the value will be displayed in the form.
Give the field name wa_final-vinnr
For the comparison operator you can give the wild card pattern *
And value 'WV', 'TV' etc.
‎2013 Sep 04 4:57 AM
Thanks i tried your approach ,
but 2 logo's are being printed on the same form even if the condition is not met.
and if there are 3 different records in the internal table then 3 logo's are being printed.
‎2013 Sep 04 6:03 AM
You need the logo for each row in the table within the same form right?
So you will be having the logo as a column in the table right?
Did you give all the logo as graphic nodes under this column with the condition?
Let me know if I have understood it correctly.
‎2013 Sep 04 5:34 AM
Hi ,
May I suggest that you do your business logic in your print program .
call the form in a loop and pass individual records and the logo name to be used.
Regards.
Eitan.
Some "code" (Every thing in your print program) .
CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
CALL FUNCTION 'SSF_OPEN'
LOOP AT it_final INTO wa_final.
* find out what logo to use for given record .
if wa_final-vinnr cp 'WV*'.
logo = 'V_W'.
ELSEIF wa_final-vinnr cp 'TM*'.
logo = 'VW_SK_LOGO'.
ELSEIF wa_final-vinnr cp 'WA*'.
logo = 'VW_A_LOGO'.
endif.
CALL FUNCTION fm_name
EXPORTING
control_parameters = st_control_parameters
output_options = st_output_options
user_settings = abap_false
wa_final = wa_final
logo = logo .
ENDLOOP.
CALL FUNCTION 'SSF_CLOSE'
‎2013 Sep 04 5:54 AM
Thanks .
Solved
but i used the logic without ssf_open and ssf_close
will it harm ?
‎2013 Sep 04 6:02 AM
Hi ,
In such situation I always use ssf_open and ssf_close this way I have more control over the process .
Do some testing and if you are happy with that I guess it is ok.
Regards.
Did you move the logic to your print program ?
I am using ssf_open and ssf_close when I call the form within a loop .
See program SF_EXAMPLE_03
Regards.
‎2013 Sep 04 6:25 AM
‎2013 Sep 04 7:50 AM
Hi, Very good. Try always to move the business logic to your print program .
So no debugging is required in the form.
If you need to create structures use public type in class.
Sample:
See attachment .
class Y_CL_R_EITAN_TEST_02 definition
public
final
create public .
*"* public components of class Y_CL_R_EITAN_TEST_02
*"* do not include other source files here!!!
public section.
types:
BEGIN OF tp_airport_x .
TYPES: name TYPE sairport-name ,
time_zone TYPE sairport-time_zone .
TYPES: END OF tp_airport_x .
types:
BEGIN OF tp_flat_1 .
INCLUDE TYPE scarr AS scarr RENAMING WITH SUFFIX _scarr .
INCLUDE TYPE spfli AS spfli RENAMING WITH SUFFIX _spfli .
INCLUDE TYPE sflight AS sflight RENAMING WITH SUFFIX _sflight .
INCLUDE TYPE sticket AS sticket RENAMING WITH SUFFIX _sticket .
TYPES: END OF tp_flat_1 .
types:
tp_flat_1_tab TYPE STANDARD TABLE OF tp_flat_1 .
types:
BEGIN OF tp_sbook_1 .
INCLUDE TYPE sbook AS sbook RENAMING WITH SUFFIX _sbook .
TYPES: END OF tp_sbook_1 .
types:
tp_sbook_1_tab TYPE STANDARD TABLE OF tp_sbook_1 WITH NON-UNIQUE DEFAULT KEY .
types:
BEGIN OF tp_sflight_1 .
INCLUDE TYPE sflight AS sflight RENAMING WITH SUFFIX _sflight .
TYPES: it_sbook_1 TYPE tp_sbook_1_tab .
TYPES: END OF tp_sflight_1 .
types:
tp_sflight_1_tab TYPE STANDARD TABLE OF tp_sflight_1 WITH NON-UNIQUE DEFAULT KEY .
types:
BEGIN OF tp_spfli_1 .
INCLUDE TYPE spfli AS spfli RENAMING WITH SUFFIX _spfli .
INCLUDE TYPE tp_airport_x AS fr_airport RENAMING WITH SUFFIX _fr .
INCLUDE TYPE tp_airport_x AS to_airport RENAMING WITH SUFFIX _to .
TYPES: it_sflight_1 TYPE tp_sflight_1_tab .
TYPES: END OF tp_spfli_1 .
types:
tp_spfli_1_tab TYPE STANDARD TABLE OF tp_spfli_1 WITH NON-UNIQUE DEFAULT KEY .
types:
BEGIN OF tp_scarr_1.
INCLUDE TYPE scarr AS scarr RENAMING WITH SUFFIX _scarr .
TYPES: it_spfli_1 TYPE tp_spfli_1_tab .
TYPES: END OF tp_scarr_1 .
types:
tp_scarr_1_tab TYPE STANDARD TABLE OF tp_scarr_1 WITH NON-UNIQUE DEFAULT KEY .
‎2013 Sep 04 9:22 AM