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: 

scripts(label printing)

Former Member
0 Kudos

Hi everyone,

I have created a Form which contains 2 main windows (Main 00 and Main 01)..I am trying to print labels using these windows calling from the program, but i am unable to do..<b>How do i call 2 main windows from the Print Progarm?</b> please anyone can help in creating Labels of the customer addresses...Its very urjent.

Thanks in Advance,

Gupta.G

5 REPLIES 5

madan_ullasa
Contributor
0 Kudos

hi,

try passing the window name in your 'write_form' function module.

reward points if useful.

regards,

Madan..

0 Kudos

Please include command new page in MAIN window .

/: NEW-WINDOW

0 Kudos

Hi,

Thanks for ur reply..but the problem is,

i have used a write_form's...but if i am calling 2 main windows from the form, it displays a message that <b>Main window does not exist</b>...plz find the below code that i have executed.

TABLES: ADRC.

DATA: BEGIN OF IT_ADRC OCCURS 0,

ADDRNUMBER LIKE ADRC-ADDRNUMBER,

NAME1 LIKE ADRC-NAME1,

NAME2 LIKE ADRC-NAME2,

END OF IT_ADRC.

SELECT-OPTIONS: S_ADDRNO FOR ADRC-ADDRNUMBER.

SELECT ADDRNUMBER

NAME1

NAME2

FROM ADRC

INTO CORRESPONDING FIELDS OF TABLE IT_ADRC

WHERE ADDRNUMBER IN S_ADDRNO.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

  • DEVICE = 'PRINTER'

  • DIALOG = 'X'

FORM = 'ZJ_LABELS'

LANGUAGE = SY-LANGU.

  • IMPORTING

  • LANGUAGE = SY-LANGU.

LOOP AT IT_ADRC.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'LAB'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN 00'.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'LAB'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN 01'.

ENDLOOP.

CALL FUNCTION 'CLOSE_FORM'.

0 Kudos

Hi,

Thanks for ur reply..but the problem is,

i have used 2 write_form's...but if i am calling 2 main windows from the form, it displays a message that <b>Main window does not exist</b>...plz find the below code that i have executed.

TABLES: ADRC.

DATA: BEGIN OF IT_ADRC OCCURS 0,

ADDRNUMBER LIKE ADRC-ADDRNUMBER,

NAME1 LIKE ADRC-NAME1,

NAME2 LIKE ADRC-NAME2,

END OF IT_ADRC.

SELECT-OPTIONS: S_ADDRNO FOR ADRC-ADDRNUMBER.

SELECT ADDRNUMBER

NAME1

NAME2

FROM ADRC

INTO CORRESPONDING FIELDS OF TABLE IT_ADRC

WHERE ADDRNUMBER IN S_ADDRNO.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

  • DEVICE = 'PRINTER'

  • DIALOG = 'X'

FORM = 'ZJ_LABELS'

LANGUAGE = SY-LANGU.

  • IMPORTING

  • LANGUAGE = SY-LANGU.

LOOP AT IT_ADRC.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'LAB'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN 00'.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'LAB'

FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN 01'.

ENDLOOP.

CALL FUNCTION 'CLOSE_FORM'.

0 Kudos

Hi Jagadish,

In the code the <b>MAIN 00</b> and <b>MAIN 01</b> are the same (i.e) you cannot create two MAIN windows whereas you have created an instance of the MAIN window and named them MAIn 00 and MAIN 01.

With respect to the code, the only change has to be

LOOP AT IT_ADRC.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'LAB'

FUNCTION = 'SET'

TYPE = 'BODY'

<b>WINDOW = 'MAIN'.</b>

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'LAB'

FUNCTION = 'SET'

TYPE = 'BODY'

<b>WINDOW = 'MAIN'.</b>

ENDLOOP.

It has to be just <b>MAIN</b>. This will definitely work.

Reward if helpful.

Regards,

Tushar