on 08-19-2014 12:15 PM
Hello,
please help, i have this problem:
When certain data values on the CRM UI document change, the "Print preview" is not showing an updated text. It looks like the print preview procedure reads (generates ?) the text for display only once, when the document is opened. If i close and reload CRM_UI, the "Print preview" is showing an updated text. The document also has automatic note creation to it (when a document is saved, the note is automatically created), which gets correctly updated (change document data --> delete note --> save document --> updated note).
So what should i do that the "Print preview" text is generated every time a button is pressed ?
Information:
On the document transaction type ZDO1 (BT126H_APPT component) the "Print preview" button is added in the method IF_BSP_WD_TOOLBAR_CALLBACK~GET_BUTTONS. When the event triggers, it calls a method EH_ONPRINT_PREVIEW from superclass CL_CRM_UIU_BT_H_OVW_VIEWSET:
CALL METHOD SUPER->EH_ONPRINT_PREVIEW
EXPORTING
HTMLB_EVENT = HTMLB_EVENT
HTMLB_EVENT_EX = HTMLB_EVENT_EX.
The transaction ZDO1 has an Action profile ZPOR_ZDO1, which has an action ZDO1_PRINT defined for "Print Preview". In the CRMC_ACTION_CONF the action ZDO1_PRINT has these Properties:
1.) Overview tab:
- Schedule Condition = In the Worklist
- Action Merging = Max. 1 Unprocessed Action for Each Action Definition
- Start Condition = No Condition
- Time of Processing = Immediate Processing
2.) Processing Details tab:
- Assigned Processings = Smart Forms Print
- "Printer" subtab:
OutputDevice = PDF
Number of Copies = 1
- "Form" subtab:
Form Name = CRM_ACTIVITY_BUSACT01
Processing Class = ZCL_DOC_PROCESSING_CRM_ORDER
Processing Method = ZCRM_ACTIVITY_EXEC_PDF
In the method ZCRM_ACTIVITY_EXEC_PDF it says that for transaction ZDO1 the Smart FOrm /DURS/POR_IZPIS_01 should be used:
case ls_orderadm_h_wrk-process_type.
when 'ZDO1'.
lv_iname = '/DURS/POR_IZPIS_01'.
when others.
lv_iname = '/DURS/POR_IZPIS_02'.
endcase.
CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
i_name = lv_iname
IMPORTING
e_funcname = lv_name.
ls_outputparams-nodialog = 'X'.
ls_outputparams-getpdf = 'X'.
ls_outputparams-connection = 'ADS'.
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = ls_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
ls_docparams-country = 'SI'.
ls_docparams-langu = sy-langu.
CALL FUNCTION lv_name
EXPORTING
/1bcdwb/docparams = ls_docparams
I_HEADER_GUID = ls_orderadm_h_wrk-guid
IMPORTING
/1bcdwb/formoutput = ls_formoutput
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
3.) Schedule & Start Condition tab:
Empty
Help greatly appreciated, thanks!
Hi Zoran,
I could be wrong but one possible reason could be that the buffer empties very slowly when you save the documents. Can you edit the document again shortly once you have saved it?
If not you might run a trace in ST05 and check the expensive table/ programs. You might need to apply a secondary index if the trace reveals slow performance.
Should this not be relevant please let me know.
Best regards - Christophe
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Christoph,
thanks for the reply.
Yes, i can edit the document immediately upon saving.
So if i understand you correctly, by default the "Print Preview" should be generating a new text every time a button is pressed ? Is this like a property than can be modified somewhere (generate only once / generate every time) ?
Hi Zoran,
No your latest assumption is wrong. But from your answer there are no buffer issues apparently.
There could be another reason as why the print preview is not showing recent changes:
Could it be that you have the storage of the document set as print and archive in the IMG? Can you check the IMG parameters?
Thank you and regards - Christophe
The "Archive Mode" (tab "Processing Details", subtab "Printer") is set to "Print only".
I did some debugging and this is what i have found:
First i set up a breakpoint:
SFP --> My Interface --> Code Initialization --> i put a breakpoint here
When i press a "Print Preview" button, the program stops at the breakpoint. Then i press F7 which returns me to the function module /1BCDWB/SM00000020, that was generated for my Smart Form. Next a few objects get performed (each object calls the next one in the list):
--> Subroutine %WORK
--> subroutine %write_include_text
--> function module SSFRT_READ_INCLUDE_TEXT
--> subroutine read_include_text
--> function module LOAD_TEXT
These are standard SAP objects, that get automatically generated for my SmartForm / Interface.
Now in this LOAD_TEXT there is a global variable TEXT_HEADER, upon which depends what kind of a text the LOAD_TEXT returns:
- TEXT_HEADER is empty --> text gets read from database (FM READ_STDTEXT)
- TEXT_HEADER is not empty --> text doesnt get read from database, but is loaded from the memory
Now when the button "Print Preview" is pressed for the first time, the TEXT_HEADER is empty. LOAD_TEXT correctly reads the text using a FM READ_STDTEXT (TDID = ST, TDOBJECT = TEXT). When i change the data on the document and then press the "Print Preview" again, the TEXT_HEADER is not empty anymore and the LOAD_TEXT returns the text that was read the first time.
How can i initialize the TEXT_HEADER in the FM LOAD_TEXT, so that the text would be read from database every time ?
Thanks
HI Chris,
text of the document is presented as a standard text (transaction SO10) from which a note is automatically generated when saving the document. In the text there is some variable data specific to a document (i.e. the values of a certain Z fields of the CRMD_PARTNER).
The Smart Form has two "containers", one of which is the note text. FM LOAD_TEXT reads a note (NAME = document GUID, ID = ST, OBJECT = TEXT).
I checked the CRMD_PARTNER data in the Initialization Code and its updated to correct (new) values.
the problem is in the LOAD_TEXT function module:
IF OBJECT NE OBJECT_TEXT AND OBJECT NE OBJECT_GRAPH.
CALL FUNCTION 'READ_TEXT'
EXPORTING OBJECT = OBJECT
NAME = NAME
ID = ID
LANGUAGE = LANGUAGE
IMPORTING HEADER = HEADER
TABLES LINES = LINES
EXCEPTIONS OTHERS = 1.
IF SY-SUBRC NE 0.
RAISE NOT_FOUND.
ENDIF.
ELSE.
TEXT_KEY-TDOBJECT = OBJECT.
TEXT_KEY-TDNAME = NAME.
TEXT_KEY-TDID = ID.
TEXT_KEY-TDSPRAS = LANGUAGE.
READ TABLE TEXT_HEADER WITH KEY TEXT_KEY BINARY SEARCH.
SUBRC = SY-SUBRC.
TABIX = SY-TABIX.
IF SUBRC = 0.
IF TEXT_HEADER-LINES = 0.
RAISE NOT_FOUND.
ELSE.
HEADER = TEXT_HEADER.
PERFORM MM_SET USING 'TEXT_LINES' TEXT_HEADER-LINES.
ENDIF.
ELSE.
ADD 1 TO TEXT_HEADER_FOUND.
PERFORM MM_SET USING 'TEXT_LINES' TEXT_HEADER_FOUND.
IF OBJECT = OBJECT_TEXT.
* allow secondary language for standard texts
CALL FUNCTION 'READ_STDTEXT'
EXPORTING
ID = ID
LANGUAGE = LANGUAGE
NAME = NAME
USE_AUX_LANGUAGE = USE_AUX_STDTXT_LANG
IMPORTING HEADER = THEAD
TABLES LINES = TEXT_LINES
EXCEPTIONS OTHERS = 1.
FOUND = SY-SUBRC.
IF FOUND = 0 AND THEAD-TDSPRAS <> LANGUAGE.
THEAD-TDSPRAS = LANGUAGE.
ENDIF.
ELSE.
CALL FUNCTION 'READ_TEXT'
EXPORTING OBJECT = OBJECT
NAME = NAME
ID = ID
LANGUAGE = LANGUAGE
IMPORTING HEADER = THEAD
TABLES LINES = TEXT_LINES
EXCEPTIONS OTHERS = 1.
FOUND = SY-SUBRC.
ENDIF.
IF FOUND = 0.
TEXT_HEADER = THEAD.
TEXT_HEADER-LINES = TEXT_HEADER_FOUND.
ELSE.
TEXT_HEADER = TEXT_KEY.
TEXT_HEADER-LINES = 0.
SUBTRACT 1 FROM TEXT_HEADER_FOUND.
ENDIF.
CASE SUBRC.
WHEN 4. INSERT TEXT_HEADER INDEX TABIX.
WHEN 8. APPEND TEXT_HEADER.
ENDCASE.
IF FOUND NE 0.
RAISE NOT_FOUND.
ENDIF.
ENDIF.
* refresh lines.
HEADER = TEXT_HEADER.
* loop at text_lines.
* lines = text_lines.
* append lines.
* endloop.
LINES[] = TEXT_LINES[].
ENDIF.
I bolded the line, where TEXT_HEADER is read. Like i wrote previously it all depends on this TEXT_HEADER being empty or not. When pressing the button for the 1st time TEXT_HEADER is empty, on every additional button press TEXT_HEADER is not empty (it has 2 entries for each SmartForm container). Why is it not empty ?
Hi Christophe,
i did some additional testing:
If i run the SmartForm in SAP GUI, the PDF shows new data.
Steps:
1.) First run of the SmartForm in SAP GUI
2.) Change of data in CRM_UI
3.) Delete the document's note and save the document --> a new note gets generated
4.) Second run of the SmartForm in SAP GUI --> PDF shows new data
So there is a difference of "Print Preview":
- SAP GUI works correctly
- CRM_UI does not work correctly
Im thinking it could be a problem with the parameters SFPDOCPARAMS and SFPOUTPUTPARAMS, that are used when calling the SmartForm FM. The parameters are set as this:
ls_outputparams-nodialog = 'X'.
ls_outputparams-getpdf = 'X'.
ls_outputparams-connection = 'ADS'.
CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
ie_outputparams = ls_outputparams
EXCEPTIONS
cancel = 1
usage_error = 2
system_error = 3
internal_error = 4
OTHERS = 5.
ls_docparams-country = 'SI'.
ls_docparams-langu = sy-langu.
CALL FUNCTION lv_name
EXPORTING
/1bcdwb/docparams = ls_docparams
I_HEADER_GUID = ls_orderadm_h_wrk-guid
IMPORTING
/1bcdwb/formoutput = ls_formoutput
EXCEPTIONS
usage_error = 1
system_error = 2
internal_error = 3
OTHERS = 4.
What do you think ?
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.