Sap Script-FB02:How to format
Hi Experts,
Im trying to format a standard long text in sap. These long texts are created in transaction code FB02.
An example would be:
/:DEFINE &TEXTNAME& := '&BKPF-BUKRS()&&BKPF-BELNR(RF0)&&BKPF-GJAHR&'
/:INCLUDE &TEXTNAME& OBJECT BELEG ID 0001 LANGUAGE &RF140-SPRAS&
Im trying to format the font etc. Does any anyone know how to do this?
Thanks,
Michael
make use of HTML formatting tags. ex.
APPEND: '<table border=1 width=80%' TO lt_contents_txt,
'cellpadding=1 cellspacing=0>' TO lt_contents_txt,
'<tr>' TO lt_contents_txt,
'<td class=header>PR Number</td>' TO lt_contents_txt,
'<td class=header>PR Line Item</td>' TO lt_contents_txt,
'<td class=header>Description</td>' TO lt_contents_txt,
'<td class=header>PR Release Date</td>' TO lt_contents_txt,
'<td class=header>PR Qty</td>' TO lt_contents_txt,
'<td class=header>Remaining PR Qty</td>' TO lt_contents_txt,
'<td class=header>Unit of Measure</td>' TO lt_contents_txt,
'<td class=header>Requisitioner</td>' TO lt_contents_txt,
'<td class=header>Doc Type</td>' TO lt_contents_txt,
'<td class=header>Doc Type Description</td>' TO lt_contents_txt,
'</tr>' TO lt_contents_txt.
lt_contents_txt is the content of your email
Edited by: abapGenin on Sep 30, 2010 1:58 PM
Similar Messages
-
To convert Sap Script output to PDF format and send it via email.
Hi Friends,
Could any one please tell me, how to convert the Sap Script output to PDF format and send it via email. If any one have the code, kindly mail me to [email protected]
Thanks & Regards,
JohnPlese check this sample code from other thread.
REPORT zzz_jaytest .
Types Declaration
TYPES : BEGIN OF ty_pa0001,
pernr TYPE pa0001-pernr,
bukrs TYPE pa0001-bukrs,
werks TYPE pa0001-werks,
END OF ty_pa0001.
Internal Table Declaration
DATA : i_pa0001 TYPE STANDARD TABLE OF ty_pa0001, "For pa0001 Details
i_otf TYPE STANDARD TABLE OF itcoo, "For OTF data
i_content_txt TYPE soli_tab, "Content
i_content_bin TYPE solix_tab, "Content
i_objhead TYPE soli_tab,
Work Area Declaration
w_pa0001 TYPE ty_pa0001, "For pa0001 Details
w_res TYPE itcpp, "SAPscript output
"parameters
w_otf TYPE itcoo, "For OTF
w_pdf TYPE solisti1, "For PDF
w_transfer_bin TYPE sx_boolean, "Content
w_options TYPE itcpo, "SAPscript output
"interface
Variable Declaration
v_len_in TYPE so_obj_len,
v_size TYPE i.
Constants Declaration
CONSTANTS : c_x TYPE c VALUE 'X', "X
c_locl(4) TYPE c VALUE 'LOCL', "Local Printer
c_otf TYPE sx_format VALUE 'OTF', "OTF
c_pdf TYPE sx_format VALUE 'PDF', "PDF
c_printer TYPE sx_devtype VALUE 'PRINTER', "PRINTER
c_bin TYPE char10 VALUE 'BIN', "BIN
c_name TYPE string VALUE 'C:\ZZZ_JAYTEST.PDF',"Downloading
"File Name
c_form(11) TYPE c VALUE 'ZZZ_JAYTEST'. "Form Name
START-OF-SELECTION.
Selecting the records from pa0001
SELECT pernr bukrs werks FROM pa0001
INTO TABLE i_pa0001 UP TO 10 ROWS.
Setting the options
w_options-tdcopies = 1 ."Number of copies
w_options-tdnoprev = c_x."No print preview
w_options-tdgetotf = c_x."Return of OTF table
w_options-tddest = c_locl."Spool: Output device
Opening the form
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = c_form
device = c_printer
language = sy-langu
OPTIONS = w_options
IMPORTING
RESULT = w_res.
LOOP AT i_pa0001 INTO w_pa0001.
Writting into the form
CALL FUNCTION 'WRITE_FORM'
EXPORTING
element = 'MAIN'
window = 'MAIN'.
ENDLOOP.
Closing the form
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = w_res
TABLES
otfdata = i_otf
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.
Converting OTF data to single line
LOOP AT i_otf INTO w_otf.
CONCATENATE w_otf-tdprintcom w_otf-tdprintpar
INTO w_pdf.
APPEND w_pdf TO i_content_txt.
ENDLOOP.
Converting to PDF Format
CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'
EXPORTING
format_src = c_otf
format_dst = c_pdf
devtype = c_printer
CHANGING
transfer_bin = w_transfer_bin
content_txt = i_content_txt
content_bin = i_content_bin
objhead = i_objhead
len = v_len_in
EXCEPTIONS
err_conv_failed = 1
OTHERS = 2.
v_size = v_len_in.
Downloading the PDF File
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = v_size
filename = c_name
filetype = c_bin
TABLES
data_tab = i_content_bin.
The extension is put the it_mailpack-obj_name parameter of 'SO_NEW_DOCUMENT_ATT_SEND_API1'. -
Download SAP Script as MS word format
Can we download SAP Script in MS word format? If so Please suggest me the way.
I'm not very sure on how it can be achieved, but this can help you.
Spool to word -> http://sap4.com/codigofuente/102/396.html -
Dispalying SAP script output in landscape format
Hello All,
Could anyone please tell me the step by step process to display a SAP Script output in landscape format?
Also is it possible to display a column name in 2 lines if it does not fit into 1 line.
Regards
Indrajit.Hi,
Here is the way to print the SAPSCRIPT in landscape ..
Goto SE71, then give you layout name then press change, then press the Header button(CAP ICON), then you will get the Header infomation, then select the Basic Settings pushbutton, then there we have an option to Print the Layout in Portrait format or Landscapr format, then select the LANDSCAPR format Radio button then activate it
Regards
Sudheer -
If i got incorrect characters in the output of sap script? HOW TO CORRECT I
If i got incorrect characters in the output of sap script? HOW TO CORRECT IT?
Hi Sunil,
Debug the script and check where exactly those are getting populated. Definately you will get it. Check the conversion parts means character to numeric conversion.
If your version is 4.7E then select unicode check box in the reports attributes. It will display the error message so that we can solve very easily.Hope this helps you, reply for queries, Shall post you the updates.
Regards.
Kumar. . -
SAP SCRIPT FORMS with UNICODE FORMAT ??
Hi guru's,
this is sunny newly joined in sap forum,am ABAP doveloper .
now am extensivelly working on upgrradation project(4.6B TO ECC6.0) , my work perticularlly on UNICODE
>> now am working on SAP SCRIPT FORMS, so could you please let me know how to check the scripts in UNICODE FORMAT .
>> Is that usefull to check with UCCHECK
Its urgent
Best Regards
Sunny..SAP Scripts needs no checks. but you have to keep attention to the fact, that the spoollists must be converted manually by a report written by SAP, and this report is not able to transform sapscripts which are still in the spool. After unicode conversion every sapscript spoollist is lost!
-
Problem in PO SAP Script, producing a PDF format.
Hi,
Description: We have developed a Purchase Order script. Both the Print Program and SAP Script are customised i.e., we are no longer using the standard MEDRUCK. The print preview is fine and when we take a print out the output looks good.
Problem: When the output type is changes to External Send using the Messages tab in the transaction ME23N, the output is given to a PDF file. In this output the vertical lines are not coming properly. The vertical lines are printed using the VLINE statement of sap script.
Solution Required for: Could any one please tell me why are we getting this problem and a possible solution for this.
Code:
M9 &VLINE&,,>_EKPO-EBELP(Z)&,,&VLINE&,,<TX>>_EKPO-IDNLF(C14)&</>
= ,,&VLINE&,,<TX>>_EKPO-TXZ01(C40)&</>,,&VLINE&,,>_EKPO-MENGE(C.0)&
= ,,>_EKPO-MEINS(3)&,,&VLINE&,,
= >_EKPO-NETPR(9.2)&
= ,,&VLINE&,,>_EKPO-NETWR(9.2)&,,&VLINE&
Thanks and Regards,
Raghavendra Goutham.
NOTE: Helpfull answers will be rewarded definitely.Hi,
Best practise is 1st you FRAME the window with boxes.........
Example.....
/* BEGIN OF CHANGE LDEEPAK 09/12/2005.
/: IF &VBDKR-VBTYP& = 'O' OR &VBDKR-VBTYP& = 'S' OR &VBDKR-VBTYP& = '6'.
/: BOX YPOS '0.0' CM WIDTH '25.4' CM HEIGHT '0.85' CM FRAME 4 TW
/: BOX YPOS '0' CM XPOS '4.4'CM WIDTH '0'CM HEIGHT '0.85'CM FRAME 4 TW
/: BOX YPOS '0' CM XPOS '8.35'CM WIDTH '0'CM HEIGHT '0.85'CM FRAME 4 TW
/: BOX YPOS '0' CM XPOS '11.6'CM WIDTH '0'CM HEIGHT '0.85'CM FRAME 4 TW
/: BOX YPOS '0' CM XPOS '19.65'CM WIDTH '0'CM HEIGHT '0.85'CM FRAME 4 TW
B <K>CUSTOMER NO.</> <K> CONTRACT NO. / SALES ORDER NO.</>
= <K> ORIGINAL INVOICE NO.</> ,,<K> CUSTOMER PO.</>
= ,,,,<K>TERMS</>
/: BOX YPOS '3.25'CM WIDTH '25.4'CM HEIGHT '0.95'CM FRAME 0 TW INTENSITY 8
/: BOX YPOS '5.1'CM WIDTH '25.4'CM HEIGHT '0.95'CM FRAME 0 TW INTENSITY 8
/: BOX YPOS '6.95'CM WIDTH '25.4'CM HEIGHT '0.95'CM FRAME 0 TW INTENSITY 8
/: BOX YPOS '8.85'CM WIDTH '25.4'CM HEIGHT '0.95'CM FRAME 0 TW INTENSITY 8
/: BOX YPOS '10.6'CM WIDTH '25.4'CM HEIGHT '0.95'CM FRAME 0 TW INTENSITY 8
Like this you can give commands.
Later you can code for getting the values in to window.
Here while populating the values you need to use TABS to place the value in correct position.
Thanks.
If this helps you reward with points.
Message was edited by: Deepak333 k -
Converting sap script output into pdf format?
Hi all,
I have modified the standard purchase order script form MEDRUCK . Now i need to generate the output into pdf format.
This is not only limited to spool requests , But also when the user creates the purchase order and clicks on print or print preview the output should be in pdf format.
Please help on where and what code has to be written for this requirement?
Thanks,
Aravind.Hi
I don't know which is your release, but I don't think it's possible to create a preview in pdf format, but u can create a pdf file instead of the spool and then open it automatically, this is an example:
- A) Open form
IF P_PDF = 'X'.
XDEVICE = 'PRINTER'.
* Get OTF
ITCPO-TDGETOTF = 'X'.
ENDIF.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
DEVICE = XDEVICE
DIALOG = 'X'
FORM = 'ZFI_CL_EC_MOVI'
OPTIONS = ITCPO
MAIL_SENDER = LVS_SENDER
MAIL_RECIPIENT = LVS_RECIPIENT
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
OTHERS = 11.
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
B) Close FORM
CALL FUNCTION 'CLOSE_FORM'
TABLES
OTFDATA = T_OTF
EXCEPTIONS
UNOPENED = 1
BAD_PAGEFORMAT_FOR_PRINT = 2
SEND_ERROR = 3
SPOOL_ERROR = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
MESSAGE I208(00) WITH 'Errore chiusura stampa'(A02).
ELSE.
PERFORM DOWNLOAD_PDF.
ENDIF.
C) Create PDF and open it:
FORM DOWNLOAD_PDF.
DATA: BIN_FILESIZE TYPE I.
DATA: T_FILE_PDF TYPE STANDARD TABLE OF TLINE,
DOCTAB_ARCHIVE TYPE STANDARD TABLE OF DOCS.
DATA: FILE_TABLE TYPE FILETABLE WITH HEADER LINE.
DATA: RC TYPE I,
USER_ACTION TYPE I.
DATA: TITLE TYPE STRING,
FILENAME TYPE STRING.
CHECK P_PDF = 'X'.
CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
BIN_FILESIZE = BIN_FILESIZE
TABLES
OTF = T_OTF
DOCTAB_ARCHIVE = DOCTAB_ARCHIVE
LINES = T_FILE_PDF
EXCEPTIONS
ERR_CONV_NOT_POSSIBLE = 1
ERR_OTF_MC_NOENDMARKER = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
MESSAGE I208(00) WITH 'Errore conversione PDF'(A03).
EXIT.
ENDIF.
TITLE = 'Creare File'(T02).
CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
EXPORTING
WINDOW_TITLE = TITLE
DEFAULT_EXTENSION = '*.pdf'
CHANGING
FILE_TABLE = FILE_TABLE[]
RC = RC
USER_ACTION = USER_ACTION
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
OTHERS = 4
IF SY-SUBRC <> 0.
MESSAGE I208(00) WITH 'Errore creazione PDF'(A04).
EXIT.
ELSE.
IF USER_ACTION = 9. EXIT. ENDIF.
IF RC = 1.
READ TABLE FILE_TABLE INDEX 1.
ENDIF.
ENDIF.
MOVE FILE_TABLE-FILENAME TO FILENAME.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GUI_DOWNLOAD
EXPORTING
BIN_FILESIZE = BIN_FILESIZE
FILENAME = FILENAME
FILETYPE = 'BIN'
CHANGING
DATA_TAB = T_FILE_PDF
EXCEPTIONS
FILE_WRITE_ERROR = 1
NO_BATCH = 2
GUI_REFUSE_FILETRANSFER = 3
INVALID_TYPE = 4
NO_AUTHORITY = 5
UNKNOWN_ERROR = 6
HEADER_NOT_ALLOWED = 7
SEPARATOR_NOT_ALLOWED = 8
FILESIZE_NOT_ALLOWED = 9
HEADER_TOO_LONG = 10
DP_ERROR_CREATE = 11
DP_ERROR_SEND = 12
DP_ERROR_WRITE = 13
UNKNOWN_DP_ERROR = 14
ACCESS_DENIED = 15
DP_OUT_OF_MEMORY = 16
DISK_FULL = 17
DP_TIMEOUT = 18
FILE_NOT_FOUND = 19
DATAPROVIDER_EXCEPTION = 20
CONTROL_FLUSH_ERROR = 21
OTHERS = 22
IF SY-SUBRC <> 0.
MESSAGE I208(00) WITH 'Errore creazione PDF'(A04).
EXIT.
ELSE.
MESSAGE S208(00) WITH 'File creato con successo'(S01).
ENDIF.
CHECK P_OPEN = 'X'.
CALL FUNCTION 'CALL_BROWSER'
EXPORTING
URL = FILE_TABLE-FILENAME
EXCEPTIONS
FRONTEND_NOT_SUPPORTED = 1
FRONTEND_ERROR = 2
PROG_NOT_FOUND = 3
NO_BATCH = 4
UNSPECIFIED_ERROR = 5
OTHERS = 6.
IF SY-SUBRC <> 0.
MESSAGE S208(00) WITH 'Impossibile aprire file'(A05).
ENDIF.
ENDFORM. " DOWNLOAD_PDF
Max -
Sap script symbol, how value is getting populated
We have a Delivery Note in which it says Total units = 56. But in debug I saw the symbol &UNIT(Z)& which is getting this value 56 on Devlivery.
I want to know from where this value is coming on layoutset? can any one please tell me....as this is not table field or custom variable that is coming from print program.
Thanks a lot.Hi,
I think through debugging only you can find the same.
In your script utilites activate debugger and your include set a break point in the open form and after reaching your include
in the debugging screen press f6 and find where your unit value is coming from.
In your script display check defination select here also you will find in which programs your form is triggered.
Your include is using in many program, if you know program then keep a break also in your program especially in write_form
function modules.
Thanks,
Phani. -
How to end text element in sap script
how to end an text element in sap script
this is the format.
/E text element name
&tablename-fieldname&
text-text-text-text
now if i do not end that text element it is not displayiny my below text , so what to do in this caseGo through the links mentioned below.
http://www.****************/Tutorials/Smartforms/SFMain.htm
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/3c5d9ae3-0501-0010-0090-bdfb2d458985
http://www.sapmaterial.com/smartform_example.html
Re: Hands on SAP Smart Forms
smartforms
Reward points if useful. -
How to print different pages of sap script from diff. trays of printer
Hi All,
I have the requirement in SAP script. How to print different pages from different trays in the printer.
For example page 1 logo and address has to print from tray-1,
page 2 main data print from tray-2,
page 3 footer data print from tray-3.
will appreciate if u come up with solutions asap.
Thanks in advance.Hi,
May be the links given below might help you,
SAPScript:Selecting Different Tray in SAPscript
Print to different output tray in SAPscript/Print Workbench
Regards,
Hema.
Reward points if it is useful. -
How to retrieve data from a function module and use it in sap script??
I have a report program, which calls a function module. This function module internally calls an include program. In this program, I have a variable which is to be used in the sap script. How can I send this variable to the sap script
Hi,
In your case, Include prog is part of FM, no need to treat it as an Entity.
Now, Your Answer -
In SCRIPT - IN Page Window -->
PERFORM GET_MVAT_TIN IN PROGRAM Z_SCRIPT_PERFORMS_ABAPDB3
USING &VBDKR-KUNRE&
CHANGING &STCD1&
CHANGING &STCD2&
ENDPERFORM
IF &STCD1& <> ' '
<B>MVAT Number :</> &STCD1&
ENDIF
Then go to SE38 --> Creat prog with type - Subroutine pool
In that Write FORM statement for this PERFORM.
FORM get_mvat_tin TABLES inttab STRUCTURE itcsy
outtab STRUCTURE itcsy.
DATA : v_kunre TYPE kna1-kunnr,
v_stcd1 TYPE kna1-stcd1,
v_stcd2 TYPE kna1-stcd2.
LOOP AT outtab.
CLEAR outtab-value.
MODIFY outtab.
ENDLOOP.
READ TABLE inttab INDEX 1.
v_kunre = inttab-value.
IF v_kunre CA sy-abcde.
ELSE.
UNPACK v_kunre TO v_kunre.
ENDIF.
" Here You can take your Funcion module ***************************
SELECT SINGLE stcd1 stcd2 FROM kna1 INTO (v_stcd1, v_stcd2)
WHERE kunnr = v_kunre.
IF sy-subrc = 0.
READ TABLE outtab INDEX 1.
WRITE v_stcd1 TO outtab-value.
MODIFY outtab INDEX 1.
READ TABLE outtab INDEX 2.
WRITE v_stcd2 TO outtab-value.
MODIFY outtab INDEX 2.
ENDIF.
ENDFORM. -
How to transport the sap script
Hi gurus,
I am new to the SAP scripts. I finished the development of my form by usiing SAP Scripts. How can I transport it? Any help is appreciated!
Thx in advance!
Kun Baocheck these links it will be very useful...
How to transport SAPSCRIPT??
SMARTFORMS translate and transport
SAP Scripts are client-dependent objects. Hence, they may often require to be downloaded from or uploaded to SAP system
Following programs can be used to download from/upload to SAP System
RSTXR3TR To EXPORT/IMPORT layout set (FORM) using a Transport Request (CTS)
RSTXSCRP To EXPORT/IMPORT layout set (FORM), Style, Standard Text or Device Type without using a Transport Request
execute the Program 'RSTXSCRP' give the Script name and Export it to u'r system and then log on in different client and Import the script using the same Program.
reward all help full answers. -
How to rename the SAP Script.
Dear All,
I wanted to rename a SAP Script. How Can I do that ?
Thanks & Regards
VenkatHi Rich and Others,
Thank you very much for your reply.
I knew that it can be copied but just wanted to know whether we can renamed.
I belive Ramu is right, we can't rename.
but before closing this thread, I and other members would like to confirm whether we can rename or not.
Thanking you.
Regards
Venkat -
How to Add Long Text from CA10 on SAP Script
Hi Friends,
I got a requirement to add a long text from CA10 on to the SAP Script.
How to do this ?
Is it using INCLUDE ?
Please give me some solution
Thanks in Adv.Hi Bhupal,
Could you tell me how did u add the long text from CA10. I have the same requirement.
Thanks in advance.
Manisha
Maybe you are looking for
-
I need to clean my computer hard drive
my computer is slow and gets pop ups all the time and closes programs. how do i clean it?
-
Satellite M70 - Can't install from recovery disk
Hi, I had to remove the HDD from Toshiba Satellite M70 to use it on my Compaq laptop (Compaq HDD crashed). I had to install XP and other stuff after creating 2 partions and used it with Compaq Laptop without any problem. Now I got a new HDD for compa
-
WebService with multiple methods
Hello to everybody. I need an help with the develop of a WebService that it comes with 2 methods: I have already created a lot of WebService in JCAPS6 with only one method and everything was gone well. I tried to implement a WebService with 2 or more
-
Hello guys, I have an big Problem with my Programm in Apple script... Everything of it works until a simple "duplicate" command. Then I will get error 10006 here is the script: ps: I use "x" for folder name where I get "minecraft.jar" tell applicati
-
Form based on Procedure - coding methods
I would like to create a Portal Form based upon a stored procedure. I can't seem to find any documentation which describes the necessary procedural functions. The form requires standard select, update, delete capabilities. How does that the procedure