Overriding VO Impl class methods to populate parent-child VO
Hi All,
I need to populate parent child VOs by giving webservice calls from respective impl classes.
Scenario : Lets say suppose i have 2 VOs as DepartmentVO and Employee VO with a viewLink on departmentId. Taking a particular instance, in Department table there are 2 rows and for each parent row we have 2 child rows in Employee.
Webservice Structure : I have a parent Object and inside that parent object i have list of child objects
e.g : public class DepartmentDTO{
private List<EmployeeDTO> employeeList;
After that i have extended Impl classes for both VOs and overriden method i.e. "executeQueryForCollection" to give a webservice call and get back response of DepartmentDTO[] with List<EmployeeDTO> inside it.
In DepartmenntVOImpl class i have overriden "createRowFromResultSet" which populates the parent VO with the number of parent records returned from webservice.
Code for Department impl class is :
protected ViewRowImpl createRowFromResultSet(Object qc,
ResultSet resultSet) {
Iterator deptIter= getPackageClassIterator(qc);
ViewRowImpl r = createNewRowForCollection(qc);
DepartmentDTO curDTO = (DepartmentDTO )deptIter.next();
populateAttributeForRow(r,
findAttributeDef("DeptId").getIndex(),
curDTO.geDeptId() );
populateAttributeForRow(r,
findAttributeDef("DeptName").getIndex(),
curDTO.getDeptName() );
return r;
Similarly i have overridden "createRowFromResultSet" method in EmployeeVOImpl to populate the child VO(this need to be populated from the list object inside parent object reponse)
Code as follows :
protected ViewRowImpl createRowFromResultSet(Object qc,
ResultSet resultSet) {
Iterator empItr= getPackageClassIterator(qc);
ViewRowImpl r = createNewRowForCollection(qc);
DepartmentDTO curDTO1 = (DepartmentDTO )empItr.next();
List<EmployeeDTO> list = curDTO1.getEmployeesList();
for (EmployeeDTO curDTO : list) {
populateAttributeForRow(r,
findAttributeDef("EmpId").getIndex(),
curDTO.getEmpId());
populateAttributeForRow(r,
findAttributeDef("EmpName").getIndex(),
curDTO.getEmpName() );
populateAttributeForRow(r,
findAttributeDef("EmpLastName").getIndex(),
curDTO.getEmpLastName() );
populateAttributeForRow(r,
findAttributeDef("DeptId").getIndex(),
curDTO.getDeptId());
return r;
Though the code looks simple and correct but the child records are not getting populated correctly. Am not sure if the code implementation to populate parent child VOs from webservcie is correct or not.
Would appreciate for Help or valuable Suggestions.
-Sanjeeb
Hi Ray,
Go for custom BADIs in this case. In fact, that is exactly the functionality you are looking for !
Just go through this excellent five part blog on Enhancement framework by Thomas Weiss.
What the New Enhancement Framework Is For Its Basic Structure and Elements For Beginners
The new Enhancement Framework Part 2 - What Else You Need to Know Before Building an Enhancement
How To Define a New BAdI Within the Enhancement Framework - Part 3 of the Series
How to implement a BAdI And How to Use a Filter - Part 4 of the Series on the New Enhancement Framework
Source Code Enhancements - Part 5 of the Series on the New Enhancement Framework
Cheers,
Mahesh
Similar Messages
-
Script populate parent-child hierarchy not running
Hallo guys
I have problem when running script populate Parent-Child Relationship Table.
Here is the script.I don't even change the script.just run it in PL/SQL
declare
v_max_depth integer;
v_stmt varchar2(32000);
i integer;
begin
select max(level) into v_max_depth
from V_D_BRANCH
connect by prior BRANCH_KEY=PARENT_BRANCH_KEY
start with PARENT_BRANCH_KEY is null;
v_stmt := 'insert into DM_ANALYTICS.BRANCH_HIERARCHY (MEMBER_KEY, ANCESTOR_KEY, DISTANCE, IS_LEAF)
select BRANCH_KEY as member_key, null, null, 0 from V_D_BRANCH where PARENT_BRANCH_KEY is null
union all
select member_key,
replace(replace(ancestor_key,''\p'', ''|''), ''\'', ''\'') as ancestor_key,
case when depth is null then 0
else max(depth) over (partition by member_key) - depth + 1
end as distance, is_leaf
from
select member_key,depth,
case when depth is null then '' || member_key
when instr(hier_path, ''|'', 1, depth + 1) = 0 then null
else substr(hier_path, instr(hier_path, ''|'', 1, depth) + 1, instr(hier_path, ''|'', 1, depth + 1) - instr(hier_path, ''|'', 1, depth) - 1)
end ancestor_key,
is_leaf
from
( select BRANCH_KEY as member_key, PARENT_BRANCH_KEY as ancestor_key, sys_connect_by_path(replace(replace(BRANCH_KEY, ''\'', ''\''), ''|'', ''\p''), ''|'') as hier_path,
case when BRANCH_KEY in (select PARENT_BRANCH_KEY from V_D_BRANCH ) then 0 else 1 end as IS_LEAF
from V_D_BRANCH
connect by prior BRANCH_KEY = PARENT_BRANCH_KEY
start with PARENT_BRANCH_KEY is null
( select null as depth from dual;
for i in 1..v_max_depth - 1 loop
v_stmt := v_stmt || union all select '' || i || '' from dual;
end loop;
v_stmt := v_stmt || ) )
where ancestor_key is not null;
execute immediate v_stmt;
end;
but I got errors like following:
Error report -
ORA-06550: line 19, column 12:
PLS-00103: Encountered the symbol "insert into DM_ANALYTICS.BRANCH_HIERARCHY (MEMBER_KEY, ANCESTOR_" when expecting one of the following:
( - + case mod new not null <an identifier>
<a double-quoted delimited-identifier> <a bind variable>
continue avg count current exists max min prior sql stddev
sum variance execute forall merge time timestamp interval
date <a string literal with character set specification>
<a number> <a single-quoted SQL string> pipe
<an alternatively-quoted string
06550. 00000 - "line %s, column %s:\n%s"
*Cause: Usually a PL/SQL compilation error.
*Action:
what should I do guys?any idea,any solution would be appreciated.thanks alot guys956850 wrote:
hi,
i tried making "Dimension with Parent-Child Hierarchy" as described in your tutorials.
i finished with the admin tool and database changes and with no errors.
when trying to create a new answer, by only puting the hierarchy column in the answer.
the result show "no result" exist.
i am not sure what i am doing wrong. maybe you can point me to the problem?
thanks
Mirit.Hi Mirit,
What is the table that you created hierarchy on?
Which column in the hierarchy you pulled into your reports to see the No Result message?
Please query the table and see if has data.
Thanks,
G. SK -
Populate Parent/Child records with "Family" value
Hi,
I typically do the task I'm asking assistance with in Excel and it works great... the only problem is that it's VERY slow and takes a lot of work when over 1 million rows as you must split it up and yeah just painful! But what I'm trying to accomplish is
pretty straight forward for Excel, however escapes me in T-SQL! I have an ordered number that is sorted asc. I have a flag that indicates a record is the "Parent". I want to update the family value for the "Parent" and all sequential records
until the next "Parent" records is reached. So here is an example in Excel.
Using the following formula in cell C2 and pasting all the way to the last record, I can easily(for smaller sets anyway) create my desired results.
=IF(B2="Y",A2,C1)
Number Flag Family
1 Y 1
2 1
3 1
4 1
5 1
6 1
7 1
8 1
9 Y 9
10 9
11 Y 11
12 11
13 11
14 Y 14
15 14
16 14
17 14
18 14
19 14I have an article on this exact topic
Fixing
Missing Data Based on Prior Row Information
It shows the concept of using OUTER APPLY to achieve desired functionality.
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles
I wish I knew how to apply this OUTER APPLY solution to an update statement so I could use. Would this be more efficient and faster than the solution provided by RyanAB? I have millions of records and NOT enough time... the fastest solution is definitely desired!!!
I ended up using this as a solution as it was the fastest. I first did:
SELECT a.Number, M.Number 'Family' into FamilyTable FROM Table a
OUTER APPLY (
SELECT TOP (1) *
FROM Table b
WHERE a.Number >= b.Number and b.[Flag] = 'Y'
ORDER BY b.[Number] DESC) M
ORDER BY 1, 2
Then updated the original like so:
update a set a.Family = b.Family
FROM Table a inner join FamilyTable b
on a.Number = b.Number
Thanks to all!!! -
Overiding super class method to an abstract method
public class Super
public void doSomethingUseful()
public abstract class Sub extends Super
public abstract void doSomethingUseful();
What is the OO principle behind this?
When do we need to override a super class method in subclass as an abstract?Lets first look at a simple design pattern called "Template Method".
public abstract class Library
private void collectBooks()
// collect books here
private void putBookInShelf()
// put books in shelf here
// abstract method sortBooks()
public abstract void sortBooks();
public void processBooks()
collectBooks();
sortBooks();
putBooksInShelf();
this class is an abstract class giving an abstract method called "sortBooks()", what is it useful for? We can make a subclass and implement sortBooks() to sort the books as we want (title wise, author wise, date wise, publisher wise) and then simply call processBooks() to process them.
One Sub class may look like:
public class MyLibrary extends Library
public void sortBooks()
// sort books by title b/c I like them sorted out by title
Another sub-class may look like
public class HisLibrary extends Library
public void sortBooks()
// sort books by Author, b/c he likes his books sorted out by author
Now client will say:
public static void main(String str[])
MyLibrary mylib=new MyLibrary();
mylib.processBooks(); // books will be processed by sorting them title wise
HisLibrary hislib=new HisLibrary();
hislib.processBooks(); // books will be processed by sorting them author wise
So in Library class, method "sortBooks()" was a template method allowing subclasses to sort the books as they want while all other functionality was implemented by Library class itself.
Now if we go back to your example, a method which is concrete in super class that you converted into an abstract method in sub class ( doSomethingUseful() ) is now a template method, which alows the sub classes of this subclass to do something useful what they think is useful or in other words you are allowing subclasses of this subclass to implement this template method as they want by using their own algorithm.
Now why whould you do that? answer is that you don't have access to the code of super class, otherwise you must have made this method abstract in super class in the first place.
Note that the code may not compile, I tried to come up with an exmple and did not pay attention to compiler demands.
I think I cleared my point, It was tough to explain though.
Good Luck.
Khawar. -
Loading to Parent -Child Tables simultaneously
I have a requirement to populate parent-child tables in a single interface simultaneoulsy. I couldnt find anyway to add multiple targets and am wondering why this key feature is absent in ODI. The same thing is easily achievable in BPEL.
Could some one please advice a work around for this.
Your help is much appreaciatedODI 11g does come with a new IKM 'IKM Oracle Multi Table Insert'. This does allow multi table inserts, but will require more than one interface.
Oracle Multi-Table Inserts
A new Integration KM for Oracle allows populating several target tables from a single source, reading the data only once. It uses the INSERT ALL statement.
COMPONENT NAME: IKM Oracle Multi Table Insert
COMPONENT VERSION: 11.1.2.4
AUTHOR: Oracle
COMPATIBILITY: ODI 11.1.1.3 and above
DESCRIPTION:
- Integrates data from one source into one to many Oracle target tables in append mode, using a multi-table insert statement (MTI).
REQUIREMENTS:
- Oracle Database 9iR1 or above
- See BASIC CONFIGURATION section
BASIC CONFIGURATION
- This IKM must be used in integration interfaces that are sequenced in a Package:
- The first interface of the Package must have a temporary target and the KM option DEFINE_QUERY set to YES.
This first interface defines the structure of the SELECT clause of the multi-table insert statement (that is the source flow).
- Subsequent integration interfaces must source from this temporary datastore and have the KM option IS_TARGET_TABLE set to YES.
- The last interface of the Package must have the KM option EXECUTE set to YES in order to run the multi-table insert statement.
- Do not set "Use Temporary Interface as Derived Table(Sub-Select)" set to true on any of the interfaces.
- If large amounts of data are appended, consider to set the KM option OPTIMIZER_HINT to /*+ APPEND */.
OPTIONS (Refer to the Option descriptions for more information on each option)
- DEFINE_QUERY: Set to Yes if this interface describes the source query (SELECT clause of the statement). This interface must have a temporary target.
- IS_TARGET_TABLE: Set to Yes this interface using the source query to load one of the target tables. This interface must source from an interface with a temporary target using this IKM and having the KM option DEFINE_QUERY set to YES.
- EXECUTE: Set to Yes for the last interface in the Package. This interface will run the multi-table insert statement.
- COMMIT: Commit transaction. This applies only to the last interface in the Package.
- TRUNCATE: Set to Yes to truncate this interface target table.
- CREATE_TARG_TABLE: Create target table? May only be used on target interfaces, but not on source interfaces (defining the source data).
- OPTIMIZER_HINT: Hint for the multi-table insert statement.
RESTRICTIONS:
- This KM can only be used in integration interfaces that are part of a Package.
- All source and target datastores need to reside on same data server.
- Journalized source data is not supported.
- Temporary indexes are not supported.
- Flow/static control is not supported.
- The TRUNCATE option cannot work, if the target table is referenced by another table (foreign key). -
How to call a method in IMPL class from one context node
Hi, I´ve been only study the posibility to access a method in the IMPL class from one context node class...CN## without using events, is there a way to call it ??? I don´t have it as requierement just learning thanks !.
Hi,
Try this by following this you can get the custom controller instacne in the view context nodes, for your requirement you can keep the view implementation class instance instead of cuco..
To get the custom controller instance in Context node getter/setter method:
1. Declare Cuco instance reference variable in ctxt class..
2. Set this cuco ref. in the Create context node method of ctxt class:
try.
gr_cucoadminh ?= owner->get_custom_controller( 'ICCMP_BTSHEAD/cucoadminh' ). "#EC NOTEXT
catch cx_root.
endtry.
you can avoid this step as this is not needed in case of view isntance
3. Assign this instance to the respective context node Create method using:
BTStatusH->gr_cuco ?= gr_cucoadminh. " here assign the view implementation ref. " me" instead of gr_cucoadminh
Here gr_cuco is the ref. variable of custom controller in the respective context node for eg. BtstatusH
Sample implementation of this can be found in
ICCMP_BTSHEAD/BTSHeader ->context node BTACTIVITYH-> attr ->GR_CUCO(instance of cuco)
Cheers,
Sumit Mittal -
Need to Call the Parent Class Method
Hi..
Please go thru the following code.
class Parent {
Parent() {
System.out.println("In Parent Constructor");
void set() {
System.out.println("In Parent set method");
class Child extends Parent {
Child() {
System.out.println("In Child Constructor");
void set() {
super.set();
System.out.println("In Child set method");
class SetTrial {
public static void main(String args[])
Child aChild = new Child();
Parent theImpl = (Parent)aChild;
theImpl.set();
I want to know, is there any way by which we can get the Parent Set method to be executed, when we invoke it in main.
In the main, I should be able to decide which Set to invoke based on certain conditions.
TIA..
Basu.Since you seem to have an aversion to using the child class decide whether to call just the parent's set function, I think I would do it like this:
class Parent{
Parent() {
System.out.println("In Parent Constructor\n");
void set(ConditionClass C) {
System.out.println ("In Parent set method\n");
class Child extends Parent {
Child() {
System.out.println("In Child Constructor");
void set(ConditionClass C) {
super.set();
if (C.CallChildSet()) {
System.out.println("In Child set method");
class SetTrial {
public static void main(String args[])
Child aChild = new Child();
Parent theImpl = (Parent)aChild;
ConditionClass C = new ConditionClass()
theImpl.set(C);
}In any case I would decide in the child's set to call the parent's set or not. -
Accessing Managed Bean Variables in Entity Impl Class
How can I access managed bean variables in the entity Impl class .
While inserting a new record in DB , i want to set few entity properties values . The values of those properties are available in the managed bean .
How can i access those values from Managed Bean and set them the entity Impl class to override the create method.
Or is there any better recommended approaches ?
Jdev - 11.1.1.5>
While inserting a new record in DB , i want to set few entity properties values .
>
you can user CreateWithparams
http://www.oracle.com/technetwork/developer-tools/adf/learnmore/13-create-with-params-169140.pdf
http://andrejusb.blogspot.com/2011/02/createwithparams-operation-for-oracle.html -
How to call a custom method in a parent container.
I have an MXML component that defines the method:
public function showAllGlyphs(spots:Array):void { ... }
There is a child component of this MXML componet called
DataClip, which has
a method that needs to call the parent method:
parent.showAllGlyphs(pushPins);
I get a 1061 error when compiling. I understand the problem.
The compiler
thinks the paret is a static class, and does not know about
the extention.
My question is how to I cast or otherwise reference this
method in the
PARENT?
Severity Description Resource In Folder Location Creation
Time Id
2 1061: Call to a possibly undefined method showAllGlyphs
through a
reference with static type
flash.display:DisplayObjectContainer.
DataClip.mxml Transitions line 32 August 21, 2006 3:07:28 PM
169I understand why what you say is the correct design pattern
(much more
modularity and the potential for re-use).
In my case, it still might make sense to use .parentDocument
(my problem was
not understanding the difference between .parent and
.parentDocument)
Although I still don't understand why .parentDocument does
work.
I have a bunch of purely GUI oriented subComponents of a
.parentApplication.
The parentApplication has a custom AS-only module that does
the "business
logic, network connections, etc).
Basically, I want a module (Singleton Class) that is
accessible from all GUI
subcomponents that provides general utility functions. It
can't be
instatiatiated multiple times. So there needs to be one
global place for it.
It does not really make things clear if everything is done
via an event
paradigm. (Well, maybe to me, but I have a Ph.D. in CS so I
am tainted) I
want this clear to the average programmer.
===============================
Dr. Yechezkal Gutfreund
Team ACE for Mobile Devices
===============================
"peterent" <[email protected]> wrote in
message
news:[email protected]...
> As a rule of thumb, a child should never call functions
in its parent. It
> is
> possible, it just not a very good programming practice.
> If a child needs the parent to do something, the child
should dispatch an
> event. In your child, declare an event using Metadata:
>
> <mx:Metadata>
> [Event("showGlyphs")]
> </mx:Metadata>
>
> The child should have a public property that the parent
can access to
> handle
> the event:
>
> public var pushPins:Array;
>
> When the child needs the parent to do this, have the
child set the
> pushPins
> array, then dispatchEvent( new Event("showGlyphs") );
>
> In the parent, on the child's tag, have it listen for
the event and
> execute it:
>
> <MyChild
showGlyphs="showAllGlyphs(event.target.pushPins)" />
>
> I know this seems like a lot more work, but it is a much
better strategy
> than
> having children reach up and into the parent's code.
> -
Class method for XI data into R/3????
Hi Experts,
I have a very big problem..please help me!!!!
We need to create a program that will call data from XI interface and populate the internal table in R/3?
Can any1 of u give me the steps to go forward with it?
I read some documents and found that we need to use Class METHOD.. but I am new to OOPS and dont know anything in it.
Its about server proxies I guess!!!
I need to finish this in 1 day...
Please help.. answers will be rewarded with points...Hi, Thanks for the reply. I cannot use IDOC.
I have data in XI interface in form of XML data and i want to populate internal table in R/3 with this XML data(From XI).
If anybody can give me the steps to do the same, it will be very helpful.
my mail id is [email protected]
please try to send me the steps with an example... -
Problem in App Module Impl client method
Hope someone has an answer for this. I have a data action calling a client interface service method in the app module impl class. I am passing http request data wrapped in a Map to this method from the action class.
In this method I am calling another method in a bean. Strangely, the code in app module method gets executed twice, acting like a recursive call! I debugged it and noticed that my action class calls the method only once, but the call in the method to bean method is executed twice. I want to capture a database error for inserting a new row in my bean method the first time by throwing a jbo exception in app module method, but throw new exception is ignored and message gets lost due to 2nd excecution of the code.
Any ideas or help is much appreciated.
TIA,
SUser, please always tell us your jdev version.
What do you mean by 'verbatim EO'?
If you want to use the framework you should use it and not look for some hacks to archive your work. The docs help you to create or update data using the framework. If you don't want to use the framework, you don't have to, but then your post is for an other forum.
Timo -
Calling Stored Procedure outside of ADF BC 'impl' classes
Hello
What is the best way to execute a Stored Procedure outside of the ADF BC 'impl' classes?
I have a java class that performs batch inserts (using view objects). I am looking for a way to call a Stored Proc from here (How can I get a handle to the getDBTransaction() or is there another way to call the createCallableStatement()?
Thanks for your help!Hi,
you should be able to get a reference to the AM via your view objects. getDBTransaction is a public method so you should be able to call it from your class.
You could also consider creating a method to call the stored procedure within your AM which you then expose and call from your java class via the AM's client interface. This would better encapsulate your business process.
Brenden -
Type for SENDER parameter in Class Method
Hi all,
I have an import parameter declared in a Class method .
in SE38 program i want to retrieve through export parameter .
But i am not able to figure how to defind the type of SENDER parameter . Please suggest if my perception is wrong or the point that i am missing here .
Regards,
Ry.Hi Vijay,
Thank you for your reply . the problem i am having is the functionlaity of this report is it displays three grids and when ever i double click on a grid it should identify the particluar grid . i have highlighted in bold where i am encountering the problem. i am enclosing the class details and the report source code. Please suggest after going through it . thanks in advance.
Class details that i have created :
the class has a method handle_double_event with event handler double_click of CL_GUI_ALV_GRID . i have defined this in the method section.
in public section section :
public section.
types GO_GRID1 type ref to CL_GUI_ALV_GRID .
class-methods HANDLE_DOUBLE_CLICK
for event DOUBLE_CLICK of CL_GUI_ALV_GRID
importing
ES_ROW_NO
E_COLUMN
E_ROW
SENDER .
in handle_double_event code :
DATA:
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid,
go_grid3 TYPE REF TO cl_gui_alv_grid.
DATA:
gt_knb1 TYPE STANDARD TABLE OF knb1,
gt_vbak TYPE STANDARD TABLE OF vbak,
gt_vbap TYPE STANDARD TABLE OF vbap.
define local data
DATA:
ls_knb1 TYPE knb1,
ls_vbak TYPE vbak,
ls_vbap TYPE vbap.
DATA: es_row_no type lvc_s_roid,
e_column type lvc_s_col,
e_row type lvc_s_row.
*CASE sender. - here when i double click on the first grid go_grid1 it should go inside the go_grid1 . but it is not entering .*
WHEN go_grid1.
READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row-index.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
IS_ROW_ID =
IS_COLUMN_ID =
is_row_no = es_row_no.
Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDERS' ).
WHEN go_grid2.
READ TABLE gt_vbak INTO ls_vbak INDEX e_row-index.
CHECK ( ls_vbak-vbeln IS NOT INITIAL ).
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
IS_ROW_ID =
IS_COLUMN_ID =
is_row_no = es_row_no.
Triggers PAI of the dynpro with the specified ok-code
CALL METHOD cl_gui_cfw=>set_new_ok_code( 'ORDER_DET' ).
WHEN go_grid3.
READ TABLE gt_vbap INTO ls_vbap INDEX e_row-index.
CHECK ( ls_vbap-matnr IS NOT INITIAL ).
SET PARAMETER ID 'MAT' FIELD ls_vbap-matnr.
CALL TRANSACTION 'MM02' AND SKIP FIRST SCREEN.
WHEN OTHERS.
RETURN.
ENDCASE.
endmethod.
Code for the Report that is accessing the class.
DATA:
gd_okcode TYPE ui_func,
go_docking TYPE REF TO cl_gui_docking_container,
go_splitter TYPE REF TO cl_gui_splitter_container,
go_splitter_2 TYPE REF TO cl_gui_splitter_container,
go_cell_top TYPE REF TO cl_gui_container,
go_cell_bottom TYPE REF TO cl_gui_container,
go_cell_left TYPE REF TO cl_gui_container,
go_cell_right TYPE REF TO cl_gui_container,
go_grid1 TYPE REF TO cl_gui_alv_grid,
go_grid2 TYPE REF TO cl_gui_alv_grid,
go_grid3 TYPE REF TO cl_gui_alv_grid,
list type ref to zcl_eventhandler,
es_row_no type lvc_s_roid,
e_column type lvc_s_col,
e_row type lvc_s_row,
sender(8) type c.
DATA:
gt_knb1 TYPE STANDARD TABLE OF knb1,
gt_vbak TYPE STANDARD TABLE OF vbak,
gt_vbap TYPE STANDARD TABLE OF vbap.
PARAMETERS : p_bukrs TYPE ekko-bukrs default '1000'.
START-OF-SELECTION.
create object list.
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = p_bukrs.
Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 50
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Create splitter container
CREATE OBJECT go_splitter
EXPORTING
parent = go_docking
rows = 1
columns = 1
NO_AUTODEF_PROGID_DYNNR =
NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 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.
Get cell container
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_cell_left.
container = go_cell_top.
CALL METHOD go_splitter->get_container
EXPORTING
row = 1
column = 2
RECEIVING
container = go_cell_right.
Create 2nd splitter container
CREATE OBJECT go_splitter_2
EXPORTING
parent = go_cell_left
parent = go_cell_top
rows = 2
columns = 1
NO_AUTODEF_PROGID_DYNNR =
NAME =
EXCEPTIONS
cntl_error = 1
cntl_system_error = 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.
Get cell container
CALL METHOD go_splitter_2->get_container
EXPORTING
row = 1
column = 1
RECEIVING
container = go_cell_top.
CALL METHOD go_splitter_2->get_container
EXPORTING
row = 2
column = 1
RECEIVING
container = go_cell_bottom.
Create ALV grids
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_cell_top
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid2
EXPORTING
i_parent = go_cell_bottom
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CREATE OBJECT go_grid3
EXPORTING
i_parent = go_cell_right
EXCEPTIONS
OTHERS = 5.
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 METHOD ZCL_EVENTHANDLER=>HANDLE_DOUBLE_CLICK
EXPORTING
ES_ROW_NO = ES_ROW_NO
E_COLUMN = E_COLUMN
E_ROW = E_ROW
SENDER.
Set event handler
SET HANDLER: list->handle_double_click FOR go_grid1.
SET HANDLER: list->handle_double_click FOR go_grid2.
SET HANDLER: list->handle_double_click FOR go_grid3.
Display data
CALL METHOD go_grid1->set_table_for_first_display
EXPORTING
i_structure_name = 'KNB1'
CHANGING
it_outtab = gt_knb1
EXCEPTIONS
OTHERS = 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.
REFRESH: gt_vbak.
CALL METHOD go_grid2->set_table_for_first_display
EXPORTING
i_structure_name = 'VBAK'
CHANGING
it_outtab = gt_vbak
EXCEPTIONS
OTHERS = 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.
REFRESH: gt_vbap.
CALL METHOD go_grid3->set_table_for_first_display
EXPORTING
i_structure_name = 'VBAP'
CHANGING
it_outtab = gt_vbap
EXCEPTIONS
OTHERS = 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.
Link the docking container to the target dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
CONTAINER =
EXCEPTIONS
OTHERS = 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.
NOTE: dynpro does not contain any elements
CALL SCREEN '0100'.
Flow logic of dynpro:
*PROCESS BEFORE OUTPUT.
MODULE STATUS_0100.
*PROCESS AFTER INPUT.
MODULE USER_COMMAND_0100.
END-OF-SELECTION.
*& Form CUSTOMER_SHOW_ORDERS
text
--> p1 text
<-- p2 text
FORM customer_show_orders .
define local data
DATA:
ld_row TYPE i,
ls_knb1 TYPE knb1.
CALL METHOD go_grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_knb1 INTO ls_knb1 INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT * FROM vbak INTO TABLE gt_vbak
WHERE kunnr = ls_knb1-kunnr.
REFRESH: gt_vbap.
ENDFORM. " CUSTOMER_SHOW_ORDERS
*& Form ORDER_SHOW_DETAILS
text
--> p1 text
<-- p2 text
FORM order_show_details .
define local data
DATA:
ld_row TYPE i,
ls_vbak TYPE vbak.
CALL METHOD go_grid1->get_current_cell
IMPORTING
e_row = ld_row.
READ TABLE gt_vbak INTO ls_vbak INDEX ld_row.
CHECK ( syst-subrc = 0 ).
SELECT * FROM vbap INTO TABLE gt_vbap
WHERE vbeln = ls_vbak-vbeln.
ENDFORM. " ORDER_SHOW_DETAILS
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'. " contains push button "ORDERS"
SET TITLEBAR 'xxx'.
Refresh display of detail ALV list
CALL METHOD go_grid2->refresh_table_display
EXPORTING
IS_STABLE =
I_SOFT_REFRESH =
EXCEPTIONS
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Refresh display of detail ALV list
CALL METHOD go_grid3->refresh_table_display
EXPORTING
IS_STABLE =
I_SOFT_REFRESH =
EXCEPTIONS
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
move sy-ucomm to gd_okcode.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
User has pushed button "Display Orders"
WHEN 'ORDERS'.
PERFORM customer_show_orders.
WHEN 'ORDERS_DET'.
PERFORM order_show_details.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
endmodule.
Regards,
Ry -
Hi Experts,
Please see the following requirement in Classes & Methods, which I have to develop.I need this logic , Please send me the logic based up on old logic which i had given below.
The following needs to be created once, after which, the call to the method should be inserted in all related outputs.
I have to create this Method: IS_SEQUENCE_NOT_TO_PRINT.
This must be a value method in class ZCL_CONFIGURABLE_ITEM, passing document number VBDKR-VBELN that returns a parameter value: X = True, Blank = false.
This is the example method which they had given me to see it and do the same to that method with suitable changes,
[See e.g. method IS_GENOSYS_ITEM below from class ZCL_CONFIGURABLE_ITEM.
For this e.g. Method logic is defined.
**(METHOD is_genosys_item.
STATICS: l_gen_cats TYPE z_pstyv_tt.
DATA: l_gen_cat_line TYPE zpstyv_line.
IF l_gen_cats[] IS INITIAL.
CALL METHOD zcl_configurable_item=>get_gen_valid_item_cats
IMPORTING
itemcats_range_all_out = l_gen_cats
EXCEPTIONS
no_item_categories_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
is_genosys_item = space.
RETURN.
ENDIF.
ENDIF.
IF item_cat_in IN l_gen_cats
AND NOT l_gen_cats[] IS INITIAL.
is_genosys_item = c_checked.
ELSE.
is_genosys_item = space.
ENDIF.
ENDMETHOD.)**]
For our Method IS_SEQUENCE_NOT_TO_PRINT
,we have to Include the following logic :
GET BILLTO_PARTNER customer number for the document (reading VBPA where VBELN = document number VBDKR-VBELN and partner PARVW = RE / BP)
Read table KNA1 to get field KNA1-KATR6 where KUNNR equals Bill to partner, and fields VBDKR-VKORG, VBDKR-VTWEG, VBDKR-SPART,
Store first character of field KNA1-KATR6 in a work field e.g. W_ KATR6.
Add the entry below to the ZLITERAL table in all clients
Read the records from ZLITERAL table (reading key1 = C_ZLIT_GENOSYS_KEY, and key2 = C_KATR6_1) where C_KATR6_1 = attribute on class, with value = KATR6_1 . You must add this attribute on the class. Populate the internal table L_ZLITERAL_TAB type ZLITERAL_TAB_TYPE.
See e.g. in method GET_GEN_VALID_PRICE_CONDS of class ZCL_CONFIGURABLE_ITEM
[**(Method GET_GEN_VALID_PRICE_CONDS.
data: l_zliteral_tab type ZLITERAL_TAB_TYPE,
l_zliteral type zliteral,
l_kscha type zkscha_line.
select *
from zliteral
into table l_zliteral_tab
where zkey1 = zliteral_key1_in
and zkey2 = zliteral_key2_in.
if sy-subrc = 0.
loop at l_zliteral_tab into l_zliteral.
clear l_kscha.
l_kscha-sign = l_zliteral-zvalue1.
l_kscha-option = l_zliteral-zvalue2.
l_kscha-low = l_zliteral-zvalue3.
append l_kscha to condtype_range_out.
endloop.
else.
raise no_pricing_conds_found.
endif.
endmethod.)**]
Declare a range R_KATR6_1 in the program and load range from internal table L_ZLITERAL_TAB.
Check if stored field W_ KATR6 (i.e. first character of KNA1-KATR6) is in the range not to print R_KATR6_1.
If the value in the stored field is in the range not to print R_KATR6_1, set the returning parameter to X using attribute c_checked. If not, it means that the sequence should be printed. So the value method should return the value initial.
In the print program, call the value method once while processing the header section and store the value in a work field. This field can be used later when processing each item. It is not necessary to call the method for each item. Once is fine, as the data is at header level.
How to call the value method:
W_NO_SEQUENCE_PRINT = zcl_configurable_item=> IS_SEQUENCE_NOT_TO_PRINT (VBDKR).
Add IF STATEMENT as seen below:
IF W_NO_SEQUENCE_PRINT IS INITIAL.
IF wgen-bulk_item <> 'X'.
IF wgen-prfid = c_oligo.
PERFORM write_oligo_sequence.
ELSEIF wgen-prfid CS c_peptide. "
PERFORM write_peptide_sequence.
ENDIF.
ENDIF.
ENDIF.Hi,
try the online tutorial, which you can access via the Documentation/Tutorials link on the left side. Work on the examples given there and read the explainations carefully - first, try to understand, what is said there, then look at the examples and think about that, what every statement does and why it is there. Next step - try to reproduce the given example by yourself - do not look in the code of this example and do not copy parts of it - try to do it really by yourself - this way, you will learn, what the methods, you use, are for.
greetings Marsian -
Can you override a public static method?
Can you override a public static method?
A static method belongs to a class, not to a particular object, because you can call them without having an object instantiated. Methods are over rided which are inherited from an object. Since Static methods (although inherited) are not bound to a particular object, are not overridden.
Though you have a method in the subclass with the same signatures but if you try to call super.____() you will get the error
non-static variable super cannot be referenced from a static context
Maybe you are looking for
-
Biege G3 won't boot with OS 9.2
I purchased a biege G3 MT with OS 8.6 on eBay. Unfortunately, the OS is in French. I upgraded that to OS 9.2 and now it won't boot. No chime and it stops after the first icon during startup. It won't boot with extensions off nor with the CD. I tried
-
A couple weeks back my Illustrator software became so slow that most of the time it would close if I just opened a document. I've tried uninstalling the program and reinstalling it. Which worked for a little while and then the same problem happened.
-
Combining two messages into one
Hello, I have a mapping issue, I have a business process in which I have to combine two messages into one. To do so, I have defined a message mapping in which there are two source message types, and one target message type. When testing the message m
-
I'm trying to modify the horizontally sliding panel to be side by side instead of top and bottom, I was able to make it work on firefox and safari, but it doesn't on internet explore, can somebody help me please.Thanks
-
Hi, I want the Folder Chooser in my jsp page. So that i can upload entire folder to the server threw with JSP page. <input type="file" .../> will gives only flexibility to select one file at a time. Please help me in this.