Application Development and Automation 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: 
Read only

Printing Boxes in sap-script

Former Member
0 Likes
1,531

Hi,

I want to display boxes for line items of a purchase order in the output of a sapscript.I wrote the box command under text-element for display line item.Now

my problem is these boxes should come in output multiple times means how many line items with corresponding line items.

How i'll be able to do this?Please suggest on this.

Thanks

Bprakash Soni

9 REPLIES 9
Read only

Former Member
0 Likes
1,052

Hi,

IF this is with in the main window then it(main window) will be in the loop, so write the BOX command over there then it will apear as many Items as there in the Table,

or else write a Element, with in this element call the BOX command, in the Print Program call this Element with the loop, this loop trigger as many Lines as there in the Table

Thanks

Sudheer

Read only

0 Likes
1,052

Hi,

I have done already with the same but boxes are not displaying,even line items are displaying.Only one

line item is displaying with boxes.Below is the code which i wrote,please refer this and suggest.

Thanks

Bprakash Soni

main window

ITEM_LINE_3F_PRICE(Text element)

BOX XPOS '0.0' CM YPOS '1.0' CM WIDTH '1.5' CM HEIGHT 2 CM FRAME 10 TW

BOX XPOS '1.5' CM YPOS '1.0' CM WIDTH '2.5' CM HEIGHT 1 CM FRAME 10 TW

BOX XPOS '4.0' CM YPOS '1.0' CM WIDTH '3.0' CM HEIGHT 1 CM FRAME 10 TW

BOX XPOS '7.0' CM YPOS '1.0' CM WIDTH '3.0' CM HEIGHT 1 CM FRAME 10 TW

BOX XPOS '10.0' CM YPOS '1.0' CM WIDTH '3.0' CM HEIGHT 1 CM FRAME 10 TW

BOX XPOS '13.0' CM YPOS '1.0' CM WIDTH '1.8' CM HEIGHT 1 CM FRAME 10 TW

BOX XPOS '14.8' CM YPOS '1.0' CM WIDTH '1.5' CM HEIGHT 1 CM FRAME 10 TW

BOX XPOS '16.3' CM YPOS '1.0' CM WIDTH '3.0' CM HEIGHT 1 CM FRAME 10 TW

&EKPO-EBELP& &EKPO-EMATN& &EKPO-TXZ01& &EKET-EINDT& &EKET-UZEIT& &EKPO-MENGE& &EKPO-MEINS& &EKPO-KONNR&&EKPO-KTPNR&

Read only

Former Member
0 Likes
1,052

hi prakash,

write the commands for displaying box immediately after the command to diaplay line items in the script.

Also take care that the text element u use for the line items is inside a loop.

reward if it helps u.

regards,

keerthi.

Read only

0 Likes
1,052

Hi,

I have already done this as u suggested.My problem

is that how i have to take care on y-position(if i am

taking the internal tables lines in varibles,that will

also increase the box position it will not solve my problem).i want according to lines records in itab

boxes should repeat sync with increasing line items and display in print output.Alread my text element is inside the loop and in main window also.

Thanks

Bprakash Soni

Read only

0 Likes
1,052

BOX X and Y position are calculated from the window top left corner.

Increment Y-position by the hight of the box for every line in the print program.

first line: Y position can be 0, second line: 0+box height, 3rd line: previous yposition + box height.

Regards

Sridhar

Read only

Former Member
0 Likes
1,052

hi,

ex: its in a text element BOX

loop at itab.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'BOX'

  • 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.

endloop.

Read only

0 Likes
1,052

Hi,

Could you little bit elobrote it bcoz i m not getting it

properly.As per my understanding i have to make a text element name 'BOX' n than write the box commands under this element and also write write_form function module in driver program.If i m getting you properly could please tell me how it works sothat i can able to follow

this correctly.

Thanks

Bprakash Soni

Read only

Former Member
0 Likes
1,052

HI,

In the SAPSCRIPT, with in the element, maintain the Startign position and ending position

<b>/: BOX XPOS 1 CM YPOS 1 CM WIDTH 18 CM HEIGHT 1 CM FRAME 10 TW INTENSITY 10</b>

call this element in the Printprogram with in the loop

Thanks

Sudheer

Read only

Former Member
0 Likes
1,052

Hi prakash,

FORM SCRIPT .

select single ersda from mara into v_ersda

WHERE MATNR = IT_MATERIAL-MATNR.

SELECT pstat

werks

EKGRP

PRCTR

MINLS

MAXLS INTO corresponding fields of TABLE IT_SCRIPT FROM

MARC

WHERE MATNR = IT_MATERIAL-MATNR.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

  • APPLICATION = 'TX'

  • ARCHIVE_INDEX =

  • ARCHIVE_PARAMS =

  • DEVICE = 'PRINTER'

  • DIALOG = 'X'

FORM = 'ZFINAL_13688'

LANGUAGE = SY-LANGU

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.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'TOP'

  • FUNCTION = 'SET'

TYPE = 'TOP'

WINDOW = 'MAIN'

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.

LOOP AT IT_SCRIPT.

CALL FUNCTION 'WRITE_FORM'

EXPORTING

ELEMENT = 'NEW'

  • FUNCTION = 'SET'

TYPE = 'BODY'

WINDOW = 'MAIN'

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.

ENDLOOP.

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.

endform.

/E TOP

  • plant,,status,,GROUP,,Profit,,Min.Size,,Max.Size

/: BOX FRAME 10 TW

/: BOX YPOS 2 CH HEIGHT 0 CM FRAME 10 TW

/* BOX XPOS 15 CH WIDTH 0 CM FRAME 10 TW

/* BOX XPOS 28 CH WIDTH 0 CM FRAME 10 TW

/* BOX XPOS 35 CH WIDTH 0 CM FRAME 10 TW

/* BOX XPOS 42 CH WIDTH 0 CM FRAME 10 TW

/* BOX XPOS 55 CH WIDTH 0 CM FRAME 10 TW

/E NEW

  • &IT_SCRIPT-pstat(C)&,,&IT_SCRIPT-werks(C)&,,

= &IT_SCRIPT-EKGRP(C)&,,&IT_SCRIPT-PRCTR(C)&,,

= &IT_SCRIPT-MINLS(C)&,,&IT_SCRIPT-MAXLS(C)&

/: BOX FRAME 10 TW

/: BOX YPOS 2 CH HEIGHT 0 CM FRAME 10 TW

/: BOX YPOS 4 CH HEIGHT 0 CM FRAME 10 TW

/: BOX XPOS 15 CH WIDTH 0 CM FRAME 10 TW

/: BOX XPOS 28 CH WIDTH 0 CM FRAME 10 TW

/: BOX XPOS 35 CH WIDTH 0 CM FRAME 10 TW

/: BOX XPOS 42 CH WIDTH 0 CM FRAME 10 TW

/: BOX XPOS 55 CH WIDTH 0 CM FRAME 10 TW

do this in main window.

also write the command

/: BOX YPOS 2 CH HEIGHT 0 CM FRAME 10 TW

as many times as the no. of line items that can fit in the table by increasinf height of box from to 2 to 4 or 6 ...

hope this helps.

do reward if helpful.

regards,

keerthi.