Standard text in report
how can i call standard text in a report program
Thanks
Baidyanath
Hi,
check this
data: xthead type thead.
data: ilines type table of tline with header line.
xthead-tdobject = 'ZPT_DET'.
xthead-tdid = 'Z001'.
xthead-tdname = '004500'.
xthead-tdspras = sy-langu.
xthead-tdlinesize = 72.
call function 'READ_TEXT'
exporting
id = xthead-tdid
language = xthead-tdspras
name = xthead-tdname
object = xthead-tdobject
tables
lines = ilines
exceptions
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
others = 8.
call function 'EDIT_TEXT'
exporting
header = xthead
tables
lines = ilines
exceptions
id = 1
language = 2
linesize = 3
name = 4
object = 5
textformat = 6
communication = 7
others = 8.
check sy-subrc = 0.
aRs
Similar Messages
-
Call Standard Text by report replacing the variables with their values
Hi,
I have a requirement to call a standard text from a report.
Following is the text present in standard text.
&PTXT1-ENAME& will attend for interview
on &MEMOACT-PLDAT& at &MEMOACT-PLTIM&.
I am doing it by using READ_TEXT. But READ_TEXT reads the entire text as it is.
Is there any way I could retrieve the standard texts with &PTXT1-ENAME& replaced by the value of PTXT1-ENAME in report. And similarly &MEMOACT-PLDAT& replcaed with its actual value.
Any pointers in this regard would be helpful.
Points will be awarded.
Regards,
Mayank AgarwalHi,
In the Text
&PTXT1-ENAME& will attend for interview
on &MEMOACT-PLDAT& at &MEMOACT-PLTIM&.
do not use the * as a paragrapgh , use /: as the paragraph
Regards
Sudheer -
Using standard texts in reports output
Hi,
Would you please let me know the process of using standard texts created in So10 transaction in reports development. READ_TEXT function module made me to code a lot as per my requirement.
Thanks,
Kumar.Hi ,
if you want to use READ_TEXT then you have to take help of you functional consultant.Ask him to provide the TEXT ID ,NAME, OBJECT and with the help of these things you can proceed furthur,
If you still need any help.let me know.
Thanks and regards,
Rajeshwar -
Report to upload and download standard text
Hi,
Please let me know how can we upload or download standard text created using so10. Is there any report program to do this?
Thanks
Saravanahi .
Go to Abap editor SE38 use RSTXSCRP this program ...
Run it .. u can find the option Standard text chek this option.
Give the TEXT ID and langauage.
and then the mode i.e Export r Import
by this way u can upload r down load standard text ..
Note : By rewarding points u can also get 1 point. -
Use standard text (SO10) in report(SE38) to compose the body of email
hello experts,
here i wanna create the body of email with a format, hence i decide to use Standard Text. in this Standard Text, i also maintain some variable such &p_name&( i remember it works in forms,such script and ssf), while i define p_name as 'demo' in the program and try to transfer p_name to standard text, it fails. while i check the output of standard text, it show &p_name& instead of demo.
could anyone tell me how to realize this function?
Thanks in advance.
DesmondHi,
try this,
data:w_field(10) type c VALUE '1234'.
DATA:wa_head TYPE THEAD.
data:it_final TYPE TABLE OF tline.
wa_head-tdname = 'Z_SAMPLE'. u201CStandard text,refer screen shot
wa_head-tdid = 'ST'.
wa_head-tdobject = 'TEXT'.
wa_head-tdspras = 'EN'.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
id = wa_head-tdid
language = wa_head-tdspras
name = wa_head-tdname
object = wa_head-tdobject
ARCHIVE_HANDLE = 0
LOCAL_CAT = ' '
IMPORTING
HEADER = HEADER
TABLES
lines = it_final
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 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.
CALL FUNCTION 'REPLACE_TEXTSYMBOL'
EXPORTING
endline = 10
FORMATWIDTH = 72
LANGUAGE = SY-LANGU
LINEWIDTH = 132
OPTION_DIALOG = ' '
REPLACE_PROGRAM = 'X'
REPLACE_STANDARD = 'X'
REPLACE_SYSTEM = 'X'
REPLACE_TEXT = 'X'
startline = 1
IMPORTING
CHANGED = CHANGED
TABLES
lines = it_final -
Track Changes log of a specified Standard Text?
Hello Experts,
Am looking to develop a report (change log report) for standard texts, for example, (pls. note all input parameters of this standard text are same)
Yesterday the user entered the standard text as
This is yesterdays standard text
And again user has changed today it to
This is todays standard text
Pls. let me know that is there any standard transaction to track these changes log? is there any table (seems STXH, STXL are not helps me) to store these changes? how can i retrive all these changes for a specified stanrd text?
Thank youHi M_S_Raju_0613,
I never heard of a tracking feature for standard texts - standard sapscript texts must be an add on SAP took from any non-SAP development and never integrated well. So you have to change documents for them or the pool tables where they are stored.
If only some texts and only special changes are in question, you may create a special program that stores a copy of the text and compares the copy to the actual text in a recurring job.
No better idea, sorry.
Regards,
Clemens -
Standard text displayed correctly in print preview but not in print
Hi,
I have a script in which a standard text has to be printed in the output.
The standard text contains some german characters.
These characters are displayed correctly in print preview but not in print.
The text is maintained in 3 languages DE,EN and Russian.
The same text is being printed in some standard report. But that is displayed correctly both in print and print preview.
Please suggest something.
Regards,
Richa AggarwalHi Richa,
Check this document from SAP: [help doc|http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f0652a95-5f0b-2a10-5aba-c085f8bbe6d6?QuickLink=index&overridelayout=true]
It indicates that you have to be sure to select "Unicode" fonts for your SAPScript form to ensure the proper printing of "Unicode" characters. If a character does not display then that means it does not exist in the font that you are using.
Regards,
Ryan Crosby -
Inserting hypertext link in a Standard Text ?
Hi all,
Is it possible to insert an http link in a standard text.
What I'm looking for, for example :
VL02N -> Header Text -> ( I create a new text ) which will contains : 'http://www.google.com'.
So that, if I click on, it opens IExplorer with the right page.
Best Regards,
Erwan.Hi Erwan,
look here - it seems ti be the same problem:
Re: Program/Report Documentation link to web page
Andreas -
Dispaly standard text in SAP SCRIPT which content saved using SAVE_TEXT FM
I want to display one standard text content in SAP SCRIPT and want to store content of it during run time.
For that, first I have created one standard text using SO10.Named the standard text as Z_TEST_WRITE. Initially it was empty.
In my SAP SCRIPT, I try to display the content of the standard text using below given SAP SCRIPT code and report program. Although I am able to store text in Standard text
Z_TEST_WRITE but in first display of the SCRIPT it is not displaying against the include command of SAP SCRIPT. But when I see the content of Z_TEST_WRITE through SO10 transaction, I can see the content with new text which was previously empty.
Now if I do the same transaction newly (suppose second time), then text stored in standard text Z_TEST_WRITE is displaid against includes command of SAP SCRIPT.
My print program is a SAP STANDARD which one can be changed.
/: DEFINE &NAME& = ''
/: PERFORM TEST IN PROGRAM Z_SAVE_TEXT
/: CHANGING &NAME&
/: ENDPERFORM
<B>&NAME&</>
/: INCLUDE Z_TEST_WRITE OBJECT TEXT ID ST
REPORT Z_SAVE_TEXT.
FORM TEST TABLES IN_PAR STRUCTURE ITCSY
OUT_PAR STRUCTURE ITCSY.
DATA IT_HEADER LIKE TLINE OCCURS 0 WITH HEADER LINE.
DATA: LS_HEADER LIKE THEAD,
LT_LINES TYPE STANDARD TABLE OF TLINE WITH HEADER LINE.
OUT_PAR-NAME = 'NAME'.
OUT_PAR-VALUE = 'Sample text for Test'.
APPEND OUT_PAR.
*-Populate Header Text details
LS_HEADER-TDOBJECT = 'TEXT'.
LS_HEADER-TDNAME = 'Z_TEST_WRITE'.
LS_HEADER-TDID = 'ST'.
LS_HEADER-TDSPRAS = SY-LANGU.
*-Populate details of Text
CONCATENATE 'Shipment No :' 'RM Ship No' INTO LT_LINES-TDLINE
SEPARATED BY SPACE.
LT_LINES-TDFORMAT = '*'.
APPEND LT_LINES.
CONCATENATE 'Bill of Lading:' '1234567' INTO LT_LINES-TDLINE
SEPARATED BY SPACE.
APPEND LT_LINES.
*-Save Text
CALL FUNCTION 'SAVE_TEXT'
EXPORTING
CLIENT = SY-MANDT
HEADER = LS_HEADER
SAVEMODE_DIRECT = 'V'
TABLES
LINES = LT_LINES
EXCEPTIONS
OTHERS = 1.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
COMMIT WORK and WAIT.
ENDFORM. "TESTHi,
If the text is getting displayed the second time, then this should be due to delay in saving the text.
After your COMMIT WORK AND WAIT in your report program, just put a WAIT FOR 2 SECS and check again.
Regards,
Suganya -
How to output a logo stored as standard text to excel using OLE
Hi Experts,
I have a requirement to write a program which creates an excel spreadsheet to download data from SAP. The client would like the spreadsheet formatted with merged cells, background colours, different size fonts and in the top left corner of the spreadsheet to show their logo.
They have similar functionality in another report, however, this requires a template (containing all of the formatting) to be stored on the user's PC. They do not want to have to do this with the new download.
After checking the many postings on this forum I have worked out how to do most of the requirements, but as yet have still not been able to work out how to populate their logo to the spreadsheet. They already have their logo stored as standard text (SO10), so would prefer to use this if possible.
Any advise and/or sample code would ge greatly appreciated.
Thanks
SandraHi Surendra,
We have the same requirement. We want to do some format changes to "Generic FSG Drill Template". I am able to do few changes. But when we run the report, we are able to see PDF, html output. But 'Exce' report comes with blank. Can you help on this. How were you able to see logo in excel file.
Can you send the suggestions if any to my mail ([email protected])
Thanks in advance.
Thanks,
Techie.
Edited by: user1138068 on May 30, 2011 7:04 AM -
Reg : usage of standard Texts(SO10)
Hi all of u,
I want to use standard texts ,which were created under Tcode SO10, alone to display output without using them in any of the script or smartforms.Also i want to nw that , is it possible to use Variables inside standard text,which r really exist in report,report is through which i want to make use of ths Texts .The variable are / shuld be local to this program...
Kindly guide me ....
This will simplifies my work ...
Thanks in advance,
Regards,
Chandra.VHi Chandra Shekar,
standard text with variable
SO10 doubt : standard Text
Regards,
Sravanthi -
Hi All,
I want to getrid of the Description for one of the column, i am trying to unselect the checkbox Standard Text even it is default taking the standard text.
In my report i want t display blank(with out description) under thatb we will get to see the data.
Could any one of you help me.
Regards,
Sarithaok. I tried for forumla and it worked.
For keyfigure is it acceptable if you give ' ' or just ' instead of description blank.
This will work.
so use a small character other than all blanks and it will work -
PR to PO ...Standard text problem
Hi all,
I am writing one report , which converts the purchasing requistion to purchase order. I am using the BAPI function module...BAPI_PO_CREATE1.
In this i want to populate the purchase order header text. I am using the standard text for all po's whose are convertable.
but the problem is , the header text table paramers(POTEXTHEADER) in BAPI FM will take 132 chars only. But my standard text is 6 paragraphs are there . how do i long text populate? Am i using the wrong parameters in the BAPI FM.
please suggest me ...how to use this BAPI FM , to populate the lonf standard text.
regards,
Ajay Reddy
Edited by: Ajay on May 27, 2008 9:08 AMhi
use the function module create_text to upload long text. below is the
sample program which uploads purchase order text more than 132 characters.
TABLES : MARA, TLINE, THEAD.
DATA: BEGIN OF ITAB OCCURS 0,
MATNR LIKE MARA-MATNR, " MATERIAL NUMBER
TEXT(5000) TYPE C, " Long Text
END OF ITAB.
DATA: BEGIN OF ITAB1 OCCURS 0,
MATNR LIKE MARA-MATNR, " Material No
SEQU TYPE I, " Text Sequence
TEXT(5000) TYPE C, " Long Text
END OF ITAB1.
DATA:BEGIN OF DT_LINES OCCURS 0.
INCLUDE STRUCTURE TLINE. " Long Text
DATA:END OF DT_LINES.
DATA : P_FILE1 TYPE STRING.
DATA : DL_NAME TYPE THEAD-TDNAME, " Object Name(material no)
DL_LAN TYPE THEAD-TDSPRAS. " Language
CONSTANTS:C_BEST TYPE THEAD-TDID VALUE 'BEST',
C_MATERIAL TYPE THEAD-TDOBJECT VALUE 'MATERIAL'. " OBJECT
DATA: START TYPE I,
LEN TYPE I VALUE 92,
TOTLEN TYPE I,
N TYPE I.
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-101.
PARAMETERS P_FILE LIKE RLGRAP-FILENAME."input file
SELECTION-SCREEN : END OF BLOCK B1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
PERFORM FETCH_FILE USING P_FILE.
*& Form fetch_file
text
-->P_FILE text
FORM FETCH_FILE USING P_FILE.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
IMPORTING
FILE_NAME = P_FILE.
ENDFORM. "fetch_file
START-OF-SELECTION.
PERFORM UPLOAD USING P_FILE. " *To Upload Flat file
PERFORM UPLOAD_TEXT.
*& Form UPLOAD
text
-->P_FILE text
FORM UPLOAD USING P_FILE.
P_FILE1 = P_FILE.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = P_FILE1
FILETYPE = 'DAT'
HAS_FIELD_SEPARATOR = ' '
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
NO_AUTH_CHECK = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = ITAB
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC EQ 0.
*message i001 with p_file .
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "UPLOAD
*& Form UPLOAD_TEXT
text
FORM UPLOAD_TEXT.
LOOP AT ITAB.
ITAB1-MATNR = ITAB-MATNR.
CLEAR: TOTLEN,N, START.
TOTLEN = STRLEN( ITAB-TEXT ).
N = TOTLEN / LEN.
N = N + 1.
DO N TIMES.
ITAB1-TEXT = ITAB-TEXT+START(LEN).
ITAB1-SEQU = SY-INDEX.
START = START + LEN.
APPEND ITAB1.
ENDDO.
ENDLOOP.
DELETE ITAB1 WHERE TEXT IS INITIAL.
SORT ITAB1 BY MATNR SEQU.
LOOP AT ITAB1.
DT_LINES-TDFORMAT = '*'.
DT_LINES-TDLINE = ITAB1-TEXT.
APPEND DT_LINES.
AT END OF MATNR.
DL_LAN = SY-LANGU.
WRITE : / itab-MATNR.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = ITAB1-MATNR
IMPORTING
OUTPUT = ITAB1-MATNR.
MOVE ITAB1-MATNR TO DL_NAME.
CALL FUNCTION 'CREATE_TEXT'
EXPORTING
FID = C_BEST
FLANGUAGE = DL_LAN
FNAME = DL_NAME
FOBJECT = C_MATERIAL
SAVE_DIRECT = 'X'
FFORMAT = '*'
TABLES
FLINES = DT_LINES
EXCEPTIONS
NO_INIT = 1
NO_SAVE = 2
OTHERS = 3.
IF SY-SUBRC <> 0.
WRITE:/10 'Long Text Creation failed for Material No', ITAB1-MATNR.
ELSE.
WRITE:/10 'Long Text Created Successfully for Material No', ITAB1-MATNR.
ENDIF.
REFRESH DT_LINES.
ENDAT.
ENDLOOP.
ENDFORM. "UPLOAD_TEXT -
hi to all abap Gurus
what is standard text in script ?how to use it > where do we use it ? we know that the use is reusability . how it is reusable . and it is used to support for multiple languages . pls tell in detail . pls dont give any link . points will bre rewarded defintilely for good answers . pls urgent. pls give som esample coding on this .Standard Text is nothing but Global Text.
Suppose you have to display footer/header info. whenever you create a s cript for ur org.your caompany details,logo etx. instead of writing them everytime, if you careta a global text u can include them wherevr u want.
Mainly we are using standard texts to avoid hardcoding in scripts or smartforms.
If you need to include the name of your company and address in the form you
just include a standard text in your form by include statement(script) and by
include text dropdown in forms. If in later part of time your company address
change you need to change the standard text not to touch the form. This is the
way standard text helps us.
in Tcode SO10, u create a text and give a name activate it.
Here is the sample code to send script through E mail..
*& Report ZRICHA_OTF_PDF
report zricha_otf_pdf
message-id zz.
CONSTANTS *
constants : c_x(1) type c value 'X', " For constant value
c_otf(3) type c value 'OTF', " For format
c_u(1) type c value 'U'. " Mail Option
VARIABLES *
data : v_rqident type tsp01-rqident, " For Spool Number
v_rqclient type tsp01-rqclient, " For Client
v_rqo1name type tsp01-rqo1name, " For Object name
v_spool type tsp01-rqident, " For Spool Number
v_spool1 type tsp01-rqident. " For Spool Number
FLAGS *
data : f_spool type c.
INTERNAL TABLES *
Internal table for sending mails
data: it_pdf like tline occurs 10 with header line,
it_xi_pdf like tline occurs 0 with header line,
it_html like solisti1 occurs 0 with header line,
it_xi_temp like bapiqcmime occurs 0 with header line,
it_xi_mime(255) type c occurs 0 with header line.
For sending mail
data: it_objpack like sopcklsti1 occurs 2 with header line.
Internal table for Single List with Column Length 255
data : it_objbin like solisti1 occurs 10 with header line.
Internal table for Single List with Column Length 255
data : it_objtxt like solisti1 occurs 10 with header line.
Internal table for Structure of the API Recipient List
data : it_reclist like somlreci1 occurs 5 with header line.
Structure of the API Recipient List
data: x_doc_chng like sodocchgi1.
Internal table for storing the variants
data : begin of it_variant1 occurs 0,
variant like varid-variant,
end of it_variant1.
Internal table to store variants for the programs
data: it_variant2 like it_variant1 occurs 0 with header line.
Internal table for storing the selected values
data it_return type ddshretval occurs 0 with header line.
Internal table for storing the mail-ids
data : begin of it_mailid occurs 0,
kokrs like csks-kokrs,
kostl like csks-kostl,
datbi like csks-datbi,
telx1 like csks-telx1,
end of it_mailid.
Internal table for storing the mail-ids
data : it_mailid1 like it_mailid occurs 0 with header line.
SELECTION SCREEN *
data : v_char type char50.
selection-screen begin of block b1 with frame title text-001.
select-options: s_email for v_char no intervals
lower case
no-display.
select-options: s_email1 for v_char no intervals
lower case
no-display.
selection-screen end of block b1.
selection-screen begin of block a1 with frame title text-028.
selection-screen begin of line.
parameters : p_c1 as checkbox.
selection-screen comment 3(66) text-026 for field p_c1.
selection-screen end of line.
parameters : p_set like tsp1d-papart matchcode object zh_tsp1d.
selection-screen skip 1.
parameters : p_vara1 type rs38m-selset.
selection-screen end of block a1.
selection-screen begin of block a2 with frame title text-029.
selection-screen begin of line.
parameters : p_c2 as checkbox.
selection-screen comment 3(56) text-027 for field p_c1.
selection-screen end of line.
parameters : p_set1 like tsp1d-papart matchcode object zh_tsp1d.
selection-screen skip 1.
parameters : p_vara2 type rs38m-selset.
selection-screen end of block a2.
AT SELECTION SCREEN ON VALUE REQUEST
at selection-screen on value-request for p_vara1.
For fetching the variants available for the program
perform fetch_variants.
at selection-screen on value-request for p_vara2.
For fetching the variants available for the program
perform fetch_variants1.
AT SELECTION SCREEN
at selection-screen.
For Validation
perform validation.
START OF SELECTION *
start-of-selection.
To get the output data and mail
perform fetch_data.
END OF SELECTION *
end-of-selection.
if f_spool = c_x.
message e000 with 'Spool Not Generated'(060).
endif.
*& Form fetch_data
To get the output data and mail
form fetch_data .
To send the output to spool
perform generate_spool.
endform. " fetch_data
*& Form generate_spool
To send the output to spool
form generate_spool .
data: l_params like pri_params,
l_days(1) type n value 2,
l_count(3) type n value 1,
l_valid type c,
l_valid1 type c,
l_params1 like pri_params.
data: l_device type usr01-spld.
*Get the printer name for the user
select single spld into l_device from usr01 where bname = sy-uname.
if l_device is initial.
l_device = 'LOCL'.
endif.
For report-1
if p_c1 = 'X'.
Setting the print parameters
call function 'GET_PRINT_PARAMETERS'
exporting
destination = l_device
copies = l_count
list_name = sy-uname
list_text = 'SUBMIT ... TO SAP-SPOOL'(008)
release = c_x
new_list_id = c_x
expiration = l_days
LINE_SIZE = 255
LINE_COUNT = 65
layout = p_set
sap_cover_page = space
cover_page = space
receiver = 'SAP*'(010)
department = 'System'(011)
no_dialog = c_x
importing
out_parameters = l_params
valid = l_valid.
if l_valid <> space.
clear v_spool.
Fetch the spool number b4 submit
perform fetch_recent_spool using v_spool.
Submitting the program to spool
submit rkaep000 to sap-spool
using selection-set p_vara1
spool parameters l_params
without spool dynpro
and return.
clear v_spool1.
Fetch the spool number after submit
perform fetch_recent_spool using v_spool1.
if v_spool = v_spool1.
f_spool = c_x.
if p_c2 is initial.
stop.
endif.
else.
Checking the format ( ABAP/OTF)
perform format_check tables s_email.
endif.
else.
message e000 with 'Problem in print settings'(003).
stop.
endif.
endif.
For Report-2
if p_c2 = 'X'.
Setting the print parameters
call function 'GET_PRINT_PARAMETERS'
exporting
destination = l_device
copies = l_count
list_name = sy-uname
list_text = 'SUBMIT ... TO SAP-SPOOL'(008)
release = c_x
new_list_id = c_x
expiration = l_days
LINE_SIZE = 200
LINE_COUNT = 65
layout = p_set1
sap_cover_page = space
cover_page = space
receiver = 'SAP*'(010)
department = 'System'(011)
no_dialog = c_x
importing
out_parameters = l_params1
valid = l_valid1.
if l_valid1 <> space.
clear v_spool.
Fetch the spool number b4 submit
perform fetch_recent_spool using v_spool.
Submitting the program to spool
submit gp3diehxy88snfj0391v7kf9ek7050 to sap-spool
using selection-set p_vara2
spool parameters l_params1
without spool dynpro
and return.
clear v_spool1.
Fetch the spool number after submit
perform fetch_recent_spool using v_spool1.
if v_spool = v_spool1.
message e000 with 'Spool Not Generated'(060).
stop.
endif.
Checking the format ( ABAP/OTF)
perform format_check tables s_email1.
else.
message e000 with 'Problem in print settings'(003).
stop.
endif.
endif.
endform. " generate_spool
*& Form fetch_recent_spool
Fetch the recent spool number generated
form fetch_recent_spool using p_v_spool type tsp01-rqident .
data: l_user like tsp01-rq2name.
clear : v_rqident,
v_rqclient,
v_rqo1name.
l_user = sy-uname.
Get latest Spool No
select single rqident
rqclient
rqo1name
into (v_rqident , v_rqclient , v_rqo1name)
from tsp01
where rqcretime = ( select max( rqcretime )
from tsp01
where rq2name eq l_user
and rqfinal eq '.' ).
if sy-subrc = 0 .
p_v_spool = v_rqident.
endif.
endform. " fetch_recent_spool
*& Form format_check
Checking the format ( ABAP/OTF)
form format_check tables p_s_email structure s_email.
data : l_objtype like rststype-type.
call function 'RSTS_GET_ATTRIBUTES'
exporting
authority = 'SP01'(019)
client = v_rqclient
name = v_rqo1name
part = 1
importing
objtype = l_objtype
exceptions
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
if l_objtype(3) = c_otf.
Convert OTF Spool to PDF
perform convert_otf2pdf tables p_s_email.
else.
Convert ABAP Spool to PDF
perform convert_abap2pdf tables p_s_email.
endif.
endform. " format_check
*& Form convert_otf2pdf
Convert OTF Spool to PDF
form convert_otf2pdf tables p_p_s_email structure s_email .
clear it_pdf.
refresh it_pdf.
data : l_bytecount type i.
Fn. to get the PDF format
call function 'CONVERT_OTFSPOOLJOB_2_PDF'
exporting
src_spoolid = v_rqident
no_dialog = 'X'
importing
pdf_bytecount = l_bytecount
tables
pdf = it_pdf
exceptions
err_no_otf_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_dstdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11.
if sy-subrc = 0.
For page format
perform page_format tables p_p_s_email.
else.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " convert_otf2pdf
*& Form convert_abap2pdf
Convert ABAP Spool to PDF
form convert_abap2pdf tables p_p_s_email structure s_email.
clear it_pdf.
refresh it_pdf.
data : l_bytecount type i.
Fn. to convert to PDF format
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
exporting
src_spoolid = v_rqident
no_dialog = 'X'
importing
pdf_bytecount = l_bytecount
tables
pdf = it_pdf
exceptions
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11.
if sy-subrc = 0.
For page formatting
perform page_format tables p_p_s_email.
else.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " convert_abap2pdf
*& Form send_mail
For sending mail
form send_mail tables mail structure s_email .
Structures and internal tables for the send data
data: objpack like sopcklsti1 occurs 2 with header line,
objhead like solisti1 occurs 1 with header line,
objbin like solisti1 occurs 0 with header line,
objtxt like solisti1 occurs 10 with header line,
reclist like somlreci1 occurs 5 with header line.
data: doc_chng like sodocchgi1,
tab_lines like sy-tabix.
Data for the status output after sending
data: sent_to_all like sonv-flag.
clear: it_reclist, it_reclist[],
it_objtxt , it_objtxt[],
it_objpack, it_objpack[],
it_objbin , it_objbin[],x_doc_chng.
loop at it_html.
objbin-line = it_html-line.
append objbin.
clear objbin.
endloop.
Create the document which is to be sent
doc_chng-obj_name = 'List'(012).
doc_chng-obj_descr = 'Mail'(013).
Heading
objtxt-line = 'Mail with pdf attachment'(014).
append objtxt.
clear objtxt.
Size
describe table objtxt lines tab_lines.
read table objtxt index tab_lines.
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + strlen( objtxt ).
Fill the fields of the packing_list for the main document:
clear objpack-transf_bin.
The document needs no header (head_num = 0)
objpack-head_start = 1.
objpack-head_num = 0.
Body
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'(015).
append objpack.
Create the attachment (the list itself)
describe table objbin lines tab_lines.
Fill the fields of the packing_list for the attachment:
objpack-transf_bin = 'X'.
Header
objpack-head_start = 1.
objpack-head_num = 0.
Body
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'PDF'(016).
objpack-obj_name = 'Attachment'(017).
objpack-obj_descr = 'Mail with pdf Attachment'(018).
objpack-doc_size = tab_lines * 255.
append objpack.
*-Fill the mail recipient list
loop at mail.
reclist-receiver = mail-low.
reclist-rec_type = c_u.
append reclist.
clear: reclist,
mail.
endloop.
*-Send the document by calling the SAPoffice API1 module for sending
*-documents with attachments
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = doc_chng
put_in_outbox = c_x
commit_work = c_x
importing
sent_to_all = sent_to_all
tables
packing_list = objpack
object_header = objhead
contents_bin = objbin
contents_txt = objtxt
receivers = reclist
exceptions
too_many_receivers = 1
document_not_sent = 2
operation_no_authorization = 4
others = 99.
case sy-subrc .
when 0.
message i000 with 'Mail has been sent successfully'(006).
when others.
message e000 with 'Problem in sending the mail'(023).
endcase.
endform. " send_mail
*& Form page_format
For page foramtting
form page_format tables email structure s_email .
data : l_lines type i,
l_temp(500) type c,
l_offset type p,
l_lineslen(2) type p,
l_mimelen(2) type p,
l_tabix like sy-tabix.
clear : it_xi_pdf,
it_xi_temp.
refresh : it_xi_pdf,
it_xi_temp.
it_xi_pdf[] = it_pdf[].
Reformat the line to 255 characters wide (code from SAP)
clear: l_temp, l_offset, it_xi_temp.
describe table it_xi_pdf lines l_lines.
describe field it_xi_pdf length l_lineslen in character mode.
describe field it_xi_temp length l_mimelen in character mode.
loop at it_xi_pdf.
l_tabix = sy-tabix.
move it_xi_pdf to l_temp+l_offset.
if l_tabix = l_lines.
l_lineslen = strlen( it_xi_pdf ).
endif.
l_offset = l_offset + l_lineslen.
if l_offset ge l_mimelen.
clear it_xi_temp.
it_xi_temp = l_temp(l_mimelen).
append it_xi_temp.
shift l_temp by l_mimelen places.
l_offset = l_offset - l_mimelen.
endif.
if l_tabix = l_lines.
if l_offset gt 0.
clear it_xi_temp.
it_xi_temp = l_temp(l_offset).
append it_xi_temp.
endif.
endif.
endloop.
clear : it_xi_mime,
it_xi_mime[].
loop at it_xi_temp.
it_xi_mime(255) = it_xi_temp-line.
append it_xi_mime.
clear it_xi_mime.
endloop.
Final Data
clear : it_html,
it_html[].
it_html[] = it_xi_mime[].
For sending mail
perform send_mail tables email.
endform. " page_format
*& Form fetch_variants
For fetching the variants available for the program
form fetch_variants .
data : l_program like rs38m-programm value 'RKAEP000',
l_vara1 type dfies-fieldname value 'P_VARA1'.
clear : it_variant1,
it_variant1[].
Get variants
perform get_variants tables it_variant1
using l_program.
F4 Help
if not it_variant1[] is initial.
perform get_f4_help tables it_variant1
using l_vara1
changing p_vara1.
else.
message e000 with 'No variants available for report1'(054).
endif.
endform. " fetch_variants
*& Form validation
For Validation
form validation .
data : l_pro1 like rs38m-programm value 'RKAEP000',
l_pro2 like rs38m-programm value 'GP3DIEHXY88SNFJ0391V7KF9EK7050',
l_c1,
l_c2.
If both check-box are unchecked
if p_c1 is initial
and p_c2 is initial.
message e000 with 'Check any one check-box'(049).
endif.
If checked without varaint
if not p_c1 is initial and p_vara1 is initial.
message e000 with 'Please give any one of the variant for report1'(055).
endif.
If checked without varaint
if not p_c2 is initial and p_vara2 is initial.
message e000 with 'Please give any one of the variant for report2'(061).
endif.
Reading the variant and fetching the mail-ids
if p_c1 = c_x.
l_c1 = '1'.
clear : s_email,
s_email[].
perform read_variants tables it_mailid
s_email
using p_vara1
l_pro1
l_c1.
if s_email[] is initial.
message e000 with 'No Id available for given Cost report1'(066).
else.
sort s_email by low.
delete adjacent duplicates from s_email comparing low.
endif.
endif.
Reading the variant and fetching the mail-ids
if p_c2 = c_x.
clear : s_email1,
s_email1[].
l_c2 = '2'.
perform read_variants tables it_mailid1
s_email1
using p_vara2
l_pro2
l_c2.
if s_email1[] is initial.
message e000 with 'No Id available for given Cost report2'(067).
else.
sort s_email1 by low.
delete adjacent duplicates from s_email1 comparing low.
endif.
endif.
endform. " validation
*& Form GET_VARIANTS
Fetching Variants
form get_variants tables p_it_variant structure it_variant1
using p_v_program type rs38m-programm.
select variant
from varid
into table p_it_variant
where report = p_v_program.
endform. " GET_VARIANTS
*& Form GET_F4_HELP
text
form get_f4_help tables p_it_variant1 structure it_variant1
using p_l_vara1 like dfies-fieldname
changing p_p_vara like p_vara1.
Fn. for Pop-Up
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = p_l_vara1
value_org = 'S'
display = ' '
tables
value_tab = p_it_variant1
return_tab = it_return
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
if sy-subrc = 0.
p_p_vara = it_return-fieldval.
else.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " GET_F4_HELP
*& Form FETCH_VARIANTS1
text
form fetch_variants1 .
data : v_program1 like rs38m-programm value 'GP3DIEHXY88SNFJ0391V7KF9EK7050',
l_vara2 type dfies-fieldname value 'P_VARA2'.
clear : it_variant2,
it_variant2[].
Get Variants
perform get_variants tables it_variant2
using v_program1.
F4 Help
if not it_variant2[] is initial.
perform get_f4_help tables it_variant2
using l_vara2
changing p_vara2.
else.
message e000 with 'No variants available for report2'(050).
endif.
endform. " FETCH_VARIANTS1
*& Form read_variants
Reading the variant and fetching the mail-ids
form read_variants tables p_it_mailid structure it_mailid
p_s_email structure s_email
using p_p_vara1 like p_vara1
p_l_pro1 like rs38m-programm
p_l_c1 type c.
data : l_temp(44),
it_valutab like rsparams occurs 0 with header line.
ranges : r_cocen for csks-kostl.
Function Module to get the variant contents
call function 'RS_VARIANT_CONTENTS'
exporting
report = p_l_pro1
variant = p_p_vara1
tables
valutab = it_valutab
exceptions
variant_non_existent = 1
variant_obsolete = 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.
clear : r_cocen,
r_cocen[].
loop at it_valutab where selname = 'KOSTL'
or selname = '_C-CCTR'.
Getting the range of cost centers
if it_valutab-option = 'BT'.
r_cocen-low = it_valutab-low.
For Conversion Routine
perform conversion using r_cocen-low.
r_cocen-high = it_valutab-high.
For Conversion Routine
perform conversion using r_cocen-high.
r_cocen-option = 'BT'.
r_cocen-sign = 'I'.
append r_cocen.
clear r_cocen.
endif.
Getting the single cost centers
if it_valutab-option = 'EQ'.
r_cocen-low = it_valutab-low.
For Conversion Routine
perform conversion using r_cocen-low.
r_cocen-option = 'EQ'.
r_cocen-sign = 'I'.
append r_cocen.
clear r_cocen.
endif.
endloop.
If no cost centers
if not r_cocen[] is initial.
select kokrs
kostl
datbi
telx1
from csks
into table p_it_mailid
where kostl in r_cocen.
if p_it_mailid[] is initial.
if p_l_c1 = '1'.
message e000 with 'No IDs available for report1'(059).
elseif p_l_c1 = '2'.
message e000 with 'No IDs available for report2'(062).
endif.
endif.
Deleting the blank entries
delete p_it_mailid where telx1 = space.
clear l_temp.
read table p_it_mailid index 1.
l_temp = p_it_mailid-telx1.
data : l_check.
loop at p_it_mailid where telx1 <> l_temp.
l_check = c_x.
endloop.
For checking the unique ids
if l_check = c_x.
if p_l_c1 = '1'.
message e000 with 'No unique mail-ids for report1'(058).
elseif p_l_c1 = '2'.
message e000 with 'No unique mail-ids for report2'(065).
endif.
endif.
Populating the IDs for the cost centers
loop at p_it_mailid.
set locale language sy-langu.
translate p_it_mailid-telx1 to lower case.
set locale language space .
concatenate p_it_mailid-telx1 '@allergan.com' into l_temp.
p_s_email-low = l_temp.
p_s_email-sign = 'I'.
p_s_email-option = 'EQ'.
append p_s_email.
clear p_s_email.
endloop.
else.
if p_l_c1 = '1'.
message e000 with 'No Cost Center Available for report1'(057).
elseif p_l_c1 = '2'.
message e000 with 'No Cost Center Available for report2'(063).
endif.
endif.
endform. " read_variants
*& Form CONVERSION
For Conversion Routine
form conversion using p_it_valutab_low type c.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = p_it_valutab_low
importing
output = p_it_valutab_low.
endform. " CONVERSION
chk this one to send script to pdf
http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm
plzz refer to this link..it will solve ur problem
Re: Sending a PDF document as an attachment
sending the mail with PDF attachment
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/62ae7fcd-0b01-0010-3e9d-a54f26944450
Regards
Sree -
Printing Standard TEXT with multiple paragraphs in smartform
Hello all,
I have a requirement that, there is a very long standard text stored in a notification of an order in SAP ISU system. The text contains multiple paragraphs with indentations. I want to print this text directly into the smartform WITH SAME INDENTATION AND PARAGRAPH FORMATTING.
First i am reading the entire text using FM READ_TEXT.
My first problem is even if i read the text into a variable of type STRING , it just prints 255 characters of it.
And secondly if i try to printout it using LOOP AT node in smartforms, it prints the entire content but without any formatting .
Please let me know whether it is possible to print standard text in smartforms or not
Thanks
Nilesh PuranikHey ,
Well thanks for that but my replies got posted 2-3 times unknowingly, could'nt help it.
Coming to the problem, i guess you did not get my point when i say dynamic texts for each service order.
In my Report i am using LOOP AT ITAB ..where in itab i am storing a service order no i.e. ITAB-ORDER_NO
Now for every order there is standard text maintained in SO10 starting with order name
so my code goes like this.
LOOP AT ITAB.
CALL FUNCTION 'READ_TEXT'
EXPORTING
ID = 'LTXT'
LANGUAGE = 'E'
NAME = ITAB-order_no
OBJECT = 'QMSM'
TABLES
LINES = LINES .
CALL <SMART FORM Fm>
ENDLOOP.
Hence whatever Standard text maintained for that service order i want to display it as it is in the smartform with same paragraphs formatting and indentation.
IF i use a variable in smartform and pass the entire text after using READ_TEXT , it does not format the text and it just prints only 255 characters even if i define it of type STRING .
Hence i am stuck in this scenario.
Appreciate ur help though.
Thanks
Nilesh
Maybe you are looking for
-
Error: No batch input data for screen SAPMZVKDIALOGDEMO 1000 Help Needed
Hi Experts! I wrote a program for BDC. I am attaching the code herewith. When i am trying to process the session in SM35, i was getting the error: No batch input data for screen SAPMZVKDIALOGDEMO 1000. Can anyone please tell me, what am i doing wrong
-
What is host bus interface for pavilion dv7 1448dx
I'm thinking of Installing a usb 3 ExpressCard/54 in a Pavllion dv7 1448dx. Does anyone know where I can find out if the host bus interface of the 1448dx ExpressCard slot is Gen 1.0 enabled or Gen 2.0 enabled. That will tell me if it's worth the efff
-
Hi All, I am developing a report for pegged requirement, in that my requirement is , I want to display the component number , receipt number and its quantity ( Similar to the results that are displayed in MD04 ). I am passing header component and th
-
Hi Guy's, I am trying to create custom infotype in OM using Transation code PPCI. 1. First creating Structure using Datatype 2. After creation of Structure creating infotype using PPCI but i am getting error message like : t777I no table entries exis
-
Multiple customers for same message type "invoic" and idoc type "invoic02"
Dear Experts, I have SAP ALE process configured for single customer u2018Au2019 where I send invoic02 idoc (message type invoic) to the customer via PI server. Now I need to add one more customer u2018Bu2019 which require recepient determination. I a