How to define an itab based from a structure inside a class
Hello Experts,
How can I define an internal table based from a structure that
is declared inside a class?I want to define it in the START-OF-SELECTION event.
I'll create a scenario below:
* CLASS lcl_main DEFINITION
CLASS lcl_main DEFINITION ABSTRACT.
PUBLIC SECTION.
TYPES: BEGIN OF t_vbak,
vbeln TYPE vbak-vbeln,
erdat TYPE vbak-erdat,
ernam TYPE vbak-ernam,
auart TYPE vbak-auart,
kunnr TYPE vbak-kunnr,
vkgrp TYPE vbak-vkgrp,
END OF t_vbak.
ENDCLASS. "lcl_main DEFINITION
START-OF-SELECTION.
*Here i want to define an internal table based from the structure T_VBAK.
Hope you could help me out here guys. Thank you and take care!
.
Similar Messages
-
How to create dynamic context based on a structure defined in the program?
Hi Experts,
I need to create a dynamic context based on a structure wa_struc which i have define programatically.
When I pass wa_struc to structure_name parameter of create_nodeinfo_from_struc, i get a runtime error:
"Parameter STRUCTURE_NAME contains an invalid value wa_struc."
How to create dynamic context based on a structure defined in the program?
I have written the code like this:
TYPES: BEGIN OF t_type,
v_carrid TYPE sflight-carrid,
v_connid TYPE sflight-connid,
END OF t_type.
Data: i_struc type table of t_type,
wa_struc type t_type.
data: dyn_node type ref to if_wd_context_node.
data: rootnode_info type ref to if_wd_context_node_info.
rootnode_info = wd_context->get_node_info( ).
clear i_struc. refresh i_struc.
select carrid connid into corresponding fields of table i_struc from sflight where carrid = 'AA'.
cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
parent_info = rootnode_info
node_name = 'dynflight'
structure_name = 'wa_struc'
is_multiple = abap_true ).
dyn_node = wd_context->get_child_node( name = 'dynflight' ).
dyn_node->bind_table( i_struc ).
Thanks
Gopal
Message was edited by: gopalkrishna baligaHi Michelle,
First of all Special thanks for your informative answers to my other forum questions. I really appreciate your help.
Coming back to this question I am still waiting for an answer. Please help. Note that my structure is not in a dictionary.
I am trying to create a new node. That is
CONTEXT
- DYNFLIGHT
CARRID
CONNID
As you see above I am trying to create 'DYNFLIGHT' along with the 2 attributes which are inside this node. The structure of the node that is, no.of attributes may vary based on some condition. Thats why I am trying to create a node dynamically.
Also I cannot define the structure in the ABAP dictionary because it changes based on condition
I have updated my code like the following and I am getting error:
TYPES: BEGIN OF t_type,
CARRID TYPE sflight-carrid,
CONNID TYPE sflight-connid,
END OF t_type.
Data: i_struc type table of t_type,
dyn_node type ref to if_wd_context_node,
rootnode_info type ref to if_wd_context_node_info,
i_node_att type wdr_context_attr_info_map,
wa_node_att type line of wdr_context_attr_info_map.
wa_node_att-name = 'CARRID'.
wa_node_att-TYPE_NAME = 'SFLIGHT-CARRID'.
insert wa_node_att into table i_node_att.
wa_node_att-name = 'CONNID'.
wa_node_att-TYPE_NAME = 'SFLIGHT-CONNID'.
insert wa_node_att into table i_node_att.
clear i_struc. refresh i_struc.
select carrid connid into corresponding fields of table i_struc from sflight where carrid = 'AA'.
rootnode_info = wd_context->get_node_info( ).
rootnode_info->add_new_child_node( name = 'DYNFLIGHT'
attributes = i_node_att
is_multiple = abap_true ).
dyn_node = wd_context->get_child_node( 'DYNFLIGHT' ).
dyn_node->bind_table( i_struc ).
l_ref_interfacecontroller->set_data( dyn_node ).
But now I am getting the following error :
The following error text was processed in the system PET : Line types of an internal table and a work area not compatible.
The error occurred on the application server FMSAP995_PET_02 and in the work process 0 .
The termination type was: RABAX_STATE
The ABAP call stack was:
Method: IF_WD_CONTEXT_NODE~GET_STATIC_ATTRIBUTES_TABLE of program CL_WDR_CONTEXT_NODE_VAL=======CP
Method: GET_REF_TO_TABLE of program CL_SALV_WD_DATA_TABLE=========CP
Method: EXECUTE of program CL_SALV_WD_SERVICE_MANAGER====CP
Method: APPLY_SERVICES of program CL_SALV_BS_RESULT_DATA_TABLE==CP
Method: REFRESH of program CL_SALV_BS_RESULT_DATA_TABLE==CP
Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE_DATA of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Method: IF_SALV_WD_COMP_TABLE_DATA~UPDATE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Method: IF_SALV_WD_VIEW~MODIFY of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Method: IF_SALV_WD_COMPONENT~VIEW_MODIFY of program CL_SALV_WD_A_COMPONENT========CP
-Gopal
Message was edited by: gopalkrishna baliga -
How to define primary interaction based on hierarchy level
I have a 3 level product dimension, such as brand, product type, and product. Now I want to define primary interaction based on the level. If click on brand or product type, it will be drill down. If click on product, it will be send master-detail. Since there is only one column for this dimension on the report when report is constructed, how can I apply different interaction based on the product level?
Thanksiif you are trying to do a normal hierarchical drill down from brand down to product type down to product, and if they are defined so in your database, defining a normal hierarchy is suffice.
iif you are trying to navigate to a different level in a hierarchy, do a pre-defined drill down.
all the above options must be defiend in RPD.
if your Q is not answered can you please elaborate further with the existing example.
-bifacts
http://www.obinotes.com -
How to define an itab including a field-symbols
*Please see below code, I define a field-symbols structure <wa>:
FIELD-SYMBOLS: <wa> TYPE ANY.
data: wa type ref to data.
create data wa type (p_table).
assign wa-> to <wa>.
My question is after <wa> get assigned, if I want to define a new internal table or structure which should include <wa>, like below:
data: begin of itab occurs 0.
include structure <wa>.
data: status type c.
data: end of itab.
But it doesn't work. How can I do that?
Thank you very much!Hi Yu,
Just check with this example, u will get a good idea.
PROGRAM ZMAIN.
DATA: BEGIN OF STR,
A VALUE 'a',
B VALUE 'b',
C VALUE 'c',
D VALUE 'd',
END OF STR,
CN(5) VALUE 'D'.
FIELD-SYMBOLS <FS> TYPE ANY.
DO 3 TIMES.
ASSIGN COMPONENT SY-INDEX OF
STRUCTURE STR TO <FS>.
IF SY-SUBRC <> 0. EXIT. ENDIF.
WRITE <FS>.
ENDDO.
ASSIGN COMPONENT CN OF STRUCTURE STR TO <FS>.
WRITE <FS>.
2.
TYPES: BEGIN OF comp,
f1 TYPE string,
f2 TYPE i,
END OF comp.
DATA: BEGIN OF stru,
k1 TYPE comp,
k2 TYPE comp,
k3 TYPE comp,
k4 TYPE comp,
END OF stru.
FIELD-SYMBOLS: TYPE comp.
ASSIGN stru-k1 TO RANGE stru.
DO 4 TIMES.
ASSIGN INCREMENT 1 TO .
ENDDO.
PROGRAM P1MAIN.
TABLES TRDIR.
DATA NAME(30) VALUE 'TFDIR-PNAME'.
FIELD-SYMBOLS <F> TYPE ANY.
MOVE 'XYZ_PROG' TO TRDIR-NAME.
PERFORM U IN PROGRAM P1SUB.
ASSIGN (NAME) TO <F>.
WRITE <F>.
CALL FUNCTION 'EXAMPLE'.
PROGRAM P1SUB.
TABLES TFDIR.
FORM U.
FIELD-SYMBOLS <F> TYPE ANY.
DATA NAME(30) VALUE 'TRDIR-NAME'.
ASSIGN TABLE FIELD (NAME) TO <F>.
WRITE <F>.
MOVE 'FCT_PROG' TO TFDIR-PNAME.
ENDFORM.
FUNCTION-POOL FUN1.
FUNCTION EXAMPLE.
DATA NAME(30) VALUE 'TRDIR-NAME'.
FIELD-SYMBOLS <F> TYPE ANY.
ASSIGN (NAME) TO <F>.
IF SY-SUBRC = 0.
WRITE <F>.
ELSE.
WRITE / 'TRDIR-NAME cannot be reached'.
ENDIF.
ENDFUNCTION.
PROGRAM P1MAIN.
TABLES TRDIR.
MOVE 'XYZ_PROG' TO TRDIR-NAME.
CALL FUNCTION 'EXAMPLE'.
FUNCTION-POOL FUN1.
FUNCTION EXAMPLE.
DATA NAME(30) VALUE 'TRDIR-NAME'.
FIELD-SYMBOLS <FS> TYPE ANY.
ASSIGN LOCAL COPY OF MAIN
TABLE FIELD (NAME) TO <FS>.
IF SY-SUBRC = 0.
WRITE <FS>.
ELSE.
WRITE / 'Cannot find TRDIR-NAME'.
ENDIF.
ENDFUNCTION.
Regards,
Kumar -
How to read user details based on org structure
hi,
i want to read which user is logon sap crm 7.0 based on org structure is there any functional module or bapi. how to find out which user is logon.
jemmi.Hi Jemmi,
Login user can be accessed by sy-uname directly. i think you are interested in finding bp's assigned to org unit of login user.
I am giving few details, check whichever is relevant for you.
To get the org unit of the login user ..
s_logon_orgunit = CL_CRM_AUI_SERVICE=>get_logon_orgunit_of_agent( ).
To get all the bp's under that org unit
move-corresponding ls_logon_orgunit to ls_orgunit.
CALL METHOD CL_CRM_AUI_SERVICE=>GET_BP_DATA_FROM_ORG_UNIT
EXPORTING
IV_ORGUNIT = ls_orgunit
RECEIVING
RV_HROBJBUPA = ls_bp.
Get all org units the user is assigned to as BP's
CALL FUNCTION 'RH_STRUC_GET'
EXPORTING
act_otype = 'US'
act_objid = sy-uname
act_wegid = gc_sms_wegid-org_4_usr
authority_check = ' '
IMPORTING
act_plvar = lv_plvar
TABLES
result_tab = lt_result_tab
EXCEPTIONS
no_plvar_found = 1
no_entry_found = 2
OTHERS = 3.
Cheers,
Sumit Mittal -
How to grab data with VBA from SAP Structure or Transaction
Hi,
my goal is to grab the data from the transaction cm01 and cm38 for reporting purposes with VBA in Microsoft Access automatically.
I'm yet able to download several tables with the RFC_READ_TABLE module, but since SAP only tells me that there is the structure RC65D behind the fields in cm01, I'm not able to use the RFC_READ_TABLE module for grabbing the data from cm01.
Does anyone know a way to grab the data from a structure like RC65D or from a transaction like cm01 with VBA?
Thanks in advance!
NicoDr
Edited by: NicoDr on Feb 17, 2012 5:14 PMHi Yang,
If you are using Web Service, then the binding will be done automatically.
It can't grow automatically, what else should i do to achieve this?
1.Select the table(make sure you are not selecting subform) in Hierarchy view
2. Under table select the Row which is having the required fileds for data
3. In the Binding of that row, check the checkbox "Repeat Row for each item data" and under that check the Min Count which will set the default row **** to 1
Regards,
Sachin -
How to print invoice (text based) from jspx/jsp ?
Hi All,
On our ADF Faces application , there is a requirement to print Invoice on a dot matrix printer from the application .
I can do that with Crystal XI but Java Report Component can only export to PDF or RTF, but the size of the report is too big for our narrow bandwidth.
So I am looking for a way to produced an Invoice to print in Text based. How can I do that ?
Thank you for your help,
xtantoHi,
Thank you.. I am downloading JasperReport & iReport now, two questions :
- Can JasperReport export to plain text file ?
- Is there any docs anywhere about JasperReport & JDeveloper integration ?
Thank you very much,
xtanto -
How to get RFQ number based from PO number...
Hello Experts,
How do I get the RFQ(request for quotation) based on a given PO(purchase order) number?
Thank you guys and take care!EKKO-EBELN = EKPO-EBELN
EKPO-ANFNR = RFQ Number.
Hope this helps.
Regards
Vinayak -
How to create a tree based on directory structure
I want to create a hierarchical tree in Forms 6i based upon a file system directory structure (similar to Windows Explorer). How can I populate a tree with this information, is there something that I can call or write that would return the file system structure in a format that I can populate my tree?
Any advice would be greatly appreciated.
Thanks
RichardYour link does not seem to work.They're re-jigging all the links to accomodate the hot poop on Oracle's latest and greatest, 10G. So at least the website is on schedule even if the actual software delivery dates have slipped :P
We can still get D2KWUTIL from here: http://te chnet.oracle.com/software/products/forms/content.html
Cheers, APC -
How to send 2 variable value from bash script into java.class
#!/bin/bash
a=10
b=20
echo $a $b | java addition
donehi there,
currently i have a simple java coding ( a + b ). and i m trying to connect with bash script but this bash script coudln't Enter 2nd value (b=20) while i running for it. may i know how do i can Enter 2 value into it?
output from terminal
[seng@localhost java_class]$ bash addition.sh
=======================================================================
simulation 1
Num_a = 10
Num_b = 20
Enter your Num_a : 10
Enter your Num_b : Exception in thread "main" java.lang.NumberFormatException
at java.lang.Integer.parseInt(java.lang.String, int, boolean) (/usr/lib/libgcj.so.6.0.0)
at java.lang.Integer.parseInt(java.lang.String) (/usr/lib/libgcj.so.6.0.0)
at filter_god.GOD(java.util.List, java.util.List, java.lang.String, java.lang.String, int) (Unknown Source)
at filter_god.main(java.lang.String[]) (Unknown Source)
at gnu.java.lang.MainThread.call_main() (/usr/lib/libgcj.so.6.0.0)
at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0)
=======================================================================That code will send both numbers on a single line in standard input to the java process. So if the process reads standard input, it will get a single line that has this in it: "10 20".
I'm guessing you're sending that whole line to Integer.parseInt. But a valid number doesn't have a space in the middle.
You should split up the line using String.split. Or use a StringTokenizer. Or a regular expression. Or you can use a java.util.Scanner. Or a java.io.StreamTokenizer. Or maybe some other stuff that has slipped my mind at the moment. -
How to generate sql script based on table structure
I want to generate a sql script based on a table structure.
For example:
if the table is:
cid id c_value
1 1 zz
2 1 yy
3 2 zz
4 2 xx
5 3 ss
6 3 tt
The expected output is:
WITH
CHILD_tab as (
SELECT 1 cid, 1 id,'zz' c_value from dual union all
SELECT 2 cid, 1 id,'yy' c_value from dual union all
SELECT 3 cid, 2 id,'zz' c_value from dual union all
SELECT 4 cid, 2 id,'xx' c_value from dual union all
SELECT 5 cid, 3 id,'ss' c_value from dual union all
SELECT 6 cid, 3 id,'tt' c_value from dual )
Release 11.1.0.7.0I'm doing a lot of XML these days (too much perhaps) so here's a solution involving XQuery.
We pass a query string and it outputs a CLOB containing the WITH clause :
SELECT DBMS_XMLGEN.Convert(
XMLQuery(
q'[concat(
"WITH t AS (
string-join(
for $i in /ROWSET/ROW
return concat( " SELECT ",
string-join($i/*/concat("'",ora:replace(text(),"'","''"),"' ",local-name()),", "),
" FROM dual" ),
" UNION ALL
passing dbms_xmlgen.getXMLType('SELECT * FROM scott.emp')
returning content
).getClobVal(), 1) AS WITH_CLAUSE
FROM dual;
WITH_CLAUSE
WITH t AS (
SELECT '7369' EMPNO, 'SMITH' ENAME, 'CLERK' JOB, '7902' MGR, '17/12/80' HIREDATE, '800' SAL, '20' DEPTNO FROM dual UNION ALL
SELECT '7499' EMPNO, 'ALLEN' ENAME, 'SALESMAN' JOB, '7698' MGR, '20/02/81' HIREDATE, '1600' SAL, '300' COMM, '30' DEPTNO FROM dual UNION ALL
SELECT '7521' EMPNO, 'WARD' ENAME, 'SALESMAN' JOB, '7698' MGR, '22/02/81' HIREDATE, '1250' SAL, '500' COMM, '30' DEPTNO FROM dual UNION ALL
SELECT '7566' EMPNO, 'JONES' ENAME, 'MANAGER' JOB, '7839' MGR, '02/04/81' HIREDATE, '2975' SAL, '20' DEPTNO FROM dual UNION ALL
SELECT '7654' EMPNO, 'MARTIN' ENAME, 'SALESMAN' JOB, '7698' MGR, '28/09/81' HIREDATE, '1250' SAL, '1400' COMM, '30' DEPTNO FROM dual UNION ALL
SELECT '7698' EMPNO, 'BLAKE' ENAME, 'MANAGER' JOB, '7839' MGR, '01/05/81' HIREDATE, '2850' SAL, '30' DEPTNO FROM dual UNION ALL
SELECT '7782' EMPNO, 'CLARK' ENAME, 'MANAGER' JOB, '7839' MGR, '09/06/81' HIREDATE, '2450' SAL, '10' DEPTNO FROM dual UNION ALL
SELECT '7788' EMPNO, 'SCOTT' ENAME, 'ANALYST' JOB, '7566' MGR, '19/04/87' HIREDATE, '3000' SAL, '20' DEPTNO FROM dual UNION ALL
SELECT '7839' EMPNO, 'KING' ENAME, 'PRESIDENT' JOB, '17/11/81' HIREDATE, '5000' SAL, '10' DEPTNO FROM dual UNION ALL
SELECT '7844' EMPNO, 'TURNER' ENAME, 'SALESMAN' JOB, '7698' MGR, '08/09/81' HIREDATE, '1500' SAL, '0' COMM, '30' DEPTNO FROM dual UNION ALL
SELECT '7876' EMPNO, 'ADAMS' ENAME, 'CLERK' JOB, '7788' MGR, '23/05/87' HIREDATE, '1100' SAL, '20' DEPTNO FROM dual UNION ALL
SELECT '7900' EMPNO, 'JAMES' ENAME, 'CLERK' JOB, '7698' MGR, '03/12/81' HIREDATE, '950' SAL, '30' DEPTNO FROM dual UNION ALL
SELECT '7902' EMPNO, 'FORD' ENAME, 'ANALYST' JOB, '7566' MGR, '03/12/81' HIREDATE, '3000' SAL, '20' DEPTNO FROM dual UNION ALL
SELECT '7934' EMPNO, 'MILLER' ENAME, 'CLERK' JOB, '7782' MGR, '23/01/82' HIREDATE, '1300' SAL, '10' DEPTNO FROM dual
)It may be useful for small data sets only because we quickly hit ORA-01706. -
How to config firewall if accessing from dmz to inside lan
Hi everyone,
Hope you can help on this.
We have a ASA with IOS 8.44. We just configured a dmz zone. Now we try to access a share of a windows server in INSIDE interface from another windows server in dmz, So on the server in DMZ, I will type \\INSIDE_Server\SharedName (or \\ip_of_inside server\SharedName) to access the share.
On the firewall, I open tcp port 137, 138, 139, and 445 to allow from DMZ to access to Inside server. But I failed. So what do I need to configure so that I can complete my task?
Also, we have some internal DNS in INSIDE interface. How do I make my DMZ server to use the inside DNS servers for dns resolution?
Hope you can help. Thank you!
Takami ChiroHi Jcarvaja,
Thank you very much. Finally I could run the command for the troubleshoot. And the following is the result:
esult of the command: "packet-tracer input dmz2 udp 172.20.0.49 1025 10.10.0.9 53"
Phase: 1
Type: ACCESS-LIST
Subtype:
Result: ALLOW
Config:
Implicit Rule
Additional Information:
MAC Access list
Phase: 2
Type: ROUTE-LOOKUP
Subtype: input
Result: ALLOW
Config:
Additional Information:
in 10.10.0.0 255.255.0.0 inside
Phase: 3
Type: ACCESS-LIST
Subtype: log
Result: DROP
Config:
access-group dmz2_acl in interface dmz2
access-list dmz2_acl extended deny ip any 10.0.0.0 255.0.0.0
Additional Information:
Result:
input-interface: dmz2
input-status: up
input-line-status: up
output-interface: inside
output-status: up
output-line-status: up
Action: drop
Drop-reason: (acl-drop) Flow is denied by configured rule
So to do so...does it mean I need to allow tcp 53 from dmz that server to inside the DNS server?
Thank you very much again... -
How to load a xml file from a package inside of a jar file
hi@all
my application has got a xml configuration file which is saved inside the package tree of the class that reads this file.
when i`m developing using eclipse the class can find that file, everything works fine. but when i create a jar file of my application to use it in another application it cannot find that file anymore.
can anyone tell me how to solve this problem, please?
thx a lot
dialschi all,
the xml file is in the jar file and
ClassLoader.getSystemResourceAsStream(..) solved my problem.
in fact i did nameOfClassInSamePackageAsXmlFile.class.getResourceAsStream("nameOfFile.xml");thank you all
greez
dialsc -
How to find out the tables from extract structures
Hi All,
As I know my data sources are 2lis_04_p_matnr,2lis_04_p_comp,2lis_04_p_arbpl.
How to find out the tables concerned with the fields in the extract structure.
ThanksPl check this link:
http://help.sap.com/saphelp_nw2004s/helpdata/en/29/79eb3cad744026e10000000a11405a/frameset.htm
OR navigate to: help.sap.com - netweaver - bi content - supply chain - look for your application area and the extractor and you will see the source tables and fields.
Ravi Thothadri -
How to pass a Connection variable from a servlet to a class?
Good day!
I have a class named ExecQuery for executing an sql query. This class accepts an sql statement and a Connection variable as its parameters. It has a method to return the resultset. Then, I also have a servlet that establishes the connection in the init method and instantiates the ExecQuery. The problem is that the Connection variable becomes null in the ExecQuery class that receives it. Why is this so? Please let me know why the Connection variable becomes null and the solution for this.
Your help would be very much appreciated. Thanks so much.Hi,
As such it cant become null. Make sure null value doesnt get passed to ExecQuery class.
Anyway, better idea would be getting Connection in ExecQeury class rather that Servlet.
Maybe you are looking for
-
OAS4.0.7, DB8.1.5 and Redhat 6.1
Has anyone succesfully installed Redhat 6.1 with Oracle 8.1.5 (8i) and OAS 4.0.7 on it? I tried but i stranded now that OAS seems installed. When i want to start the services it seems that the orb services don't want to start. From the GUI it mention
-
Windows 8.1 keeps crashing when trying to open movie or videos
Explorer.EXE 6.3.9600.17415 54503a3a mfmp4srcsnk.dll 12.0.9600.17415 54503c43 c0000094 00000000000aae7f 133c 01d01bd7558d78f4 C:\windows\Explorer.EXE C:\windows\System32\mfmp4srcsnk.dll aa127fcd-87ca-11e4-8264-3010b39e93b4
-
I have an Intel iMac (early 2006) running OSX 10.6.3 with 2Gb RAM. I attempted to install Finale Songwriter 2010 over the weekend and the installation failed. Now it appears that my MIDI server is unavailable. When I try to run MIDI Setup, after abou
-
I can not get some of the icons on the bulletin board to open such as the health monitor. Anyone know why?
-
Pavilion dv7 fingerprint reader not working
Hi. My HP Pavilion dv7 fingerprint reader isn't working. I have the SimplePass software that's powered by AuthenTec. When I open the SimplePass software, it doesn't seem like it knows I have a fingerprint reader. I've tried installing new drivers but