String convert to list
Hello:
I need to convert a string in a list, I mean:
I have this
text1="list1"
text2="list2"
Now I need to use like parameters.
Showlist text1
On Showlist vlist
list1=[1,2,3]
list2=[A,B,C]
put vlist --I need to show the content on list1 or list2
end
Can you help me please?
Thank you
Hi Arielle,
There are three of ways to do it
1. Use a propList (probably the best approach is you have a
reasonably large list of lists)
On Showlist vlist
lookupList = [:]
lookupList ["list1"]=[1,2,3]
lookupList ["list2"]=[A,B,C]
put lookupList .getAProp(vlist)
end
2. Use a case statement (best for a small list of lists)
On Showlist vlist
case (vList) of
"list1": out = [1,2,3]
"list2": out =[A,B,C]
otherwise
put "Cannot find list " & vList
end case
put out
end
3. Use Lingos "value" command
on Showlist (vList)
aList = value(vList)
-- now do some error checking
if listP(aList) then put aList
else put "Error evaluating vList"
end
Similar Messages
-
hi All;
i've got a list which is come from pdf bookmark
List mylist = SimpleBookmark.getBookmark(reader);now i want to know the length of the list
so i need to convert it to string..
how can i convert from list to string...
anybody can help me?
Thx after allhi cotton m, yea i am new to java..
so i'm posting on the "NEW TO JAVA" forum
my problem is, i just need to assure what i'm doing is correct
i've finish my project anyway..
cotton.m
u never been in my position?when u are still learning the language, ure not good at it..
and try to get help from any body that WILLING to help you?
u are pro's @ java meh?that's good.. u should help people with your knowledge
not insult them..
no flame... -
hi
just a stupid question maybe ...
but i'm missing some string convert functions.
e.g. i habe a list with something like:
text(space)text(space)text(spacespacespace)text
and want to convert one (or more) space(s) between the text into ONE tab.
i didn't found any function that makes me able to convert that so that i get
as a result:
text(tab)text(tab)text(tab)text
maybe someone has an idea?
thanks,Hi Tobias,
use the functions "Scan from string" and "Format Into String"
with the format strings "%s\s%s\s..." and "%s\t%s\t..." like
in the VI attached to this mail.
maybe that helps you
best regards
Guenter
Tobias Theune wrote:
> hi
>
> just a stupid question maybe ...
> but i'm missing some string convert functions.
> e.g. i habe a list with something like:
> text(space)text(space)text(spacespacespace)text
> and want to convert one (or more) space(s) between the text into ONE tab.
> i didn't found any function that makes me able to convert that so that i get
> as a result:
> text(tab)text(tab)text(tab)text
>
> maybe someone has an idea?
>
> thanks,
Attachments:
Spaces_To_Tabs.vi 23 KB -
how do i convert abap list to DOC .
Rendihi,
this program to convert abap list to PDF file.
*& Report ZWARUN_TEST4
REPORT ZWARUN_TEST4.
tables:mara,bseg.
data:begin of itab occurs 2,
matnr like mara-matnr,
ernam like mara-ernam,
end of itab.
data:begin of it_bseg occurs 2,
bukrs like bseg-bukrs,
belnr like bseg-belnr,
gjahr like bseg-gjahr,
shkzg like bseg-shkzg,
dmbtr like bseg-dmbtr,
blart like bkpf-blart,
end of it_bseg.
data: lv_numbytes type i,
lv_spoolno type tsp01-rqident,
c_layout like pri_params-paart value 'X_65_132',
C_X type c value 'X',
numbers type i,
cancel.
data:it_pdf like tline occurs 10 with header line.
data:p_down like rlgrap-filename.
*at selection-screen.
selection-screen:begin of block blk with frame.
select-options:s_matnr for mara-matnr,
s_bukrs for bseg-bukrs.
parameter: download as checkbox default 'X',
p_file like rlgrap-filename default 'c:\warun.pdf'.
p_down LIKE RLGRAP-FILENAME DEFAULT 'c:\warun2.txt'.
selection-screen:end of block blk .
selection-screen pushbutton 12(20) push user-command cl1.
at selection-screen.
perform validate.
top-of-page.
write:/10 sy-repid inverse color 3.
write:/2 'Date:' , sy-datum,
40 'Time:' , sy-uzeit.
write:/2 sy-uline.
end-of-page.
write:/50 'Intelligroup Asia Pvt'.
write:/20 sy-pagno.
start-of-selection.
select matnr
ernam
into table itab
from mara
where matnr in s_matnr.
if sy-subrc = 0.
sort itab by matnr.
endif.
perform besg_data.
set pf-status 'PUSH'.
at user-command.
if sy-ucomm = 'DOWNLOAD'.
if download = space.
perform get_file.
endif.
end-of-selection.
if download = 'X'.
perform PDFfile.
ENDIF.
*& Form validate
FORM validate .
data: v_temp(40).
select single
matnr
into v_temp
from mara
where matnr in s_matnr.
if sy-subrc <> 0.
message e000(zz) with 'no data found'.
endif.
ENDFORM. " validate
at line-selection.
set parameter ID 'MAT' FIELD ITAB-MATNR.
CALL TRANSACTION 'MM03' .
WRITE:/ 'Material data displayed' .
write:/2 itab-matnr.
*& Form PDFfile
FORM PDFfile .
data:lk_params type pri_params,
lv_valid.
All the parameters passed are constants, so exceptions
doesn't get raised
call function 'GET_PRINT_PARAMETERS'
EXPORTING
immediately = ' '
layout = c_layout "'X_65_132'
no_dialog = c_x
IMPORTING
out_parameters = lk_params
valid = lv_valid.
if lv_valid <> space .
new-page print on parameters lk_params no dialog.
*--To display the final report
perform print_report.
new-page print off.
*---To convert the download to PDF
perform conv_to_pdf_download.
perform download.
endif.
endif.
*--To display the final report
perform print_report.
ENDFORM. " PDFfile
*& Form print_report
FORM print_report .
loop at itab.
write:/2 sy-vline,
4 itab-matnr color 4 HOTSPOT,
40 sy-vline ,
41 itab-ernam color 5,
55 sy-vline.
HIDE: ITAB-MATNR.
endloop.
ENDFORM. " print_report
*& Form conv_to_pdf_download
FORM conv_to_pdf_download .
wait up to 2 seconds.
lv_spoolno = sy-spono.
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
exporting
src_spoolid = lv_spoolno
no_dialog = ''
DST_DEVICE =
PDF_DESTINATION =
importing
pdf_bytecount = lv_numbytes
PDF_SPOOLID = pdfspoolid
LIST_PAGECOUNT =
BTC_JOBNAME = jobname
BTC_JOBCOUNT = jobcount
tables
pdf = it_pdf.
ENDFORM. " conv_to_pdf_download
*& Form download
FORM download .
check download = 'X'.
call function 'DOWNLOAD'
EXPORTING
bin_filesize = lv_numbytes
filename = p_file
filetype = 'BIN'
IMPORTING
act_filename = p_file
filesize = lv_numbytes
cancel = cancel
TABLES
data_tab = it_pdf.
if cancel = space.
write: / lv_numbytes, p_file.
endif.
ENDFORM. " download
*& Form get_file
FORM get_file .
Data: s_filename like rlgrap-filename,
s_filepath like rlgrap-filename,
tm_filepath like rlgrap-filename.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
DEF_FILENAME = s_filename
DEF_PATH = s_filepath
MASK = ' '
MODE = ' '
TITLE = ' '
IMPORTING
FILENAME = tm_filepath
IF SY-SUBRC = 0.
p_down = tm_filepath.
perform download2.
endif.
ENDFORM. " get_file
*& Form download2
FORM download2 .
DATA: LV_STRING TYPE STRING.
LV_STRING = P_DOWN.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
FILENAME = LV_STRING
FILETYPE = 'ASC'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = itab
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 ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " download2
*& Form besg_data
FORM besg_data .
if itab is initial.
select bukrs
belnr
gjahr
shkzg
dmbtr
into corresponding fields of table it_bseg
from bseg
where bukrs in s_bukrs.
endif.
ENDFORM. " besg_data
regards
warun -
Move data from multiple Tables to a Single Table & Convert the list to ALV.
Hi,
My aim is to get the list of Materials with their descriptions, with MRP Controller, with Unrestriced Qty. & the Reorder Qty. So, I have to fetch the data from different tables. But finally I am not able to copy or move the fetched data from multiple tables into the single final table.
Also tell me how to convert this list into ALV.
Below is the program code.
*& Report Y_REORDER_REPORT
REPORT Y_REORDER_REPORT.
tables : marc,makt, mard.
DATA: Begin of i_final occurs 0,
matnr type marc-matnr,
maktx type makt-maktx,
DISPO type marc-DISPO,
MINBE type marc-MINBE,
LABST type mard-LABST,
end of i_final.
DATA: Begin of i_marc occurs 0,
matnr type marc-matnr,
DISPO type marc-DISPO,
MINBE type marc-MINBE,
end of i_marc.
DATA: Begin of i_makt occurs 0,
matnr type makt-matnr,
maktx type makt-maktx,
end of i_makt.
DATA: Begin of i_mard occurs 0,
matnr type mard-matnr,
LABST type mard-LABST,
LGORT TYPE MARD-LGORT,
end of i_mard.
SELECT matnr
dispo
minbe from marc
into corresponding fields of table i_marc
where dispo EQ 'STR'.
SORT I_MARC by MATNR.
WRITE: /10 'Material',
75 'MRP',
80 'Reorder Qty.'.
LOOP at i_marc.
Write: /10 i_marc-matnr,
75 i_marc-dispo,
80 i_marc-minbe.
ENDLOOP.
write: /.
SELECT matnr
MAKTX from makt
into corresponding fields of table i_makt
for all entries in i_marc
where matnr = i_marc-matnr.
LOOP at i_makt.
Write: /10 i_makt-matnr,
30 i_makt-maktx.
ENDLOOP.
SELECT matnr
LGORT
LABST from mard
into corresponding fields of table i_mard
for all entries in i_marc
where matnr = i_marc-matnr.
LOOP at i_mard.
Write: /10 i_mard-matnr,
30 I_MARD-LGORT,
40 i_mard-labst.
ENDLOOP.
move i_mard-matnr to i_final-matnr.
move i_marc-dispo to i_final-dispo.
move i_marc-minbe to i_final-minbe.
move i_makt-maktx to i_final-maktx.
move i_mard-labst to i_final-labst.
WRITE: /10 'Material',
30 'Material Desc.',
75 'MRP',
80 'Reorder Qty.',
105 'Current Stock'.
LOOP at i_final.
Write: /10 i_final-matnr,
30 i_final-maktx,
75 i_final-dispo,
80 i_final-minbe,
105 i_final-labst.
ENDLOOP.
*LOOP at i_mard.
*Write: /10 i_mard-matnr,
30 i_makt-maktx,
75 i_marc-dispo,
80 i_marc-minbe,
105 i_mard-labst.
*ENDLOOP.
Regards,
VishalChange like this,
SELECT matnr
lgort
labst FROM mard
INTO CORRESPONDING FIELDS OF TABLE i_mard
FOR ALL ENTRIES IN i_marc
WHERE matnr = i_marc-matnr.
LOOP AT i_mard.
WRITE: /10 i_mard-matnr,
30 i_mard-lgort,
40 i_mard-labst.
ENDLOOP.
LOOP AT i_marc.
READ TABLE i_mard WITH KEY matnr = i_marc-matnr.
READ TABLE i_makt WITH KEY matnr = i_marc-matnr.
MOVE i_mard-matnr TO i_final-matnr.
MOVE i_marc-dispo TO i_final-dispo.
MOVE i_marc-minbe TO i_final-minbe.
MOVE i_makt-maktx TO i_final-maktx.
MOVE i_mard-labst TO i_final-labst.
APPEND i_final.
ENDLOOP.
WRITE: /10 'Material',
30 'Material Desc.',
75 'MRP',
80 'Reorder Qty.',
105 'Current Stock'. -
Hi my question abt 2 convert a list into pdf format
hi
experts
i had problem to convert displayed list into pdf format showing an error cannot open the file file format not supported, but i am have downloaded the file in .pdf format
please help me
thank you allHi,
check out this program. this might help:
report zabap_pdf.
tables:
tsp01.
data:
mstr_print_parms like pri_params,
mc_valid(1) type c,
mi_bytecount type i,
mi_length type i,
mi_rqident like tsp01-rqident.
*-- INTERNAL TABLES
data:
mtab_pdf like tline occurs 0 with header line,
mc_filename like rlgrap-filename.
*-- SELECTION SCREEN
parameters:
p_repid like sy-repid, " Report to execute
p_linsz like sy-linsz default 132, " Line size
p_paart like sy-paart default 'X_65_132'. " Paper Format
start-of-selection.
concatenate 'c:\'
p_repid
'.pdf'
into mc_filename.
*-- Setup the Print Parmaters
call function 'GET_PRINT_PARAMETERS'
exporting
authority= space
copies = '1'
cover_page = space
data_set = space
department = space
destination = space
expiration = '1'
immediately = space
in_archive_parameters = space
in_parameters = space
layout = space
mode = space
new_list_id = 'X'
no_dialog= 'X'
user = sy-uname
importing
out_parameters = mstr_print_parms
valid = mc_valid
exceptions
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
others = 4.
*-- Make sure that a printer destination has been set up
*-- If this is not done the PDF function module ABENDS
if mstr_print_parms-pdest = space.
mstr_print_parms-pdest = 'LOCL'.
endif.
*-- Explicitly set line width, and output format so that
*-- the PDF conversion comes out OK
mstr_print_parms-linsz = p_linsz.
mstr_print_parms-paart = p_paart.
submit (p_repid) to sap-spool without spool dynpro
spool parameters mstr_print_parms
via selection-screen
and return.
*-- Find out what the spool number is that was just created
perform get_spool_number using sy-repid
sy-uname
changing mi_rqident.
*-- Convert Spool to PDF
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
exporting
src_spoolid= mi_rqident
no_dialog = space
dst_device = mstr_print_parms-pdest
importing
pdf_bytecount = mi_bytecount
tables
pdf = mtab_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
others = 12.
call function 'DOWNLOAD'
exporting
bin_filesize = mi_bytecount
filename = mc_filename
filetype = 'BIN'
importing
act_filename = mc_filename
tables
data_tab = mtab_pdf.
FORM get_spool_number *
Get the most recent spool created by user/report *
--> F_REPID *
--> F_UNAME *
--> F_RQIDENT *
form get_spool_number using f_repid
f_uname
changing f_rqident.
data:
lc_rq2name like tsp01-rq2name.
concatenate f_repid+0(8)
f_uname+0(3)
into lc_rq2name separated by '_'.
select * from tsp01 where rq2name = lc_rq2name
order by rqcretime descending.
f_rqident = tsp01-rqident.
exit.
endselect.
if sy-subrc ne 0.
clear f_rqident.
endif.
endform." get_spool_number -
Search for a String in a list of files
Could anyone please send me a java sample code which searches for a string from a list of files and returns me the filename and the line in which the Search String was found ?
Thanks in advance
RRSimple solution would be -
1. Traverse a directory for each file.
2. Read each file using Buffered Reader.
3. Use readLine() method to read a line.
4. Use String.indexOf to see if the data which you are looking for is there in the line or not.
5. If its there then store the line number and file name.
6. When the loop will end you will have list of file name and line number where the data which you are looking for is present. -
Convert ABAP list output to PDF without spool
Hi All,
We have used the FM 'CONVERT_ABAPSPOOLJOB_2_PDF' to convert the list output to PDF. It creates the spool number in SP01 and PDF is getting generated.
But, in our SAP ECC 6.0 server all spools are redirected to printer by default and get printed because it configured like that. We requested BASIS people to reconfigure but they said no for a single report.
So we need to find the alternate solution to generate the PDF without spool. We have searched in sdn, but didnot get any alternate solution.
Please help us in this regard.
Thanks in advance.data: begin of i_list occurs 0,
line(255),
end of i_list.
data:i_mara like mara occurs 0 with header line.
parameters: p_matnr like mara-matnr.
start-of-selection.
set pf-status 'PDFFILE'.
select *
from mara
into table i_mara
where matnr = p_matnr.
loop at i_mara.
write:i_mara-matnr,i_mara-ernam,i_mara-pstat.
endloop.
at user-command.
if sy-ucomm = 'PDF'.
DO.
READ LINE SY-INDEX.
IF SY-SUBRC NE 0.
EXIT.
ELSE.
I_LIST = SY-LISEL.
APPEND I_LIST.
ENDIF.
ENDDO.
NEW-PAGE PRINT ON DESTINATION 'LP03' IMMEDIATELY ' ' COVER TEXT ' ' KEEP IN SPOOL 'X' NEW LIST IDENTIFICATION 'X' LINE-SIZE 132 LINE-COUNT 65 NO DIALOG.
LOOP AT I_LIST.
IF I_LIST-LINE IS INITIAL.
SKIP.
ELSE.
at first.
write: TEXT-001.
endat.
WRITE: I_LIST-LINE+0(132).
ENDIF.
ENDLOOP.
NEW-PAGE PRINT OFF.
data:filename like RLGRAP-filename value 'C:\PDFFILE.PDF'.
DATA: SPOOL TYPE TSP01-RQIDENT.
SPOOL = SY-SPONO.
SUBMIT rstxpdft4
WITH spoolno = spool
WITH download = 'X'
WITH p_file = filename
AND RETURN.
if sy-subrc = 0.
write: 'pdf file generated'.
else.
write:'pdf file not generated'.
EXIT.
endif.
endif.
please paste this code and check once ,if it works modify the code according to ur requirement.
regards,
padmaja -
Quote from Gilad Bracha's tutorial:List<String>[] lsa = new List<?>[10]; // unchecked warning - this is unsafeAt least with jdk 1.5.0_01 it does not compile at all, but gives compile error "incompatioble types. found java.,util.List<?>[]. reuired java.util.List<java.lang.String>".
This one however gives an unchecked warning:List<String>[] lsb = (List<String>[]) new List<?>[10];An error in the tutorial. Thanks for noticing. I've told Gilad.
-
How to typecast a String [] to a List ??
Hi all,
I wanted to typecast a String [] to a List.
The only way I could think of was to run a loop thru the array and add the elements one by one to the List.
Just wondering if there is a smarter way to do it!!
ThanksRonakgpatel wrote:
Hi,
Just refer java.util.Arrays class
List lst = Arrays.asList(arr);
Didn't I already say that? Except the spoonfeeding.
db -
Binary String convertion.
I've question on binary string convert to array of text/number.
I'm tried to use GPIB read to retrieve a trace of Maxhold data (n number
of frequency) from ESMI Spectrum Analyzer. however, those data always
come out to binary string. So is there anyway i can convert Binary
string --> ascii (in my case, array of number/text), or to retrieve
readable data from the Spectrum Analyzer.
Very appreciate for help.
Jacky WongI've question on binary string convert to array of text/number.
I'm tried to use GPIB read to retrieve a trace of Maxhold data (n number
of frequency) from ESMI Spectrum Analyzer. however, those data always
come out to binary string. So is there anyway i can convert Binary
string --> ascii (in my case, array of number/text), or to retrieve
readable data from the Spectrum Analyzer.
Very appreciate for help.
Jacky Wong -
Is there an API or Open Interface to convert Price Lists?
Hi,
Is there an API or Open Interface to convert Price Lists?
What are the additional setups needed to do implement Price Lists ?
Im new to Advnaced Pricing and Order Managment.
Thanks and Regards,
MPHThere is the Price List Setup API (QP_Price_List_PUB.Process_Price_List) which you'll find details for in the Order Management APIs manual and the Price List Bulk Loader which is detailed in the QP user guide plus there's lots of good info and example scripts on My Oracle Support.
Apart from qualifying your price list header as per your business requirement (in other words, restricting its use to particular OUs, customers, products, order types etc.), in the simplest case the price list itself can be just a simple list of discrete items with their associated prices. However, you may also need to consider:
<li> Multicurrency - do you want to have multiple price lists, one for each currency, or one price list in a base currency with multicurrency conversions in the background? (the latter being much the easiest to maintain).
<li> Is your business requirement best served by pricing by discrete inventory item codes? by item categories? by pricing attributes? (this being the mapping of some properties of your data to a named pricing attribute, the value being collected from a lookup, entered at order entry, or derived via custom PL/SQL),
<li> Consider using secondary price lists if this allows your pricing information to be structured better
<li> Do you intend to enter a fixed value against each price list line or to calculate a price by way of a dynamic or static formula?
Regards,
Jon -
Calling a Web Service in a SSRS Report - Error Converting String to Generic List of Strings
Hello,
I am using SSRS version 2005 and am trying to call a web service to retrieve data for a SSRS report. I've looked on Google and MSDN for the past 2 days and have exhausted all options. Here are the details...
The web service method I am calling accepts 4 parameters...
Parameter 1 = Generic list of strings
Parameter 2 = DateTime
Parameter 3 = Int
Parameter 4 = Int
I have created a function (on the CODE tab in report properties) in my report that gets passed a comma delimited string and returns a Generic List of Strings that I use to format Parameter 1. The code for the function is as follows:
Public Function GetIDs(ByVal IDList as String) As List(Of String)
Dim stringArray() = IDList.Split(",")
Dim genericList As New List(Of String)(stringArray)
Return genericList
End Function
I am passing a string to the function that looks something like this:
"1,2,3,4"
When I try to PREVIEW the report, I get an error that reads:
"There is an error on line 0 of custom code: [BC30002] Type 'List' is not defined"
I've tried changing the function declaration to pass back a string array:
Public Function GetIDs(ByVal IDList as String) As String()
Return IDList.Split(","c)
End Function
This returned the error (from the web service):
"Error in line 5 position 22. Expecting state 'Element'.. Encountered 'Text' with name ", namespace"
I have also tried changing the function declaration to pass back an array:
Public Function GetIDs(ByVal IDList as String) As ARRAY
This also produced the error:
"Error in line 5 position 22. Expecting state 'Element'.. Encountered 'Text' with name ", namespace"
I know that this particular web service method DOES work because it is coded to accept nulls in the first parameter. So... when I call the method with nulls, it returns a recordset of ALL data (this works fine). Only when I pass a string to the function (which "filters" the recordset by the ID list), does the error occur.
Is SRSS limited with respect to VB.NET code so that the List(Of String) statement is not recognized? Has anyone done this before and if so, how did you convert a comma delimited string to a Generic List of Strings within a function in the SSRS report?
Any info would be greatly appreciated.
Thanks!
BobHi Bob,
By default, in custom code, in order to use a variable or function that is not in the "System" namespace, we need to provide the full name.
In this case, the full name of the "List" is "System.Collections.Generic.List"
So, to solve the issue, please use the following code:
Public Function GetIDs(ByVal IDList as String) As System.Collections.Generic.List(Of String)
Dim stringArray() = IDList.Split(",")
Dim genericList As New System.Collections.Generic.List(Of String)(stringArray)
Return genericList
End Function
If you have any more questions, please feel free to ask.
Thanks,
Jin Chen
Jin Chen - MSFT -
my question is: How to transform a list of characters of values of time that have format HH:MMS to a list or adjustment of numerical values, to be able to use them in a code of LabVIEW?
The numeric data are going to be used to plot them in a graph XY and to manipulate them.If it's 24-hour format than a Scan From String function with %d:%d:%d as the format string will give you hours, minutes, seconds as numerics. You could then convert to seconds as shown in the attachment.
Attachments:
time_string_to_seconds.jpg 9 KB -
Convert ALV list to PDF and send mails to respective persons
Hi All,
I have a requirement ..we have written a program which will give o/p in alv list.Now I got a requirement to download that program to ALV format.Kindly help me how to approch for that we have some standard FM's for that like CONVERT_ABAPSPOOLJOB_2_PDF..what are the necessary inputs I have to give for that FM,
Second requirement is I have to send an E mail of that list to respective persons.help me on this also
Regards
KKHi,
Try with this program which will send the spool to email.
PARAMETER: p_email1 LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_sender LIKE somlreci1-receiver
DEFAULT '[email protected]',
p_delspl AS CHECKBOX.
*DATA DECLARATION
DATA: gd_recsize TYPE i.
* Spool IDs
TYPES: BEGIN OF t_tbtcp.
INCLUDE STRUCTURE tbtcp.
TYPES: END OF t_tbtcp.
DATA: it_tbtcp TYPE STANDARD TABLE OF t_tbtcp INITIAL SIZE 0,
wa_tbtcp TYPE t_tbtcp.
* Job Runtime Parameters
DATA: gd_eventid LIKE tbtcm-eventid,
gd_eventparm LIKE tbtcm-eventparm,
gd_external_program_active LIKE tbtcm-xpgactive,
gd_jobcount LIKE tbtcm-jobcount,
gd_jobname LIKE tbtcm-jobname,
gd_stepcount LIKE tbtcm-stepcount,
gd_error TYPE sy-subrc,
gd_reciever TYPE sy-subrc.
DATA: w_recsize TYPE i.
DATA: gd_subject LIKE sodocchgi1-obj_descr,
it_mess_bod LIKE solisti1 OCCURS 0 WITH HEADER LINE,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_sender_type LIKE soextreci1-adr_typ,
gd_attachment_desc TYPE so_obj_nam,
gd_attachment_name TYPE so_obj_des.
* Spool to PDF conversions
DATA: gd_spool_nr LIKE tsp01-rqident,
gd_destination LIKE rlgrap-filename,
gd_bytecount LIKE tst01-dsize,
gd_buffer TYPE string.
* Binary store for PDF
DATA: BEGIN OF it_pdf_output OCCURS 0.
INCLUDE STRUCTURE tline.
DATA: END OF it_pdf_output.
CONSTANTS: c_dev LIKE sy-sysid VALUE 'DEV',
c_no(1) TYPE c VALUE ' ',
c_device(4) TYPE c VALUE 'LOCL'.
*START-OF-SELECTION.
START-OF-SELECTION.
* Write statement to represent report output. Spool request is created
* if write statement is executed in background. This could also be an
* ALV grid which would be converted to PDF without any extra effort
WRITE 'Hello World'.
new-page.
commit work.
new-page print off.
IF sy-batch EQ 'X'.
PERFORM get_job_details.
PERFORM obtain_spool_id.
*** Alternative way could be to submit another program and store spool
*** id into memory.
*submit ZSPOOLTOPDF2
* to sap-spool
* spool parameters %_print
* archive parameters %_print
* without spool dynpro
* and return.
* Get spool id from program called above
* IMPORT w_spool_nr FROM MEMORY ID 'SPOOLTOPDF'.
PERFORM convert_spool_to_pdf.
PERFORM process_email.
if p_delspl EQ 'X'.
PERFORM delete_spool.
endif.
IF sy-sysid = c_dev.
wait up to 5 seconds.
SUBMIT rsconn01 WITH mode = 'INT'
WITH output = 'X'
AND RETURN.
ENDIF.
ELSE.
SKIP.
WRITE:/ 'Program must be executed in background in-order for spool',
'request to be created.'.
ENDIF.
* FORM obtain_spool_id *
FORM obtain_spool_id.
CHECK NOT ( gd_jobname IS INITIAL ).
CHECK NOT ( gd_jobcount IS INITIAL ).
SELECT * FROM tbtcp
INTO TABLE it_tbtcp
WHERE jobname = gd_jobname
AND jobcount = gd_jobcount
AND stepcount = gd_stepcount
AND listident <> '0000000000'
ORDER BY jobname
jobcount
stepcount.
READ TABLE it_tbtcp INTO wa_tbtcp INDEX 1.
IF sy-subrc = 0.
message s004(zdd) with gd_spool_nr.
gd_spool_nr = wa_tbtcp-listident.
MESSAGE s004(zdd) WITH gd_spool_nr.
ELSE.
MESSAGE s005(zdd).
ENDIF.
ENDFORM.
* FORM get_job_details *
FORM get_job_details.
* Get current job details
CALL FUNCTION 'GET_JOB_RUNTIME_INFO'
IMPORTING
eventid = gd_eventid
eventparm = gd_eventparm
external_program_active = gd_external_program_active
jobcount = gd_jobcount
jobname = gd_jobname
stepcount = gd_stepcount
EXCEPTIONS
no_runtime_info = 1
OTHERS = 2.
ENDFORM.
* FORM convert_spool_to_pdf *
FORM convert_spool_to_pdf.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = gd_spool_nr
no_dialog = c_no
dst_device = c_device
IMPORTING
pdf_bytecount = gd_bytecount
TABLES
pdf = it_pdf_output
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
OTHERS = 12.
CHECK sy-subrc = 0.
* Transfer the 132-long strings to 255-long strings
LOOP AT it_pdf_output.
TRANSLATE it_pdf_output USING ' ~'.
CONCATENATE gd_buffer it_pdf_output INTO gd_buffer.
ENDLOOP.
TRANSLATE gd_buffer USING '~ '.
DO.
it_mess_att = gd_buffer.
APPEND it_mess_att.
SHIFT gd_buffer LEFT BY 255 PLACES.
IF gd_buffer IS INITIAL.
EXIT.
ENDIF.
ENDDO.
ENDFORM.
* FORM process_email *
FORM process_email.
DESCRIBE TABLE it_mess_att LINES gd_recsize.
CHECK gd_recsize > 0.
PERFORM send_email USING p_email1.
* perform send_email using p_email2.
ENDFORM.
* FORM send_email *
* --> p_email *
FORM send_email USING p_email.
CHECK NOT ( p_email IS INITIAL ).
REFRESH it_mess_bod.
* Default subject matter
gd_subject = 'Subject'.
gd_attachment_desc = 'Attachname'.
* CONCATENATE 'attach_name' ' ' INTO gd_attachment_name.
it_mess_bod = 'Message Body text, line 1'.
APPEND it_mess_bod.
it_mess_bod = 'Message Body text, line 2...'.
APPEND it_mess_bod.
* If no sender specified - default blank
IF p_sender EQ space.
gd_sender_type = space.
ELSE.
gd_sender_type = 'INT'.
ENDIF.
* Send file by email as .xls speadsheet
PERFORM send_file_as_email_attachment
tables it_mess_bod
it_mess_att
using p_email
'Example .xls documnet attachment'
'PDF'
gd_attachment_name
gd_attachment_desc
p_sender
gd_sender_type
changing gd_error
gd_reciever.
ENDFORM.
* FORM delete_spool *
FORM delete_spool.
DATA: ld_spool_nr TYPE tsp01_sp0r-rqid_char.
ld_spool_nr = gd_spool_nr.
CHECK p_delspl <> c_no.
CALL FUNCTION 'RSPO_R_RDELETE_SPOOLREQ'
EXPORTING
spoolid = ld_spool_nr.
ENDFORM.
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
* Send email
FORM send_file_as_email_attachment tables it_message
it_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
DATA: ld_error TYPE sy-subrc,
ld_reciever TYPE sy-subrc,
ld_mtitle LIKE sodocchgi1-obj_descr,
ld_email LIKE somlreci1-receiver,
ld_format TYPE so_obj_tp ,
ld_attdescription TYPE so_obj_nam ,
ld_attfilename TYPE so_obj_des ,
ld_sender_address LIKE soextreci1-receiver,
ld_sender_address_type LIKE soextreci1-adr_typ,
ld_receiver LIKE sy-subrc.
data: t_packing_list like sopcklsti1 occurs 0 with header line,
t_contents like solisti1 occurs 0 with header line,
t_receivers like somlreci1 occurs 0 with header line,
t_attachment like solisti1 occurs 0 with header line,
t_object_header like solisti1 occurs 0 with header line,
w_cnt type i,
w_sent_all(1) type c,
w_doc_data like sodocchgi1.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
* Fill the document data.
w_doc_data-doc_size = 1.
* Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
* Fill the document data and get size of attachment
CLEAR w_doc_data.
READ TABLE it_attach INDEX w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = it_attach[].
* Describe the body of the message
CLEAR t_packing_list.
REFRESH t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
DESCRIBE TABLE it_message LINES t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
APPEND t_packing_list.
* Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
APPEND t_packing_list.
* Add the recipients email address
CLEAR t_receivers.
REFRESH t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
APPEND t_receivers.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
IMPORTING
sent_to_all = w_sent_all
TABLES
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
* Populate zerror return code
ld_error = sy-subrc.
* Populate zreceiver return code
LOOP AT t_receivers.
ld_receiver = t_receivers-retrn_code.
ENDLOOP.
ENDFORM.
Regards,
Raghav
Maybe you are looking for
-
HT201210 can't back up iphone to computer
can't back up my iphone to my home desktop computer on vista
-
Please answer asap install question post
https://support.mozilla.org/en-US/forums/firefoxaurora/708210?last=46112#post-46112 please answer asap install question post
-
Conversion of source system names --- error in transport
hi i want to transport my object from Dev111 to Quality222 but the transport ended up in error 8 it gave the error... Source system PRODUCTION333 does not exist I am confused, shouldnot it should give error related to Quality system ??? how should be
-
Hi, I created one BI report using excel template. I took the base template from samples Bugreport.xls. tool is excel analyser. I customized with my own xml source and mapped the fields. The report is working fine when I am calling from apex by passin
-
Hi to all can body provide the information regarding Function module and enhancements in this want i need step by step screen shots and why u would go for FM Regards, Satya.