cancel
Showing results for 
Search instead for 
Did you mean: 

Printing problem

Former Member
0 Kudos

Hi all,

I have developed a new form and print program but while printing the form no data is getting printed even though data is there in the internal tables. I think we need to populate the ITCPO structure while calling the OPEN_FORM. i have populated only Program name eventhough values are not printing.

Can any one tell the reason?

Regards,

Bhushan

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hai,

We need not to use(populate) ITCPO Structure.

Just write in your driver program as:

loop at itab into wa.

call write_from function module?(better to pass with Text Element)

endloop.

At you Script editor write:

/: Text element name that you passed in the write_from.

&wa-field1& &wa-field1& &wa-field1&

Example:

DATA:

W_F_TOTAL TYPE P DECIMALS 2, " Carry Forward Total

W_P_TOTAL TYPE P DECIMALS 2, " Page Total

W_G_TOTAL TYPE P DECIMALS 2. " Grand Total

  • W_FLAG TYPE I. " End of Page

"----


  • Type declaration of the structure to hold spfli data

"----


DATA:

BEGIN OF FS_EMP,

PNAME LIKE

YASH_PROGRAMMER-PNAME, " Programmer Name

DOB LIKE

YASH_PROGRAMMER-DOB, " Date of Birth

DOJ LIKE

YASH_PROGRAMMER-DOJ, " Date of joining

SALARY LIKE

YASH_PROGRAMMER-SALARY, " Salary

END OF FS_EMP.

"----


  • Internal table to hold spfli data *

"----


DATA:

T_EMP LIKE STANDARD TABLE OF FS_EMP.

SELECT PNAME " Programmer Name

DOB " Date of Birth

DOJ " Date of joining

SALARY " Salary

INTO TABLE T_EMP

FROM YASH_PROGRAMMER. " SELECT PNAME

IF SY-SUBRC NE 0.

MESSAGE 'No records found in YASH_PROGRAMMER table' TYPE 'I'.

STOP.

ENDIF. " IF SY-SUBRC NE 0.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

  • APPLICATION = 'TX'

  • ARCHIVE_INDEX =

  • ARCHIVE_PARAMS =

  • DEVICE = 'PRINTER'

  • DIALOG = 'X'

FORM = 'YH650_060203'

  • LANGUAGE = SY-LANGU

  • OPTIONS =

  • MAIL_SENDER =

  • MAIL_RECIPIENT =

  • MAIL_APPL_OBJECT =

  • RAW_DATA_INTERFACE = '*'

  • SPONUMIV =

  • IMPORTING

  • LANGUAGE =

  • NEW_ARCHIVE_PARAMS =

  • RESULT =

EXCEPTIONS

CANCELED = 1

DEVICE = 2

FORM = 3

OPTIONS = 4

UNCLOSED = 5

MAIL_OPTIONS = 6

ARCHIVE_ERROR = 7

INVALID_FAX_NUMBER = 8

MORE_PARAMS_NEEDED_IN_BATCH = 9

SPOOL_ERROR = 10

CODEPAGE = 11

OTHERS = 12

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF. " IF SY-SUBRC <> 0.

LOOP AT T_EMP INTO FS_EMP.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'DATA'

  • FUNCTION = 'SET'

  • TYPE = 'BODY'

  • WINDOW = 'MAIN'

  • IMPORTING

  • PENDING_LINES =

EXCEPTIONS

ELEMENT = 1

FUNCTION = 2

TYPE = 3

UNOPENED = 4

UNSTARTED = 5

WINDOW = 6

BAD_PAGEFORMAT_FOR_PRINT = 7

SPOOL_ERROR = 8

CODEPAGE = 9

OTHERS = 10

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF. " IF SY-SUBRC <> 0.

  • ADD FS_EMP-SALARY TO W_F_TOTAL.

  • ADD FS_EMP-SALARY TO W_P_TOTAL.

  • ADD FS_EMP-SALARY TO W_G_TOTAL.

ENDLOOP. " LOOP AT T_EMP INTO FS_EMP.

CALL FUNCTION 'CLOSE_FORM'

  • IMPORTING

  • RESULT =

  • RDI_RESULT =

  • TABLES

  • OTFDATA =

EXCEPTIONS

UNOPENED = 1

BAD_PAGEFORMAT_FOR_PRINT = 2

SEND_ERROR = 3

SPOOL_ERROR = 4

CODEPAGE = 5

OTHERS = 6

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF. " IF SY-SUBRC <> 0.

Hope you can now print the data in the internal table.

Reward points if it helps you.

Regds,

Rama chary.Pammi

Former Member
0 Kudos

Hi Bhushan

Please go through this link and do the codeing as per the tutorial

this will 100 % resolve your problem

http://www.thespot4sap.com/Articles/SAPscript_elements.asp

Rewards the points

Dhananjay