2007 Apr 19 3:15 PM
Hi,
I have developed an alv grid report displaying POs with their multiple line items
when i double click on the selected po from the grid i need to get the smartform
output in pdf format i have the smartform where i am passing the po number
in the sel screen of the smartform i do have driver program. i need to club these
two i.e., when i click on the selected PO from the alv grid i should get the pdf
formatted smartfrom output calling the driver program of the smartform which i have by passing the po number in to the form this should be done internally and
i need to generate pdf smartform output for the selected po in the alv grid
i do have smartform layout and print prog which takes po number as input and
generate smartform output in pdf format. i also have alv report showing all the pos
i need to club these and get the pdf for the selected po from alv grid by double clicking the selected po on the alv grid. i need to get the pdf generated as if i double click on the selected po
help me out by clubing the smartform in to alv
Hi,
I have developed an alv grid report displaying POs with their multiple line items
when i double click on the selected po from the grid i need to get the smartform
output in pdf format i have the smartform where i am passing the po number
in the sel screen of the smartform i do have driver program. i need to club these
two i.e., when i click on the selected PO from the alv grid i should get the pdf
formatted smartfrom output calling the driver program of the smartform which i have by passing the po number in to the form this should be done internally and
i need to generate pdf smartform output for the selected po in the alv grid
i do have smartform layout and print prog which takes po number as input and
generate smartform output in pdf format. i also have alv report showing all the pos
i need to club these and get the pdf for the selected po from alv grid by double clicking the selected po on the alv grid. i need to get the pdf generated as if i double click on the selected po
help me out by clubing the smartform in to alv
2007 Apr 19 3:21 PM
hi Sreenivas ,
Welcome to SDN!!!
Its appreciated that if you can explain your question in more precised way so that others may feel interested and easy to answer your question.
I can tell you the program to convert your smartform to pdf ,see if that code can helps you.
Regards,
Siva
2007 Apr 20 8:06 AM
hi shiv,
My requirement is not to convert smartform output to pdf
i do have the smartform created with zxxxxxform and also i created driver program
for this form say zxxxxprg in this prog i have a sel screen with po number as
input and two buttons preview and refresh when i enter po no and click preview
i am able to get the smartform output for that particular po in pdf format storing in a specified place. thats there with me.
i do have a report zxxxxpodetails which lists all pos and their details its an alv grid
when i double click on the selected po from the alv grid output i need to call the
driver prog zxxxprg and submit the selected po there in the sel screen and clicking
the preview button i need to get the smartform output for the selected po in pdf
stored in the location. i need to do it dynamically.
i need to get the pdf form for the selected po dynamically clubing the driver prog from the report.
my final req is that when i double click on the po no from the alv grid output i should get the pdf form generted for that po calling the driver prog passing the sel screen input and generating pdf form internally stored in a place
2007 Apr 20 8:22 AM
You have use events for this..
Simple ex:
&----
*& Form sub_event_call
&----
text
----
-->P_V_EVENTS_REPL text
----
FORM sub_event_call USING p_v_events.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = p_v_events
EXCEPTIONS
LIST_TYPE_WRONG = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " sub_event_call
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER =
I_BUFFER_ACTIVE = ' '
i_callback_program = v_repid
I_CALLBACK_PF_STATUS_SET = ' '
i_callback_user_command = 'USER_COMMAND_FINAL'
I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
i_grid_title = ws_title
I_GRID_SETTINGS =
is_layout = g_layout
it_fieldcat = g_fieldcat[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
it_sort = it_sort
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
i_save = 'A'
IS_VARIANT =
it_events = v_events_final
IT_EVENT_EXIT =
is_print = ls_print
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IT_ALV_GRAPHICS =
IT_ADD_FIELDCAT =
IT_HYPERLINK =
I_HTML_HEIGHT_TOP =
I_HTML_HEIGHT_END =
IT_EXCEPT_QINFO =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = it_final
EXCEPTIONS
program_error = 1
OTHERS = 2
.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*&----
*& Form POPULATE_EVENT
*&----
text
*----
--> p1 text
<-- p2 text
*----
FORM populate_event.
READ TABLE v_events_final INTO wa_event WITH KEY
name = 'USER_COMMAND_FINAL'.
IF sy-subrc EQ 0.
wa_event-form = 'USER_COMMAND_FINAL'.
MODIFY v_events_final FROM wa_event TRANSPORTING form
WHERE name = wa_event-name.
ENDIF.
ENDFORM. " POPULATE_EVENT
&----
*& Form USER_COMMAND_FINAL
&----
text
----
-->R_UCOMM text
-->, text
-->RS_SLEFIELDtext
----
FORM user_command_final USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
***User interaction on detail list
**Displays Tx IW53
CLEAR g_rs_selfield.
CASE r_ucomm.
WHEN '&IC1'.
CLEAR wa_repl_final.
READ TABLE it_repl_final INTO wa_repl_final INDEX
rs_selfield-tabindex.
IF sy-subrc = 0.
SET PARAMETER ID 'IQM' FIELD wa_repl_final-qmnum.
CALL TRANSACTION 'IW53' AND SKIP FIRST SCREEN.
Here use SUBMIT statement by passing the value to from driver program.
ENDIF.
ENDIF.
ENDCASE.
ENDFORM. "user_command_det
2007 Apr 20 8:46 AM
Hi,
You can do that , when you double click on your ALV grid on PO number, enter logic in your program at-line-selection event to call the other program driver program using submit option and pass the PO number to that program with preview button as 'X' .
In this way it will show the smartform for your PO.
Hope this helps.
Thanks,
Ponraj.s.
2007 Apr 20 8:52 AM
HI,
U can an option in alv grid display for user command.
In that, include this code.
Eg:
FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
when '&IC1&..
IF RS_SELFIELD-NAME 'EBELN'.
submit report 'ZSMARTFORM' WITH SELECT-OPTIONS-LOW = RS_SELFIED-VALUE.
ENDIF.
ENDCASE.
endform.HERE,
'ZSMARTFORM' is ur smartform driver program.
Any more queries do revert.
2007 Apr 19 3:26 PM
Hi Sreenivas,
Check it out,hope this may give some idea .
Reward useful points if this helps you.
DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
i_tline TYPE TABLE OF tline WITH HEADER LINE,
i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
Objects to send mail.
i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
Work Area declarations
wa_objhead TYPE soli_tab,
w_ctrlop TYPE ssfctrlop,
w_compop TYPE ssfcompop,
w_return TYPE ssfcrescl,
wa_doc_chng typE sodocchgi1,
w_data TYPE sodocchgi1,
wa_buffer TYPE string,"To convert from 132 to 255
Variables declarations
v_form_name TYPE rs38l_fnam,
v_len_in LIKE sood-objlen,
v_len_out LIKE sood-objlen,
v_len_outn TYPE i,
v_lines_txt TYPE i,
v_lines_bin TYPE i.
call function 'SSF_FUNCTION_MODULE_NAME'
exporting
formname = 'ZZZ_TEST1'
importing
fm_name = v_form_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.
w_ctrlop-getotf = 'X'.
w_ctrlop-no_dialog = 'X'.
w_compop-tdnoprev = 'X'.
CALL FUNCTION v_form_name
EXPORTING
control_parameters = w_ctrlop
output_options = w_compop
user_settings = 'X'
IMPORTING
job_output_info = w_return
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.
i_otf[] = w_return-otfdata[].
call function 'CONVERT_OTF'
EXPORTING
format = 'PDF'
max_linewidth = 132
IMPORTING
bin_filesize = v_len_in
TABLES
otf = i_otf
lines = i_tline
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
others = 4.
Fehlerhandling
if sy-subrc <> 0.
endif.
loop at i_tline.
translate i_tline using '~'.
concatenate wa_buffer i_tline into wa_buffer.
endloop.
translate wa_buffer using '~'.
do.
i_record = wa_buffer.
append i_record.
shift wa_buffer left by 255 places.
if wa_buffer is initial.
exit.
endif.
enddo.
Attachment
refresh:
i_reclist,
i_objtxt,
i_objbin,
i_objpack.
clear wa_objhead.
i_objbin[] = i_record[].
Create Message Body
Title and Description
i_objtxt = 'test with pdf-Attachment!'.
append i_objtxt.
describe table i_objtxt lines v_lines_txt.
read table i_objtxt index v_lines_txt.
wa_doc_chng-obj_name = 'smartform'.
wa_doc_chng-expiry_dat = sy-datum + 10.
wa_doc_chng-obj_descr = 'smartform'.
wa_doc_chng-sensitivty = 'F'.
wa_doc_chng-doc_size = v_lines_txt * 255.
Main Text
wa_doc_chng-doc_size = ( v_lines_txt - 1 ) * 255 + strlen( i_objtxt )
*.
clear i_objpack-transf_bin.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
i_objpack-body_num = v_lines_txt.
i_objpack-doc_type = 'RAW'.
append i_objpack.
Attachment
(pdf-Attachment)
i_objpack-transf_bin = 'X'.
i_objpack-head_start = 1.
i_objpack-head_num = 0.
i_objpack-body_start = 1.
Länge des Attachment ermitteln
describe table i_objbin lines v_lines_bin.
read table i_objbin index v_lines_bin.
i_objpack-doc_size = v_lines_bin * 255 .
i_objpack-body_num = v_lines_bin.
i_objpack-doc_type = 'PDF'.
i_objpack-obj_name = 'smart'.
i_objpack-obj_descr = 'test'.
append i_objpack.
clear i_reclist.
i_reclist-receiver = [email protected]'.
i_reclist-rec_type = 'U'.
append i_reclist.
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = wa_doc_chng
put_in_outbox = 'X'
TABLES
packing_list = i_objpack
object_header = wa_objhead
CONTENTS_BIN = i_objbin
contents_txt = i_objtxt
receivers = i_reclist
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
others = 8.
Regards,
Siva
2007 Apr 19 3:35 PM
Hello Srinivas,
This is my guess :
In the double click event for the PO Number, capture the purchase order number by using the row and the column number returned by the double click event.
Store this in selection table.
Then call driver program using SUBMIT statement and pass the Selection Table.
Please can you tell me if it works?
2007 Apr 20 8:32 AM
HI check,,
structures
ssfctrlop,
ssfcompop. if u can find anything to give PDF format..
Thanks .
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |