Printing itab in SAP SCRIPT
Hi,
I have a internal table in my Routine having Multiple line items. I want to print them through the Script. I want to pass the internal table line items to the output form, as we can't loop on PERFORM in the script editor.
I have tried using FMs like
OPEN_FORM.
loop at itab.
WRITE_FORM.
endloop.
CLOSE_FORM.
But they are also not working for me. When I debug the very first FM - OPEN_FORM, there only it checks for "co-perform-active <> TRUE" and then directly jumps to ENDFUNCTION. The same is happening for all the Function Modules (WRITE_FORM and CLOSE_FORM).
Is there any other way of doing it? If not, then please tell me each and every step, how to do this.
Further, how to pass ELEMENTS and WINDOWS in WRITE_FORM. Also how to write the Elements (we want to print on the form) in the Script Editor. If possible, please gimme some code which is working perfectly.
Any help would be greatly appreciated.
Thanks,
Saras
hi!!!!!!!!!!!!
here is the sample code of mine
*& Report ZKR_SCRIPT1 *
REPORT zkr_script1 .
TABLES: mara.
TYPES: BEGIN OF it_type,
matnr TYPE mara-matnr,
mtart TYPE mara-mtart,
mbrsh TYPE mara-mbrsh,
matkl TYPE mara-matkl,
meins TYPE mara-meins,
END OF it_type.
DATA: it_tab TYPE STANDARD TABLE OF it_type,
is_tab TYPE it_type.
START-OF-SELECTION.
SELECT * FROM mara
INTO CORRESPONDING FIELDS OF TABLE it_tab
UP TO 30 ROWS.
IF sy-subrc <> 0.
EXIT.
ELSE.
PERFORM z_open_form.
PERFORM z_write_form.
PERFORM z_close_form.
ENDIF.
*& Form z_open_form
FORM z_open_form .
CALL FUNCTION 'OPEN_FORM'
EXPORTING
device = 'PRINTER'
dialog = 'X'
form = 'ZKR_FORM1'
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.
ENDFORM. " z_open_form
*& Form z_write_form
FORM z_write_form .
LOOP AT it_tab INTO is_tab.
AT FIRST.
CALL FUNCTION 'START_FORM'
EXPORTING
form = 'ZKR_FORM1'
language = sy-langu
startpage = 'FIRST'
EXCEPTIONS
form = 1
format = 2
unended = 3
unopened = 4
unused = 5
spool_error = 6
codepage = 7
OTHERS = 8.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDAT.
AT NEW matnr.
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'E1'
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.
ENDAT.
AT LAST.
CALL FUNCTION 'END_FORM'
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
spool_error = 3
codepage = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDAT.
ENDLOOP.
ENDFORM. " z_write_form
*& Form z_close_form
FORM z_close_form .
CALL FUNCTION 'CLOSE_FORM'
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. " z_close_form
plz reward if helpul...
Similar Messages
-
How to print u0080 in SAP Script
Hi Experts,
I have one small issue, i want to print symbol in sap script. If i puts this an hardcode vallue, but its not accepting this symbol.
Plz anyone guide this, how to display and print the above symbel in script.
This symbol is not available in displayable charactor area also.
Point will be sure.
Regards,
MohanaForm to translate unicode symbol to superscript
you can use this in subroutine i think this may be usefull to you before that you need to select the radio button of super script in charecter format for that perticular format
FORM FORM_NAME TABLES inttab STRUCTURE itcsy
outtab STRUCTURE itcsy.
*Data Declaration.
DATA : V_TEXT1(320).
DATA: BEGIN OF ITAB OCCURS 0,
WORD(40),
END OF ITAB.
READ TABLE inttab INDEX 1.
V_TEXT1 = inttab-value.
REPLACE ALL OCCURRENCES OF '' IN V_TEXT1 WITH '<SP></>'.
READ TABLE outtab INDEX 1.
IF SY-SUBRC = 0.
MOVE V_TEXT1 TO outtab-value.
MODIFY outtab INDEX 1.
ENDIF.
ENDFORM -
How to use print control in Sap script
I would like to use print control in Sap script.Actualy my problem I have security font Troy ECF. Using this font I would like to print amount field in Check printing.
we count download this font with sap .we talked to customer care they told we should hard code in sapscript. pls can any1 help on this how to do and how to use print control for this fonts.call this funcation. crate_text.
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
FID =
FLANGUAGE =
FNAME =
FOBJECT =
SAVE_DIRECT = 'X'
FFORMAT = '*'
TABLES
FLINES =
EXCEPTIONS
NO_INIT = 1
NO_SAVE = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
How to Hide Print Privew Option (Sap Script)
hi friends,
i dont want print privew option (SAP SCRIPT) after executing the program the report shows output directly insted of showing print privew option.
please reply.
thanks in advance.
regards,
bhaskarHello,
When using the OPEN_FORM
Set the field of the <b>
ITCPO-TDNOPREV = 'X'
</b>
VAsanth -
Printing checkboxes in SAP script
Hi,
I have a requirement where I need to print checkboxes for all the items displayed in SAP Script output.
Is there any way to print checkboxes in the output document?
Regards,
Rajesh BhogiHi Rajesh,
Below link can be useful for you:
How to print u0080 in SAP Script
Hope this will help.
Regards,
Nitin. -
Search print program and sap script
hii , how can i find trigring print program and sap script for a particular purchase order.
regards Aditya
Edited by: aditya shrivastaba on Apr 14, 2008 9:59 AMHey,
First go with Me22 or 23 with po that you had, and then check with output type for that in the transaction. After that go to TNAPR table and check the corresponding form and print program.
Or else, go with NAST table in that put PO num in 123456 and put in OBJKY field in nast table. It will give you the output type of it, so that u can find the print program and lay out in TNAPR
Many thanks,
Raghu. -
How to know print program for SAP Script
Hi friends,
how to know print program for SAP Script form name ?Hi ,
You can use the following code changes in the layout & see..
You have to create a program Z_BC460_EX4_HF for that..
/:PERFORM GET_NAME IN PROGRAM Z_BC460_EX4_HF
/: USING &CUST&
/: CHANGING &NAME&
/:ENDPERFORM.
Dear &NAME&
The ABAP routine could be defined as follows:
IMPORTANT: The structure itcsy must be used for the parameters.
REPORT Z_HENRIKF_SCRIPT_FORM .
tables scustom.
form get_name tables in_tab structure itcsy
out_tab structure itcsy.
read table in_tab index 1.
select single * from scustom
where id = in_tab-value.
if sy-subrc = 0.
read table out_tab index 1.
move scustom-name to out_tab-value.
modify out_tab index sy-tabix.
else.
read table out_tab index 1.
move 'No name' to out_tab-value.
modify out_tab index sy-tabix.
endif.
You could also fill the ouput parameter table this way
READ TABLE out_par WITH KEY 'NAME1'.
out_par-value = l_name1.
MODIFY out_par INDEX sy-tabix.
endform. -
What is print program for sap script?
some of the print program of sap script.
and also guide me to use that programfor which sapscript ?
you can use table TNAPR to find the print program and layoutset for output types. Maybe it will help you.
regards,
Hans -
Hi,
though seems very simple but I am stick:(
I want to add a a table in a existing sapscript which shold always print on the last page.
I am not very good in sap script and text element so all the text elements are defined with right form I defined mine.
but when I am executing the form getting the error Element 705 window FOOTER is not defined for form ...
one weird thing when I am changing something to window othe text element go negative i.e. 700 becomes -700 and next time another error...
Anybody any Idea??Might be printing from which written like this fasion:
INCLUDE 'SD_RVADIN01' OBJECT TEXT ID SDVD PARAGRAPH ZB.
Search it and see text in SO10 -
Issue in alignment of PE51 data when printing it in SAP Script
Hi Experts
I have a SAP Script which is used to print Check at the top and Re-numeration Statement at the second half via RFFOUS_C program. The re-numeration statement is designed in PE51. The Check is designed in SAP Script and the PE51 form is printing inside the script using Main window/ Text Element : 525-HR.
The FM RP_IMPORT_PAY_STATEMENT is used inside the RFFOUS_C program which returns the table PFORM and the contents of the PFORM is exactly the re-numeration statement data and are getting printed one by one in the script using the variable REGUD-TXTHR. My object is fine with all the above said things. Only issue is with the alignment which is weird in SAP Script for the re-numeration part. But when I look into PC00_M10_CEDT (TCODE to view re-numeration statement) the output of designed PE51 form is good with proper alignment.When it is printed via script the alignment is not good at all.
There is some differences in the formats of printing between PE51 and SE71. Do not know what exactly it is. How I can resolve this issue?
Thanks
Siva
Message:SivaHi Madhu,
Sorry for the delayed response.See the below screen shot.This is how it prints now.The amounts are not aligned.Increasing the line spacing will increase only the space between the lines and i am using same character format for the variable REGUD-TXTHR.I would like to align them.
Thanks
Siva -
How to print lables in SAP SCRIPT
Hi all,
Here i have a requirement in SAP Script How to print the lables instead of Hard coding the field Description. Please help me how to do.
Regards
RaghavaHi
First Create a Lable in script
Refer This link for creation of lable in SAP SCRIPT
How to create lables in SAP SCRIPTS?
Ranga -
How to print ADDRESS in SAP Script
Hi All,
I want to print address using ADDRESS command in SAP script. I am using folowing code:
ADDRESS PARAGRAPH AS
TITLE &ADRS-ANRED&
NAME &ADRS-NAME1&, &ADRS-NAME2&,
STREET &ADRS-STRAS&
POBOX &ADRS-PFACH& CODE &ADRS- PSTL2& CITY &ADRS-PFORT&
POSTCODE &ADRS-PSTLZ&
REGION &ADRS-REGIO&
CITY &ADRS-ORT01&, &ADRS-ORT02&
COUNTRY &ADRS-LAND1&
FROMCOUNTRY &ADRS-INLND&
ENDADDRESS
Here in output I am getting Title, name1, & name2 in different lines. But I want that Title, name1 and name2 in same line.
I tried putting title, name1 and name2 in same line but then neither title nor name1, name2 are getting displayed.
Please tell me how I can do the same.
I have heard that SAP displays the address according to country standard. Please let me know in which table the country specific setting is stored.
Regards,
VijayHi,
country code stored in this T005T. Adjust the tab positions on script then only u will get all the title, name1, name2 will get in one line.
regards,
ravi shankar reddy -
Problem with printing graphics in SAP Script
Hi,
I am facing problem with printing of graphics in SAP Script. I uploaded a bitmap file from pc to se78. Then I inserted it in SAP script.
I am able to view it in the printpreview as well as in the spool number. But it is not getting printed.
Plese tell me the solution.
Thanks,
SrinivasYou need to check your printer settings.Might be drivers are missing.
-
Convert OTF along with Print preview in SAP Script
Hello All,
I was getting a print Preview for the sap script, now with the new requirement, I had to capture otf data too in OPEN_FORM. so I have added "TDGETOTF = X", and that gives me otf data which I am converting it to PDF. now the problem is I am not getting preview anymore. my requirement is to have both, Preview and otf data. I have tired serching in forums and also used a function module SSFCOMP_PDF_PREVIEW, but no luck. what am I missing here. Please suggest.
Thanks-
TDPAGESLCT
TDCOPIES 1
TDDEST LOCL
TDPRINTER
TDPREVIEW X
TDNOPREV
TDNOPRINT
TDNEWID X
TDDATASET SAP11
TDSUFFIX1 LOCL
TDSUFFIX2 1000
TDIMMED
TDDELETE
TDLIFETIME 7
TDSCHEDULE
TDSENDDATE 00000000
TDSENDTIME 000000
TDTELELAND
TDTELENUM
TDTITLE
TDTEST
TDPROGRAM
TDSCRNPOS 000000000000000
TDCOVER D
TDCOVTITLE
TDRECEIVER ABCDEFGH
TDDIVISION
TDAUTORITY
TDARMOD
TDIEXIT
TDGETOTF X
TDFAXUSER
TDRDIDEV
TDNOARMCH
TDFINAL
RQPOSNAME
BCS_REQST
BCS_STATUSMaybe you can call the form twice - once with tdgetotf = 'X', the second time with it blank.
-
Problem printing box in sap script
i am printing the main window in a box in sap script, the box is appearing on page one but it does not seem to appear on the later pages, how do i get it to appear on all the pages? is there any setting that i'm missing?
Hi,
Can you elobrate your question.
if your question is like this.
-> You have only one page you are displaying the data in that box and that data is exceeding the main window and printing in
the second page and you are not getting the BOX in the second page .
a) If it is your question check whether there is any if condition
before the BOX command like
/: if &page& = 1.
/: BOX height 5 ln width 50 ch
/: Endif.
remove the if condition there.
or
/E ele1.
/: BOX height 5 ln width 50 ch
place the Box statement in the first line of that window.
-> You have two pages .
a) If it is so check wheter the box command is there in both
pages.
Thanks,
NN.
Maybe you are looking for
-
How to track changes made in the ERD in oracle designer
I want to track all changes made in my ERD in oracle 10g designer. Please suggest how to achieve it. use case: An ERD was approved in design phase. Few changes were made by development team and now in Implementation phase I need to track what all cha
-
A few questions from someone considering whether to buy an Airport Extreme
Hi there, I've spent the last couple of months grapping with an APPALLINGLY bad router from D-Link that has had more problems I can count on all my fingers and toes. I'm deciding between whether to replace it with kit from Netgear, Belkin or Apple. I
-
Is there an AUDIT option like AFTER SERVERERROR database trigger?
I want to log any and every error-exception in a test database for a period. I have seen DBMS_UTILITY.FORMAT_ERROR_BACKTRACE article published on Oracle Magazine; http://www.oracle.com/technology/oramag/oracle/05-mar/o25plsql.html But before trying t
-
Parameter on the selection screen
Hi All, I have a check box and a parameter on the selection screen. If the checkbox is initial, the paramter shouldn't be editable but if the checkbox is ticked, the parameter should be made mandatory to be enetered with value. How can this be done ?
-
IPad Keynote presentation via airplay - how do you zoom in
When playing a Keynote presentation on ipad to a monitor via airplay, how do you zoom into a slide? The "expand/pinch" 2-finger method just ends the presentation.