Send a table with a function.
Hi all!!
I want to send a table with a function, but I don't know how to do it.
in my code I have this.
FUNCTION ZBORRAR.
""Interfase local
*" TABLES
TABLES: T751F.
*" VARIABLES
DATA: BEGIN OF S_CLA_MED_CAND.
DATA: MASSN LIKE T751F-MASSN,
MNTXT LIKE T751F-MNTXT.
DATA: END OF S_CLA_MED_CAND.
DATA: T_CLA_MED_CAND LIKE S_CLA_MED_CAND OCCURS 0 WITH HEADER LINE.
*" FILL THE I. TABLE
SELECT MASSN MNTXT
FROM T751F
INTO TABLE T_CLA_MED_CAND
WHERE SPRSL = 'S'.
ENDFUNCTION.
I don't have any thing in the import, export, modif., tables tabs.
Thanks and Regards.
I MADE THIS...
I FOLLOWED THIS
Define a tan\ble in the TABLES tab.
Table name: T_CLA_MED_CAND
Type: LIKE
Associated Type: T751F
Table T_CLA_MED_CAND will be sent thru this FM.
AND MY CODE IS:
FUNCTION ZBORRAR.
""Interfase local
*" TABLES
*" X_CLA_MED_CAND STRUCTURE T751F
*" TABLES
*" VARIABLES
TYPES: BEGIN OF S_CLA_MED_CAND,
MASSN LIKE T751F-MASSN,
MNTXT LIKE T751F-MNTXT,
END OF S_CLA_MED_CAND.
DATA: T_CLA_MED_CAND TYPE TABLE OF S_CLA_MED_CAND WITH HEADER LINE.
*" GET DATA
SELECT MASSN MNTXT
FROM T751F
INTO TABLE T_CLA_MED_CAND
WHERE SPRSL = 'S'.
LOOP AT T_CLA_MED_CAND.
MOVE: T_CLA_MED_CAND-MASSN TO X_CLA_MED_CAND-MASSN,
T_CLA_MED_CAND-MNTXT TO X_CLA_MED_CAND-MNTXT.
APPEND X_CLA_MED_CAND.
ENDLOOP.
ENDFUNCTION.
IN THE RESULTS THE TABLE HAS THE DATA I WANT BUT THERE IS TWO MORE FIELDS MANDT AND SPRSL. IS THIS BECAUSE THE SPRSL I'M USING IT TO FILTER THE DATA AND THE MANDT 'CAUSE I'M WORKING IN IT?
HOW CAN I JUST HAVE TWO FIELDS??
Similar Messages
-
Sorting table with custom function
Hi,
I am using JDev 11.1.1.4.0
I have a table with records.
public Record(int id, String desc) {
this.id = id;
this.description = desc;
I want to implement a sorting function, for the description column, based on the length of the String.
Any ideas how to do it?Hi Pedro,
In that case the class Record should be "comparable" as you said.
You can replace the current collection by an ordered list/set, and then implement the interface Comparator.
This is an example:
public java.util.TreeSet<Record> getRecords() {
TreeSet<Record> records = new TreeSet<Record>(new RecordComparator());
// routine to get the records
return records;
class RecordComparator implements Comparator<Record> {
@Override
public int compare(Record o1, Record o2) {
// be careful with null records/attributes!
return o1.getDescription().length() > o2.getDescription().length() ? 1 : o1.getDescription().length() < o2.getDescription().length() ? -1 : 0;
}After that, try this:
http://technology.amis.nl/2012/03/01/adf-11g-programmatically-configuring-sort-for-rich-table/
AP
Correction:
Just add a transient attribute to class Record and try this with that new attribute: http://technology.amis.nl/2012/03/01/adf-11g-programmatically-configuring-sort-for-rich-table/
AP
Edited by: Alejandro Profet on Nov 12, 2012 3:32 PM -
Polling for new Data in Tables with SQL-functions
Hi
In my table I have 2 columns:
event_state : integer (0 = unread, 1 = read)
min_process_time : date
In the DB-Adapter-Wizard I can configure my event_state-Field for using as logical delete field. In the SQL-Query there is a
... WHERE event_state=0
But, I only want to query all new entries in this table, where
min_process_time > SYSDATE.
How can I configure my toplink-mapping, that SYSDATE can be used in the polling-query? If I use plain-sql instead of the expression from the Wizard (last page), then this sql-statement is ignored. In an expression I only can use a constant-value.
Any idea?
Thanks
GregorHi
I am creating a database Polling (logical delete OPEN to CLOSED) adapter that polls a table for records which have a "SCHEDULED" date field.
The Polling Adapter should pick up those records where the status is OPEN and SCHEDULED<=SYSDATE.
DB Adapter wizard does not allows this where clause(SCHEDULED<=SYSDATE) to be set; so i tried modifying the Toplink SQL with custom SQL. But it does not works. Please suggest a workaround.
Please help.
Thanks
Debashis -
Join tables with aggregate function
Hello
I have 4 views that I need to perform aggregate function, count, on and then join them for query output.
Basically each view has a column with a score and a subcontractor name. One subcontractor may have more than one score in each view.
Here is the sql that I'm working with thus far:
select e.sub_name, (count(e.score) - 1), (count(v.score) - 1), (count(s.score) - 1), (count(u.score) - 1)
from speed.v_ratings_ex e, speed.v_ratings_vg v, speed.v_ratings_sat s, speed.v_ratings_uns u
where v.sub_name = e.sub_name
and s.sub_name = e.sub_name
and u.sub_name = e.sub_name
group by e.sub_name
order by e.sub_name asc;
This results in each column returning the same value b/c the join is performed before the aggregate function.
Can anyone offer some help so that I may get the desired results?You need to use in-line views to perform the aggregates, then join the in-line views.
Something like:
SELECT e.sub_name, e.score - 1 escore, v.score - 1 vscore,
s.score - 1 sscore, u.score - 1 uscore
FROM (SELECT sub_name,count(*) score
FROM v_ratings_ex
GROUP BY sub_name) e,
(SELECT sub_name,count(*) score
FROM v_ratings_vg
GROUP BY sub_name) v,
(SELECT sub_name,count(*) score
FROM v_ratings_sat
GROUP BY sub_name) s,
(SELECT sub_name,count(*) score
FROM v_ratings_uns
GROUP BY sub_name) u
WHERE v.sub_name = e.sub_name and
s.sub_name = e.sub_name and
u.sub_name = e.sub_name
ORDER BY e.sub_name asc;TTFn
John -
Slicer Time Dimension Issue with Cube Functions
Hi,
Hoping someone can help me figure out right approach here.
Summary:
Using Excel 2013 connected to a SSAS cube as data source, and cube functions with slicers to create a dashboard.
Have following time dimension slicers; Fiscal Year, Fiscal Quarter, Fiscal Month, Fiscal Week & Date, that are used to slice data based on user selection, along
with a sales measure.
Below is example of Slicer name and CubeMember function for each:
Slicer_Fiscal_Year:
=CUBEMEMBER("Cube","[Date].[Fiscal Year].&[2015]")
Slicer_Fiscal_Quarter:
=CUBEMEMBER("Cube","[Date].[Fiscal Quarter].[All]")
Slicer_Fiscal_Month:
=CUBEMEMBER("Cube","[Date].[Fiscal Month].&[201408]")
Slicer_Fiscal_Week:
=CUBEMEMBER("Cube","[Date].[Fiscal Week].&[201509]")
Slicer_Date:
=CUBEMEMBER("Cube","[Date].[Date].[All]")
Problem:
What I am trying to do is to build a table with cube functions that takes the lowest grain of the slicer time dimension selected, shows the current member, plus
the prior 7 so I can have an 8 period trending view table that I will build a chart from. In the above example that would mean that it would look at Slicer_Fiscal_Week since that is lowest grain that has an attribute other than All, and then show me the prior
7 periods. In this case 201509 means Week 9, so I would want to show in table Week 9 back to Week 2. But if Slicer_Fiscal_Week was set to All, along with Slicer_Date, then Fiscal Month would be lowest grain, so I would want to show Fiscal Months from August
(201408) back to January 2014. I know how to use CubeRankedMember to pull the value from what is selected in the slicer, the problem is figuring out how to pass the lowest grain time dimension so that I can use lag or some other MDX function to get the previous
periods.
Any help on this would be greatly appreciated.
<object height="1" id="plugin0" style=";z-index:1000;" type="application/x-dgnria" width="1"><param name="tabId" value="{28593A5C-70C0-4593-9764-80C76B51795C}"
/></object>Hello,
Thank you for your question.
I am trying to involve someone familiar with this topic to further look at this issue.
George Zhao
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. -
How to Send Internal table to SAP Spool using Function Modules or Methods?
Hi Experts,
How to Send Internal table to SAP Spool using Function Modules or Methods?
Thanks ,
KiranThis is my code.
I still get the no ABAP list data for the spool, even tho I can see it sp01?
REPORT Z_MAIL_PAYSLIP.
* Declaration Part *
tables: PERNR, PV000, T549Q, V_T514D, HRPY_RGDIR.
infotypes: 0000, 0001, 0105, 0655.
data: begin of ITAB occurs 0,
MTEXT(25) type C,
PERNR like PA0001-PERNR,
ABKRS like PA0001-ABKRS,
ENAME like PA0001-ENAME,
USRID_LONG like PA0105-USRID_LONG,
end of ITAB.
data: W_BEGDA like HRPY_RGDIR-FPBEG,
W_ENDDA like HRPY_RGDIR-FPEND.
data: RETURN like BAPIRETURN1 occurs 0 with header line.
data: P_INFO like PC407,
P_FORM like PC408 occurs 0 with header line.
data: P_IDX type I,
MY_MONTH type T549Q-PABRP,
STR_MY_MONTH(2) type C,
MY_YEAR type T549Q-PABRJ,
STR_MY_YEAR(4) type C,
CRLF(2) type x value '0D0A'.
data: W_CMONTH(10) type C.
data: TAB_LINES type I,
ATT_TYPE like SOODK-OBJTP.
data: begin of P_INDEX occurs 0,
INDEX type I,
end of P_INDEX.
constants: begin of F__LTYPE, "type of line
CMD like PC408-LTYPE value '/:', "command
TXT like PC408-LTYPE value 's', "textline
end of F__LTYPE.
constants: begin of F__CMD, "commands
NEWPAGE like PC408-LINDA value '',
end of F__CMD.
data: P_LIST like ABAPLIST occurs 1 with header line.
*data: OBJBIN like SOLISTI1 occurs 10 with header line,
data: OBJBIN like LVC_S_1022 occurs 10 with header line,
DOCDATA like SODOCCHGI1,
OBJTXT like SOLISTI1 occurs 10 with header line,
OBJPACK like SOPCKLSTI1 occurs 1 with header line,
RECLIST like SOMLRECI1 occurs 1 with header line,
OBJHEAD like SOLISTI1 occurs 1 with header line,
it_mess_att LIKE solisti1 OCCURS 0 WITH HEADER LINE,
gd_buffer type string,
l_no_of_bytes TYPE i,
l_pdf_spoolid LIKE tsp01-rqident,
l_jobname LIKE tbtcjob-jobname.
data: file_length type int4,
spool_id type rspoid,
line_cnt type i.
*-------------------------------------------------------------------* * INITIALIZATION *
OBJBIN = ' | '.
append OBJBIN.
OBJPACK-HEAD_START = 1.
data: S_ABKRS like PV000-ABKRS.
data: S_PABRP like T549Q-PABRP.
data: S_PABRJ like T549Q-PABRJ.
* SELECTION SCREEN *
selection-screen begin of block BL1.
parameters: PAY_VAR like BAPI7004-PAYSLIP_VARIANT default 'ESS_PAYSLIPS' obligatory.
selection-screen end of block BL1.
START-OF-SELECTION.
s_ABKRS = PNPXABKR.
S_PABRP = PNPPABRP.
s_pabrj = PNPPABRJ.
w_begda = PN-BEGDA.
w_endda = PN-ENDDA.
get pernr.
* "Check active employees
rp-provide-from-last p0000 space pn-begda pn-endda.
CHECK P0000-STAT2 IN PNPSTAT2.
* "Check Payslip Mail flag
rp-provide-from-last p0655 space pn-begda pn-endda.
CHECK P0655-ESSONLY = 'X'.
rp-provide-from-last p0001 space pn-begda pn-endda.
* "Find email address
RP-PROVIDE-FROM-LAST P0105 '0030' PN-BEGDA PN-ENDDA.
if p0105-usrid_LONG ne ''.
ITAB-PERNR = P0001-PERNR.
ITAB-ABKRS = P0001-ABKRS.
ITAB-ENAME = P0001-ENAME.
ITAB-USRID_LONG = P0105-USRID_LONG.
append itab.
clear itab.
endif.
"SY-UCOMM ='ONLI'
END-OF-SELECTION.
*------------------------------------------------------------------* start-of-selection.
write : / 'Payroll Area : ', S_ABKRS.
write : / 'Payroll Period/Year : ',STR_MY_MONTH,'-',STR_MY_YEAR. write : / 'System Date : ', SY-DATUM.
write : / 'System Time : ', SY-UZEIT.
write : / 'User Name : ', SY-UNAME.
write : / SY-ULINE.
sort ITAB by PERNR.
loop at ITAB.
clear : P_INFO, P_FORM, P_INDEX, P_LIST, OBJBIN, DOCDATA, OBJTXT, OBJPACK, RECLIST, TAB_LINES.
refresh : P_FORM, P_INDEX, P_LIST, OBJBIN, OBJTXT, OBJPACK, RECLIST.
* Retrieve Payroll results sequence number for this run
select single * from HRPY_RGDIR where PERNR eq ITAB-PERNR
and FPBEG ge W_BEGDA
and FPEND le W_ENDDA
and SRTZA eq 'A'.
* Produce payslip for those payroll results
if SY-SUBRC = 0.
call function 'GET_PAYSLIP'
EXPORTING
EMPLOYEE_NUMBER = ITAB-PERNR
SEQUENCE_NUMBER = HRPY_RGDIR-SEQNR
PAYSLIP_VARIANT = PAY_VAR
IMPORTING
RETURN = RETURN
P_INFO = P_INFO
TABLES
P_FORM = P_FORM.
check RETURN is initial.
* remove linetype from generated payslip
loop at p_form.
objbin = p_form-linda.
append objbin.
line_cnt = line_cnt + 1.
endloop.
file_length = line_cnt * 1022.
* create spool file of paylsip
CALL FUNCTION 'SLVC_TABLE_PS_TO_SPOOL'
EXPORTING
i_file_length = file_length
IMPORTING
e_spoolid = spool_id
TABLES
it_textdata = objbin.
IF sy-subrc EQ 0.
WRITE spool_id.
ENDIF.
DESCRIBE table objbin.
DATA PDF LIKE TLINE OCCURS 100 WITH HEADER LINE.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID = spool_id
NO_DIALOG = ' '
DST_DEVICE = 'MAIL'
* PDF_DESTINATION =
* IMPORTING
* PDF_BYTECOUNT = l_no_of_bytes
* PDF_SPOOLID = l_pdf_spoolid
* LIST_PAGECOUNT =
* BTC_JOBNAME =
* BTC_JOBCOUNT =
TABLES
PDF = 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
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*Download PDF file C Drive
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\itab_to_pdf.pdf'
filetype = 'BIN'
TABLES
data_tab = pdf.
* Transfer the 132-long strings to 255-long strings
* LOOP AT pdf.
* TRANSLATE pdf USING ' ~'.
* CONCATENATE gd_buffer pdf 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.
OBJHEAD = 'Objhead'.
append OBJHEAD.
* preparing email subject
concatenate W_ENDDA(6)
' Payslip-'
ITAB-ENAME+0(28)
ITAB-PERNR+4(4) ')'
into DOCDATA-OBJ_DESCR.
DOCDATA-OBJ_NAME = 'Pay Slip'.
DOCDATA-OBJ_LANGU = SY-LANGU.
OBJTXT = 'Pay Slip.'.
append OBJTXT.
*prepare email lines
OBJTXT = DOCDATA-OBJ_DESCR.
append OBJTXT.
OBJTXT = 'Please find enclosed your current payslip.'.
append OBJTXT.
* Write Attachment(Main)
* 3 has been fixed because OBJTXT has fix three lines
read table OBJTXT index 3.
* DOCDATA-DOC_SIZE = ( 3 - 1 ) * 255 + strlen( OBJTXT ).
clear OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = 3.
OBJPACK-DOC_TYPE = 'RAW'.
append OBJPACK.
* Create Message Attachment
ATT_TYPE = 'PDF'.
describe table OBJBIN lines TAB_LINES.
read table OBJBIN index TAB_LINES.
* OBJPACK-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + strlen( OBJBIN ).
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = ATT_TYPE.
OBJPACK-OBJ_NAME = 'ATTACHMENT'.
OBJPACK-OBJ_DESCR = 'Payslip'.
append OBJPACK.
* Create receiver list refresh RECLIST.
clear RECLIST.
RECLIST-RECEIVER = itab-USRID_long.
translate RECLIST-RECEIVER to lower case.
RECLIST-REC_TYPE = 'U'.
append RECLIST.
* Send the document
*SO_NEW_DOCUMENT_ATT_SEND_API1
call function 'SO_DOCUMENT_SEND_API1'
exporting
DOCUMENT_DATA = DOCDATA
PUT_IN_OUTBOX = 'X'
COMMIT_WORK = 'X'
* IMPORTING
* SENT_TO_ALL =
* NEW_OBJECT_ID =
tables
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = pdf
CONTENTS_TXT = OBJTXT
* CONTENTS_HEX =
* OBJECT_PARA =
* OBJECT_PARB =
RECEIVERS = RECLIST
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.
if SY-SUBRC NE 0.
ITAB-MTEXT = 'Message Not Sent to : '.
else.
ITAB-MTEXT = 'Message Sent to : '.
endif.
* else.
* ITAB-MTEXT = 'Message Not Sent to : '.
* endif.
else.
"SY-SUBRC Not = 0
ITAB-MTEXT = 'Payroll data not found : '.
endif.
"end of SY-SUBRC = 0.
modify ITAB.
endloop. "end loop at ITAB
sort ITAB by MTEXT PERNR.
loop at ITAB.
at new MTEXT.
uline.
write : / ITAB-MTEXT color 4 intensified on.
write : / 'Emp. Code' color 2 intensified on,
12 'Emp. Name' color 2 intensified on,
54 'Email ID' color 2 intensified on.
endat.
write : / ITAB-PERNR, 12 ITAB-ENAME, 54 ITAB-USRID_LONG.
endloop. -
Send Internal table to mail with Colman name
Hi,
how can i send the content of internal table to mail ,
i try to convert to HTML and send it but the problem is that i don't get the column name ,
there is another way to send the IT with the column name ?
any e.g will help i am stuck ....
Regardsyou can use upto here..and then you can send html table as attachement in the mail
DATA:
t_html TYPE STANDARD TABLE OF w3html WITH HEADER LINE,
" Html Table
*- Declare Internal table and Fieldcatalog
it_fcat TYPE lvc_t_fcat WITH HEADER LINE." Fieldcatalog
DATA: i_table TYPE REF TO data,
wa_line TYPE REF TO data.
FIELD-SYMBOLS: <fs_tab> TYPE STANDARD TABLE,
<fs_wa> TYPE ANY.
DATA:
v_lines TYPE i,
v_field(40).
*-Fieldsymbols
FIELD-SYMBOLS: <fs> TYPE ANY.
PARAMETERS: p_table(30) TYPE c.
* S T A R T - O F - S E L E C T I O N
START-OF-SELECTION.
*-Populate the Fieldcatalog
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = p_table
CHANGING
ct_fieldcat = it_fcat[]
EXCEPTIONS
inconsistent_interface = 1
program_error = 2.
* Create dynamic internal table and assign to FS
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = it_fcat[]
IMPORTING
ep_table = i_table.
ASSIGN i_table->* TO <fs_tab>.
* Create dynamic work area and assign to FS
CREATE DATA wa_line LIKE LINE OF <fs_tab>.
ASSIGN wa_line->* TO <fs_wa>.
SELECT *
FROM (p_table)
INTO TABLE <fs_tab>
UP TO 20 ROWS.
* E N D - O F - S E L E C T I O N
END-OF-SELECTION.
*-Fill the Column headings and cell properties
DELETE it_fcat WHERE fieldname = 'MANDT'.
t_html-line = '<html>'.
APPEND t_html.
CLEAR t_html.
t_html-line = '<thead>'.
APPEND t_html.
CLEAR t_html.
t_html-line = '<tr>'.
APPEND t_html.
CLEAR t_html.
t_html-line = '<td><h1>DB Details</h1></td>'.
APPEND t_html.
CLEAR t_html.
t_html-line = '</tr>'.
APPEND t_html.
CLEAR t_html.
t_html-line = '</thead>'.
APPEND t_html.
CLEAR t_html.
t_html-line = '<table border = "1">'.
APPEND t_html.
CLEAR t_html.
t_html-line = '<tr>'.
APPEND t_html.
CLEAR t_html.
*-Populate HTML columns from Filedcatalog
LOOP AT it_fcat.
CONCATENATE '<th bgcolor = "green" fgcolor = "black">'
it_fcat-scrtext_l
'</th>' INTO t_html-line.
APPEND t_html.
CLEAR t_html.
ENDLOOP.
t_html-line = '</tr>'.
APPEND t_html.
CLEAR t_html.
DESCRIBE TABLE it_fcat LINES v_lines.
*-Populate HTML table from Internal table data
LOOP AT <fs_tab> ASSIGNING <fs_wa>.
t_html-line = '<tr>'.
APPEND t_html.
CLEAR t_html.
*-Populate entire row of HTML table
DO v_lines TIMES.
READ TABLE it_fcat INDEX sy-index.
CONCATENATE '<FS_WA>-' it_fcat-fieldname INTO v_field.
ASSIGN (v_field) TO <fs>.
t_html-line = '<td>'.
APPEND t_html.
CLEAR t_html.
t_html-line = <fs>.
APPEND t_html.
CLEAR t_html.
t_html-line = '</td>'.
APPEND t_html.
CLEAR t_html.
CLEAR v_field.
UNASSIGN <fs>.
ENDDO.
t_html-line = '</tr>'.
APPEND t_html.
CLEAR t_html.
ENDLOOP.
t_html-line = '</table>'.
APPEND t_html.
CLEAR t_html. -
Problem with sending objects to a package function
Hello fellows,
I am working on a project where I need to call a PL/SQL package's function and then work with the result.
The procedure takes a custom object:
CREATE OR REPLACE TYPE DTODOROV.my_object AS OBJECT
ATTR1 VARCHAR2(255)
)and the result is the same object.
I have the following java code
if(conn.isUsable()){
System.out.println("Connected!");
ocs = (OracleCallableStatement) conn.prepareCall("{? = call MYPACK.MF(?)}");
Object[] args1 = {"Petar"};
STRUCT ms = new STRUCT(new StructDescriptor("DTODOROV.MY_OBJECT", conn), conn, args1);
ocs.setObject(2, ms, OracleTypes.STRUCT);
ocs.registerOutParameter(1, OracleTypes.STRUCT,"DTODOROV.MY_OBJECT");
ocs.execute();
Object object = ocs.getObject(1);
System.out.println(((STRUCT)object).getAttributes()[0]);
}And this is the body of my package:
CREATE OR REPLACE PACKAGE BODY DTODOROV.myPack AS
FUNCTION MF(Param1 MY_OBJECT) RETURN MY_OBJECT
is
myObjIn MY_OBJECT;
myObjOut MY_OBJECT;
BEGIN
myObjIn:=Param1;
if(myObjIn.ATTR1 <> null) then
myObjOut:= new MY_OBJECT('Mitko');
INSERT INTO DEBUG_INFO VALUES (myObjIn.ATTR1||'not empty');
else
myObjOut:= new MY_OBJECT('Oktim ');
INSERT INTO DEBUG_INFO VALUES ('empty');
end if;
return myObjOut;
END;
END myPack;
/DEBUG_INFO is just a table with one column to check what is happening.
The database is oracle 11g.
JDBC driver is the latest from oracle.
JDK is 1.6
The java is intended to run as a web service on GlassFish (for now, or Tomcat later).
And here is my problem. When I execute the java code the object i send to the procedure is null. What am I doing wrong? Because I get no exceptions or SQL errors. If you could give me some pointers as to how to easily debug such code?
Thanks in advance,
Mitko
Edited by: DiTod on Apr 5, 2011 8:41 AMif (conn.isUsable()) {
System.out.println("Connected!");
ocs = (OracleCallableStatement) conn.prepareCall("{? = call MYPACK.MF(?)}");
Object[] args1 = {new CHAR("fa",CharacterSet.make(CharacterSet.UTF8_CHARSET))};
StructDescriptor sd = StructDescriptor.createDescriptor("DTODOROV.MY_OBJECT", conn);
STRUCT ms = new STRUCT(sd, conn, args1);
System.out.println(ms.dump());
ocs.setObject(2, ms, OracleTypes.STRUCT);
ocs.registerOutParameter(1, OracleTypes.STRUCT,"DTODOROV.MY_OBJECT");
ocs.execute();
Object object = ocs.getObject(1);
System.out.println(((STRUCT)object).getAttributes()[0]);
}I think you mean this. But it is still not working :(
Actually when I dump it I see that it has just one property and that it is from the correct type
>
name = DTODOROV.MY_OBJECT
length = 1
ATTR1 = fa
>
but something happens during the sending and in the database I don't recieve the object or it is null.
Edited by: DiTod on Apr 5, 2011 8:46 AM -
Pages '08 - Tables with Functions
Pages '08 does a much better job calculating and recalculating a currency sum in a table than does MS Word. With Pages you can draw a table, label, place functions and they will recalculate directly in Pages.
With MS Word, you have to set up the table in Excel and then link or enbed the Excel information in Word. Then when you want to update the information in Word, you have to update in Excel first, before it will update in Word.
I like Pages '08 where you update directly in Pages without having to use Numbers as a link or enbeded.
If anyone knows how to do what Pages '08 does, and can do the same in MS Excel, please let me know.
Thanks,
FrankHello
What you get is not surprising.
Th code used to rule tables in Pages is exactly the code used to rule a table in Numbers.
I just wish to add that you may do more complex things is you work in Numbers.
You may use the Numbers Sheet as a blank sheet of paper on which you may put everything:
text frames
paint objects
draw objects
tables which may be linked
This is the same kind of documents than those named Draw ones in AppleWorks with many added features, bells and whistles
The only missing feature (at least from my point of view) is a tool allowing us to import AppleWorks Draw documents in these Numbers ones.
Yvan KOENIG (from FRANCE lundi 21 janvier 2008 21:01:42) -
Sending XML file from SAP to Windows Based file server with FTP function
Hi Gurus,
We are using SAP BW 3.0B version.
I need to convert data in ODS to XML format and send this XML file to remote server which is not a SAP application server, it is just a Window Based file server with FTP function..
By writing some ABAP code I have converted ODS data into XML format (which gets saved in my local system)
(Is that I need to put this file in Application Server to send it to the other servers? )
Now the thing is how I can send this file to that Windows Based file server.
plz suggest me.... what can be done......
Thanks in Advance
Madhusudhan
Edited by: Madhusudhan Raju on Dec 3, 2009 4:25 AMI dont think the above code support windows OS. Because I always execute this script via UNIX.
I think you can try this option, go to command prompt, goto the destination path where you have an XML file using cd....
ftp (destination servername), specify the username and password.
afterthat, use the command put and filename.
check whether the file had reached destination successfully or not.
For automation purpose, you can use the following script like
ftp: -s: test.txt (servername)
In test.txt,
UserName
Password
bin
cd /files
put file.xml
bye
Also, you can check in SM69, there will be some SAP external commands to automate the file transfer.
Thanks
Sat
http://support.microsoft.com/?kbid=96269 -
Sender JDBC Adapter with Mutiple SQL Database Tables.
Hi All,
My requirement is SQL->PI7.0->BI.
I have a plan to go with the senario like this : JDBC sender->SAPPI->ABAP Proxy.
And also I need fetch the data from more than 10 data tables with different database tables with key fields.
Could you please suggest me, How to extract all tables data to SAP PI System. Either need to go with Stored procedures or Any Join conditions or each table like as one Interface.
Please provide me your suggestions.
Regards,
ChandraHi ,
Chandra ,
Best way is Database Views
Involve a Database guy in your scenario : Tell DBA the fields required , tell DBA the PrimaryKey and ForeignKey Relation Between All your 10 Tables.
DBA will create a View for you on 10 Tables.
So in Ur SELECT Query . you can write simply
Select * from <ViewName>;
And One more thing to Tell DBA to create a UPDATABLE VIEW not only READ-ONLY View.
By this way you can way you can Update VIEW also in UPDATE QUERY of sender Adapter...
Regards
PS -
To upload a data into SAP Table with the help of RFC function in BODS
Hi,
Please provide me step-by-step solution to upload data into any SAP table with the help of RFC function in Data Services.
I have created RFC function that upload data into SAP table. RFC Function contains one table that has same structure as my database table.
In the data services how can i filled the table of RFC function, i am using this function in query transform of data services but it gives me error.
I am also follow link http://wiki.sdn.sap.com/wiki/display/BOBJ/BusinessObjectsDataServicesTipsand+Tricks
but it did not help me.
Thanks,
AbhishekHi Abhishek,
Did you import the function module in the SAP datastore first? When you open the SAP datastore, the function should be listed in the 'functions' section. If not, import it. Make sure your function is remote executable.
Once the function is there, you can use it in a transformation. In 'Schema Out' right-click on 'Query' (top level) and choose 'New Function Call'. You can then select a datastore and a function in the datastore. The wizard will show you which output parameters are available. I believe you have to add at least one and can select as many as you like.
After confirming your selection the function and the output parameters appear in Schema Out. You can then right-click on the function and choose 'Modify function call'. A popup will appear where you can specify the input parameters.
I hope this helps.
Jan. -
Table with type ANY in function module
Hi all
I want to use a function module in different programs. I want to pass always a table and in a string the name of the structure, so that I can access the data with ASSIGN and the passed structure name.
For a structure I can use the type ANY, but if I want to use a table in a function module, I need to define a table type.
Is there a way to define a tabletype with the type ANY? A Workaround would be fine too.
Thanks and best regards!
ChristianHi Christian,
ANY TABLE is used to type a parameter, or field symbol, that can be a table of any type or structure.
ANY is used to type a parameter, or field symbol, that can be any type. You can't, however, use any table operations on a parameter/field-symbol typed as ANY. For that, you have to use ANY TABLE.
The same applies to ANY. You can pass to the method a data object, without specifying its type (i.e, in dynamic programs).
Suppose that I need to split a line into a table, but I don't know the structure of this line:
I have a method:
codeMETHOD split_line_in_table IMPORTING im_line TYPE ANY
EXPORTING ex_table TYPE ANY TABLE.
[/code]
codeMETHOD split_line_in_table.
SPLIT im_line AT separator INTO TABLE ex_table.
ENDMETHOD.[/code]
Now, i can pass this method a line of ANY structure and get a table without specifying its structure.
cheers,
Hema. -
Function Module To Copy Abap tables with data
Hi,
Is there an easy way to copy abap tables with the data to another destination table using function modules or sample codes?What do you mean for "destination"? Another SAP system e.g. an RFC destination?
And what kind of table do you need to copy? Ztables? Standard Tables?
If you mean Standard Tables, your task isn't a safe procedure. -
[Function] Declare a internal table with structure name (entry parameter)
Hi all,
I'm explaining my problem :
I want to create a function with two parameters in entry :
(IMPORT) - structure_name with type DD02L-TABNAME
(TABLES) - t_outtab with empty type
t_outtab will be in structure_name type.
Now, in my source function, I want to retrieve all contain of t_outtab in another internal table or field-symbol. I don't know in advance the used structures in my function entries.
I don't manage to get this contain, cause I can't do :
DATA : internal_table TYPE structure_name*
OR
DATA : internal_table TYPE (structure_name)
OR used field-symbol
DATA : internal_table TYPE <fs>* where <fs> had structure name value.
To do more later :
*DATA : line LIKE LINE OF internal_table. *
*internal_table][ = t_outtab][. *
And work with this table.
_ I tried different solutions like : _
Get the structure of the table.
ref_table_des ?= cl_abap_typedescr=>describe_by_name( I_STRUCTURE_NAME ).
idetails[] = ref_table_des->components[].
Get the first structure table of result table
LOOP AT idetails INTO xdetails.
CLEAR: xfc.
xfc-fieldname = xdetails-name .
xfc-datatype = xdetails-type_kind.
xfc-inttype = xdetails-type_kind.
xfc-intlen = xdetails-length.
xfc-decimals = xdetails-decimals.
APPEND xfc TO ifc.
ENDLOOP.
Create dynamic internal table and assign to FS
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = ifc
IMPORTING
ep_table = dy_table.
ASSIGN dy_table->* TO <dyn_table>.
Create dynamic work area and assign to FS
CREATE DATA dy_line LIKE LINE OF <dyn_table>.
ASSIGN dy_line->* TO <dyn_wa>.
and retrieve to <dyn_table>[] = t_outtab[].
the but I don't try the solution. If someone have an idea.
Thanks and regards.
Romain
Edited by: Romain L on May 14, 2009 11:35 AMHi,
We can acheive this using dynamic internal tables.
Please find sample below.
*Creating Dynamic internal table
PARAMETERS : p_table(10) TYPE C.
DATA: w_tabname TYPE w_tabname,
w_dref TYPE REF TO data,
w_grid TYPE REF TO cl_gui_alv_grid.
FIELD-SYMBOLS: <t_itab> TYPE ANY TABLE.
w_tabname = p_table.
CREATE DATA w_dref TYPE TABLE OF (w_tabname).
ASSIGN w_dref->* TO <t_itab>.
* Populating Dynamic internal table
SELECT *
FROM (w_tabname) UP TO 20 ROWS
INTO TABLE <t_itab>.
* Displaying dynamic internal table using Grid.
CREATE OBJECT w_grid
EXPORTING i_parent = cl_gui_container=>screen0.
CALL METHOD w_grid->set_table_for_first_display
EXPORTING
i_structure_name = w_tabname
CHANGING
it_outtab = <t_itab>.
CALL SCREEN 100.
* Scenario 2:
*Create a dynamic internal table with the specified number of columns.
* Creating Dynamic internal table
TYPE-POOLS: slis.
FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE, u201C Dynamic internal table name
<fs_dyntable>, u201C Field symbol to create work area
<fs_fldval> type any. u201C Field symbol to assign values
PARAMETERS: p_cols(5) TYPE c. u201C Input number of columns
DATA: t_newtable TYPE REF TO data,
t_newline TYPE REF TO data,
t_fldcat TYPE slis_t_fldcat_alv,
t_fldcat TYPE lvc_t_fcat,
wa_it_fldcat TYPE lvc_s_fcat,
wa_colno(2) TYPE n,
wa_flname(5) TYPE c.
* Create fields .
DO p_cols TIMES.
CLEAR wa_it_fldcat.
move sy-index to wa_colno.
concatenate 'COL'
wa_colno
into wa_flname.
wa_it_fldcat-fieldname = wa_flname.
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-intlen = 10.
APPEND wa_it_fldcat TO t_fldcat.
ENDDO.
* Create dynamic internal table and assign to FS
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fldcat
IMPORTING
ep_table = t_newtable.
ASSIGN t_newtable->* TO <t_dyntable>.
* Create dynamic work area and assign to FS
CREATE DATA t_newline LIKE LINE OF <t_dyntable>.
ASSIGN t_newline->* TO <fs_dyntable>.
*Populating Dynamic internal table
DATA: fieldname(20) TYPE c.
DATA: fieldvalue(10) TYPE c.
DATA: index(3) TYPE c.
DO p_cols TIMES.
index = sy-index.
MOVE sy-index TO wa_colno.
CONCATENATE 'COL'
wa_colno
INTO wa_flname.
* Set up fieldvalue
CONCATENATE 'VALUE' index INTO
fieldvalue.
CONDENSE fieldvalue NO-GAPS.
ASSIGN COMPONENT wa_flname
OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
<fs_fldval> = fieldvalue.
ENDDO.
* Append to the dynamic internal table
APPEND <fs_dyntable> TO <t_dyntable>.
* Displaying dynamic internal table using Grid.
DATA: wa_cat LIKE LINE OF fs_fldcat.
DO p_cols TIMES.
CLEAR wa_cat.
MOVE sy-index TO wa_colno.
CONCATENATE 'COL'
wa_colno
INTO wa_flname.
wa_cat-fieldname = wa_flname.
wa_cat-seltext_s = wa_flname.
wa_cat-outputlen = '10'.
APPEND wa_cat TO fs_fldcat.
ENDDO.
* Call ABAP List Viewer (ALV)
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
it_fieldcat = fs_fldcat
TABLES
t_outtab = <t_dyntable>.
Thanks,
Jyothi
Edited by: Jyothi on May 14, 2009 11:42 AM
Edited by: Jyothi on May 14, 2009 11:43 AM
Maybe you are looking for
-
Bug report: Time stamp misalignment in recent list
Bug report: With the new compact design, go to recent pivot, tap on a conversation, press back button to go back to recent, notice the time stamps to the right of the list have moved even more right, with text being cut off the screen. Using Lumia 10
-
Why can I only see today's history - i want to see previous history?
When i click on history tab; show all history and a window (Library) opens with History; Tags & Bookmarks but the only option to view under Histroy is Today. I want to view previous searches. I'm sure I previously could look up Last Week or Yesterday
-
Smart Form .... error in address output
whwn i m trying to print form its getting error like ....( error in address output)
-
Hello, I am trying to configure CCMS monitoring in Solution Manager. However I am unable to find any documents to guide me through the process. kindly help. Thanks.
-
Separate Data Plans for iPad and iPhone?
If you have both devices, do they each require their own data plan, or can the data usage be shared?