Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with printing global data in function module

Former Member
0 Kudos
96

Hi,

I use ZMY function group,

in Include Z...TOP i've declared

DATA: palnum TYPE i,

allpal TYPE i.

TABLES: VTTP, VTTK, T001W, VTPA, KNA1, LIPS, VBKD, ADRC, LTAK.

then I've created function module ZWM_PRINT

and do:

FUNCTION ZWM_PRINT.

*"----


""Lokalny interfejs:

*" IMPORTING

*" REFERENCE(TANUM) TYPE LTAK-TANUM

*"----


DATA lt_printer LIKE itcpo OCCURS 1 WITH HEADER LINE.

select single * from LTAK where tanum = tanum.

select single * from VTTP where vbeln = ltak-vbeln.

select single * from VTTK where tknum = vttp-tknum.

  • select single * from VEVW where handle = vekp-handle and object = '05'.

select single * from T001W where werks = 'ZC00'.

select single * from VTPA where vbeln = vttk-tknum and PARVW

= 'WE'.

select single * from KNA1 where kunnr = vtpa-kunnr.

select single * from LIPS where vbeln = ltak-vbeln.

select single * from VBKD where vbeln = lips-vgbel.

select COUNT(*) into allpal from ZWM_NUMPAL where vbeln = ltak-vbeln.

select single pos into palnum from ZWM_NUMPAL where vbeln = ltak-vbeln and tanum = ltak-tanum.

if kna1-XCPDK = 'X'.

select single * from ADRC where ADDRNUMBER = vtpa-adrnr.

endif.

lt_printer-TDCOPIES = 1.

lt_printer-TDDEST = 'LOCP'.

lt_printer-TDDEST = 'IMEC'. "'Intermec EasyCoder 3400'.

lt_printer-TDDEST = '_TES'.

lt_printer-tdprinter = 'PRINTER'.

lt_printer-TDPREVIEW = 'X'.

lt_printer-TDDATASET = 'SCRIPT'.

  • lt_printer-TDSUFFIX1 = 'LP01'.

  • lt_printer-TDSUFFIX2 = 'LEON'.

lt_printer-TDIMMED = 'X'.

lt_printer-TDDELETE = 'X'.

lt_printer-TDLIFETIME = 1.

  • ** utworzenie wydruku

CALL FUNCTION 'OPEN_FORM'

EXPORTING

DEVICE = 'PRINTER'

FORM = 'ZWM_SSCCETYK3'

DIALOG = ''

OPTIONS = lt_printer

EXCEPTIONS

CANCELED = 1

DEVICE = 2

FORM = 3

OPTIONS = 4

UNCLOSED = 5

OTHERS = 6.

IF SY-SUBRC <> 0.

WRITE 'B&#321;&#260;D OPEN_FORM (001)'.

ENDIF.

  • ** pocz&#261;tek definicji wydruku

CALL FUNCTION 'START_FORM'

EXCEPTIONS

OTHERS = 1.

IF SY-SUBRC <> 0.

WRITE 'B&#321;&#260;D START_FORM'.

ENDIF.

  • ** definicja

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'DUMMY'

EXCEPTIONS

OTHERS = 1.

IF SY-SUBRC <> 0.

WRITE 'B&#321;&#260;D WRITE_FORM'.

ENDIF.

  • ** koniec definicji

CALL FUNCTION 'END_FORM'

EXCEPTIONS

OTHERS = 1.

IF SY-SUBRC <> 0.

WRITE 'B&#321;&#260;D END_FORM '.

ENDIF.

  • ** koniec wydruku

CALL FUNCTION 'CLOSE_FORM'

EXCEPTIONS

OTHERS = 1.

IF SY-SUBRC <> 0.

WRITE 'B&#321;&#260;D CLOSE_FORM'.

ENDIF.

ENDFUNCTION.

And when I see printed document there is no data 😕

Why ??

Tables are declared globally so should be filled.

In debuger II've checked that thay are filled but SapScript can't see them.

Please help.

Regards,

Greg.

1 REPLY 1

Former Member
0 Kudos
40

Hi,

Where are your write statments?

The tables are filled but you have to read the data from those internal tables and write it using write statements.

Hope this helps.

Thanks

Sanjeev