2007 Dec 06 11:43 AM
This one is slightly difficult. About SAP Standard code and the need to modify the same. Experts, Moderators, suggest ...
Regarding - HR Module, ESS , (INDIA) , Form 16
Transaction - HRESSIN_F16 (Display Form 16)
The system has been upgraded from version 4.6C to 6.0 . It is a Non-Unicode system.
Expected behaviour - The program is to display the employee's Form16 in the PDF format.
However, nothing is displayed in the container provided on the screen.
On debugging, we observed the following -
CALLING STACK is as follows ::
-The variable PNPESSCF is flagged X to indicate ESS.
-The program HINCF160 calls subroutine DISPLAY_LIST ( PERFORM DISPLAY_LIST. )
- In DISPLAY_LIST, after suppressing ALV display, it calls subroutine PRINT_MODULE . ( PERFORM PRINT_MODULE. )
- In PRINT_MODULE (Include PCF16IN4 ), All the required Data is fetched in the OTF_TABLE internal table and CLOSE_FORM is called ( PERFORM CLOSE_FORM ).
- In form CLOSE_FORM (Include PCSAPIN0 ) standard SAP Function MOdule CLOSE_FORM is called. For ESS Scenario, like here, subroutine report_data_convert_tables is called.
In the Original Code (HINCF160, Include PCSAPIN0 ) we see that a statement has been commented out and another line has been inserted. The code has been pasted below --
BEGIN OF ESS CHANGES
IF PNPESSCF = 'X'.
perform report_data_convert(saplhress00_rep) tables otf_table[].
perform report_data_convert tables otf_table[] . "RK1016444
ENDIF.
END OF ESS CHANGES
For other programs, the original (commented) perform statement has been used ie -
Example In like Tcode PZ11_PDF (Remuneration Statement),
(In Program SAPLHRESSXX_REP , Include LHRESSXX_REPF03 )
PERFORM report_data_convert(saplhress00_rep) TABLES job_output_info-otfdata.
Thus we have two slightly different form definitions of report_data_convert. This form converts the data to PDF format by using Function Module OTF_CONVERT .
In the correctly working program, the form definition is as follows -
----
INCLUDE RHESS00REP01 *
----
data: otf_Tab like itcoo occurs 0 with header line.
statics: cp like tcp00-cpcodepage.
otf_tab[] = otf_table[].
call function 'SYSTEM_CODEPAGE'
importing
current_dynamic_codepage = cp.
If Unicode system
if cp(1) = '4'.
call function 'CONVERT_OTF'
exporting
format = 'PDF'
importing
bin_filesize = pdf_fsize
bin_file = pdf_string_x
tables
otf = otf_table
lines = pdf_table
exceptions
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
others = 5.
export pdf_string_x to memory id 'PDFT'.
export pdf_fsize to memory id 'PDSZ'.
else.
call function 'CONVERT_OTF'
exporting
format = 'PDF'
importing
bin_filesize = pdf_fsize
tables
otf = otf_tab
lines = pdf_table
exceptions
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
others = 4.
export pdf_table to memory id 'PDFT'.
export pdf_fsize to memory id 'PDSZ'.
endif.
endform. "report_data_convert
Wherhas, in our incorrect working program ( Program HINCF160, Include PCSAPIN0 ) the form definition is as follows -
&----
*& Form report_data_convert "RK1016444
&----
Form report_data_convert tables otf_table structure itcoo.
data: otf_Tab like itcoo occurs 0 with header line.
statics: cp like tcp00-cpcodepage.
data: pdf_table type rcl_bag_tline,
pdf_string_X type xstring,
pdf_fsize type i.
otf_tab[] = otf_table[].
call function 'SYSTEM_CODEPAGE'
IMPORTING
current_dynamic_codepage = cp.
If Unicode system
if cp(1) = '4'.
call function 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = pdf_fsize
bin_file = pdf_string_x
TABLES
otf = otf_table
lines = pdf_table
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
err_bad_otf = 4
others = 5.
export pdf_string_x to memory id 'PDFT'.
export pdf_fsize to memory id 'PDSZ'.
export pdf_string_x to memory id 'PDFF_IN'.
export pdf_table to memory id 'PDFT_IN'.
export pdf_fsize to memory id 'PDSZ_IN'.
else.
call function 'CONVERT_OTF'
EXPORTING
format = 'PDF'
IMPORTING
bin_filesize = pdf_fsize
bin_file = pdf_string_x
TABLES
otf = otf_tab
lines = pdf_table
EXCEPTIONS
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
others = 4.
export pdf_table to memory id 'PDFT'.
export pdf_fsize to memory id 'PDSZ'.
export pdf_string_x to memory id 'PDFF_IN'.
export pdf_table to memory id 'PDFT_IN'.
export pdf_fsize to memory id 'PDSZ_IN'.
endif.
endform. "report_data_convert
POSSIBLE EXPLANATION
-
The difference between the two form definitions of report_data_convert is as follows -
For Non-Unicode systems ('Else' block), the Import parameters passed to function module CONVERT_OTF are different.
In the incorrectly working program,the import parameter 'pdf_string_x' has been passed, because of which the internal table 'pdf_table' stays empty.
In the correctly functioning program, the import parameter 'pdf_string_x' has not been passed, and the internal table 'pdf_table' is filled with converted data.
-
In the malfunctioning pgm, (HINCF160, Include PCSAPIN0 ) the statement (perform report_data_convert(saplhress00_rep) tables otf_table[].
) which has been commented out seems to be filling the PDF_TABLE correctly and the new statement ( perform report_data_convert tables otf_table[] . "RK1016444 ) which has been inserted is leaving PDF_TABLE empty.
Can the problem be fixed by simply reversing the commented and uncommented lines of the code of the program
ie. By Changing
BEGIN OF ESS CHANGES
IF PNPESSCF = 'X'.
perform report_data_convert(saplhress00_rep) tables otf_table[].
perform report_data_convert tables otf_table[] . "RK1016444
ENDIF.
END OF ESS CHANGES
to the following -
BEGIN OF ESS CHANGES
IF PNPESSCF = 'X'.
perform report_data_convert(saplhress00_rep) tables otf_table[].
perform report_data_convert tables otf_table[] . "RK1016444
ENDIF.
END OF ESS CHANGES
References -
Sapnote 689134 , Sapnote 486303 .
2008 Jan 30 8:55 PM
The problem was solving by undoing the code change done by SAP. ie Uncomment/Keep the original perform and comment the newly written perform
ie Repacing
BEGIN OF ESS CHANGES
IF PNPESSCF = 'X'.
perform report_data_convert(saplhress00_rep) tables otf_table[].
perform report_data_convert tables otf_table[] . "RK1016444
ENDIF.
END OF ESS CHANGES
With
BEGIN OF ESS CHANGES
IF PNPESSCF = 'X'.
perform report_data_convert(saplhress00_rep) tables otf_table[].
*perform report_data_convert tables otf_table[] . "RK1016444
ENDIF.
END OF ESS CHANGES
SAP has also released a note to this effect.