ABAP OO Event Problem
Hi,
I read the blog posted by Jocelyn Dart-<b><i>Raising ABAP OO Events for Workflow</i></b>...
<b>/people/jocelyn.dart/blog/2006/07/27/raising-abap-oo-events-for-workflow
When I tried the same using my own Class, I am getting some problem.
Well, I created my Class with two Attributes
1) <i>M_POR</i>(Persistent Object Reference Attribute)
2) <i>PERNR</i>(Employee Number)
And I created a Constructor with one parameter.
And I also coded the remaining standard methods as per that blog - <b><i>USING ABAP OO Methods in Workflow Tasks</i></b>.
Finally I activated my CLASS and each individual method.
I created one small report that raises ABAP OO Event as mentioned in the blog with the below mentioned code.
<i>report yworkflowtrigger_ooabap.
data : ls_ywftest1_key type p_pernr,
lv_objtype type sibftypeid,
lv_event type sibfevent,
lv_objkey type sibfinstid,
lr_event_parameters type ref to if_swf_ifs_parameter_container,
lv_param_name type swfdname,
lv_visit_date type datum.
lv_objtype = 'YWFTEST1'.
lv_event = 'STARTEVENT'.
Set up the LPOR Instance id
ls_ywftest1_key = '00000024'.
move ls_ywftest1_key to lv_objkey.
try.
call method cl_swf_evt_event=>raise
exporting
im_objcateg = cl_swf_evt_event=>mc_objcateg_cl
im_objtype = lv_objtype
im_event = lv_event
im_objkey = lv_objkey
IM_EVENT_CONTAINER =
catch cx_swf_evt_invalid_objtype .
catch cx_swf_evt_invalid_event .
endtry.</i>
I switched on my event trace and tried raising the Event. But event is not raised even after execution of this code. I checked the SY-SUBRC value at the ENDTRY, But this seems perfect(SY-SUBRC = 0).
Why is my event not getting triggered even after the execution of above code?
Is there anything which I have missed.
We are on <b>ECC 5.0</b>
Regards,
<i><b>Raja Sekhar</b></i>
I missed this tip in that blog.
"<i><b>Tip! Just as for Business Object events, the COMMIT WORK statement is crucial when raising a Workflow event - without this the event will not be raised.</b></i>"
Regards,
<i><b>Raja Sekhar</b></i>
Similar Messages
-
CLBUS1007.created event triggered by an ABAP OO event?
Hello gurus,
I have noticed, that when the customer master is created in ECC 5.0, the CLBUS1007.created event is triggered (SWEL). However; CLBUS1007 object does not exist in the BOR directory. It must be ABAP OO event than, right? If so, how can I find out the corresponding class? I wonder how I can make a binding, check object attributes etc.
By the way, BUS1007 is obsolete in BOR. Do you know if I should use some other BOR object for a Customer or create a sub-class of this ABAP class that I don't know yet?
Regards,
Michal
PS. I know there is very good blog by Jocelyn Dart about this topic (/people/jocelyn.dart/blog/2006/07/27/raising-abap-oo-events-for-workflow), but it does not solve my problem of relation between SWEL object type and ABAP class.Hi Michael,
If you look at the header of BOR object BUS1007 you'll notice the last time this was changed was back in 1999 - i.e. 4.6a. So that object has been dead for quite some time.
It's almost certainly just an obsolete piece of code that hasn't been cleaned up properly. I suspect what is happening is that it is mix and matching the object category CL with the business object BUS1007 (which of course is category BO).
Either that or its an obsolete configuration entry that's getting picked up.
If it's annoying you, you could try putting a session breakpoint on function module SWE_EVENT_CREATE to see if you can track the call that causing the problem, and then of course report it in (Low priority) to get it cleaned up.
If you are just looking for the correct object to use, suggest you report it in anyway as a query... I notice they haven't bothered to specify the new object type in the documentation but if you look at SAP note 719936 it mentions that the new object type is KNA1 - which definitely is in the BOR directory.
I haven't seen an ABAP OO version of KNA1 yet in any of the systems... HR seems to be doing a fair bit in ABAP OO though.
Hope that helps.
Regards,
Jocelyn -
Hi guys,
in my workflow i have an activity with an abap method. This method works like a dialog. This means, i get a workitem in the business-workplace which shows a webdynpro where a pdf is displayed and where i can choose whether i click on button1 or button2.
When i click on one button, an abap-class event will be created. This event has a container. My target is, to bring the user desicion back to the workflow via event.
When i start a new workflow with this event then it works fine. But i dont want 2 workflows. I need a solution with one workflow. So i use a fork in my workflow. In branch 1 i have the activity which displays the pdf and create the event. In the other branch i have a waiting step, which waits for the event and bring the user-desision from the event-container to my workflow-container.
That was my plan, but it dont works this way. I checked the event-trace and theres no receaiver entered for my event. So my workflow stoped at the wait-step (wait step is ready).
I read, the the workflow system is automatikly doing the type-linkage and the instance-linkage, but i found only the instance-linkage filled. Can it be, that the wait step is only working with BOR-Events?
Any ideas?Hi swangir,
i tryed this FW SAP_WAPI_WRITE_CONTAINER some days ago. I can use SAP_WAPI_READ_CONTAINER easylie but when i try to modify the container then i get an enqeue exception in the SAP_WAPI_WRITE_CONTAINER FM. I guess this came up, because i call the webdynpro from an activie-step in the workflow and not a dialog-step. So i guess the container is locked and i cant write. I also tried to unlock it with dequee_e_ .. FM i forgot the name. But it also didnt work.
Thats why i tryed to bring the user desision via event back to the workflow. And it works, as long i use 2 workflows, like i explained in my first post.
What do u mean with...
"Alternatively, you can bind back the class event container to workflow container by binding back from the dialogue step."
Andre -
InputField fire event problem in webDynpro
I have one validation or Fire Event problem with respect to Inputfield in web Dynpro.
I have one Input filed and created the context varible for that, then i mapped the context varible to the InputField, and i changed the context varible type as date.So , when i run the view , it will show the calender near to the text box to select the perticular date. On select of the perticular date. It will populate selected date in to the inputField.
On selection of the perticular date. Based on the date i want to generate the next 12 months date at runtime in different text boxes. But the only event available for the InputField is only "onEnter". This is not useful in my case, bcz on selection of the Date , the user may not use the Enter key. so , how can use the other events like onSelection or onChange events in the InputFields to reach my needs.
Any one give me the idea to solve this problem.
VijayHello Vishal,
You may also refer the sample code in the below link
<a href="http://sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/0c0dcacd-0401-0010-b4bd-a05a0b4d68c8">http://sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/0c0dcacd-0401-0010-b4bd-a05a0b4d68c8</a>
Regards,
Sudeep. -
Hello again, I have yet another event problem. When I try to use this code I get an error saying Abstract class actionPerformed is not implemented in non- abstract class TableWindow. I'm not quit sure how I'm supposed to implement it.
Here is what I believe to be the relevant code. addWindowListener works but addFocusListener returns the error.
// Table window
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
import javax.swing.*;
import javax.swing.event.*;
public class TableWindow extends Frame implements ActionListener
public TableWindow ()
Create Window
super ("Test Window");
setBackground (SystemColor.control);
setLocation (0, 0);
setLayout (new GridLayout (5, 5));
addWindowListener (new WindowAdapter ()
public void windowClosing (WindowEvent e)
try
if (Connected == true)
// Close the Statement
stmt.close ();
// Close the connection
con.close ();
catch (SQLException sqle)
dispose ();
System.exit (0);
tPane = new JTabbedPane ();
tPane.addChangeListener (new ChangeListener ()
public void stateChanged (ChangeEvent c)
//Status.setText ("Clicked");
tablePane = new JPanel ();
recordPane = new JPanel ();
recordPane.addFocusListener(new FocusListener()
public void focusGained(FocusEvent e)
Status.setText ("Clicked");
queryPane = new JPanel ();
TName1 = new TextField (25);
TName2 = new TextField (25);
TName3 = new TextField (25);
idField = new TextField (10);
idField2 = new TextField (10);
TitleField = new TextField (25);
TitleField2 = new TextField (25);
result = new TextArea ("Under Construction", 5, 30);
NewT = new Button ("New Table");
NewR = new Button ("New Record");
NewQ = new Button ("New Query");
NewT.addActionListener (this);
NewR.addActionListener (this);
NewQ.addActionListener (this);
TNameLabel1 = new Label ("Enter name of table here");
TNameLabel2 = new Label ("Enter name of table here");
TNameLabel3 = new Label ("Enter name of table here");
idLabel = new Label ("Enter movie ID here");
TitleLabel = new Label ("Enter title of Movie here");
TitleLabel2 = new Label ("Enter title of Movie here");
tablePane.add (TNameLabel1);
tablePane.add (TName1);
tablePane.add (NewT);
recordPane.add (TNameLabel2);
recordPane.add (TName2);
recordPane.add (idLabel);
recordPane.add (idField);
recordPane.add (TitleLabel);
recordPane.add (TitleField);
recordPane.add (NewR);
//recordPane.add (tableChoice);
queryPane.add (TNameLabel3);
queryPane.add (TName3);
queryPane.add (TitleLabel2);
queryPane.add (TitleField2);
queryPane.add (NewQ);
queryPane.add (result);
Status = new Label ("");
// make the window and add components to it
tPane.addTab ("Table", tablePane);
tPane.addTab ("Record", recordPane);
tPane.addTab ("Query", queryPane);
add (tPane, BorderLayout.CENTER);
add (Status, BorderLayout.SOUTH);
pack ();
setVisible (true);
public static void main (String args [])
ConnectToDatabase ("vdds");
TableWindow tw = new TableWindow ();
} -
ABAP interactive report problem
ABAP - Interactive Report problem.
In Interactive report when I double click to one field a window arises (here sy-lsind = 0) displaying some required info. And again after double clicking the appeared window another window will open (here sy-lsind = 1). from the 2nd window I can't go to the previous window.
If there is only one way to go to the previous window is to activate the RIGHT UPPER CROSS OPTION of the particular window, then please help me giving the code or idea about how to activate it. Thanks.Moderator message - Welcome to SCN
Cross posting is not allowed in these forums.
Please read [Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement], How to post code in SCN, and some things NOT to do... and [Asking Good Questions in the Forums to get Good Answers|/people/rob.burbank/blog/2010/05/12/asking-good-questions-in-the-forums-to-get-good-answers] before posting again.
Thread locked
Rob -
Hi All,
Could anybody send me a document for ABAP Object events.
And simple programs for Events.
My id - [email protected]
Thanks,
Ponraj.s.Hi,
Go thru this basic simple program with documentation which demonstrates how to handle events, for nodes in a tree using abap objects
REPORT YLIST_TREE MESSAGE-ID ZER_INFO.
CLASS LCL_EVT_HDLR DEFINITION DEFERRED. " definition is given later
CLASS CL_GUI_CFW DEFINITION LOAD. " global class to be loaded
DATA:G_EVENT(50), " to hold the event
G_NODE_KEY TYPE TV_NODEKEY, "holds the node key
G_ITEM_NAME TYPE TV_ITMNAME,
G_KEY TYPE TV_ITMNAME.
DATA:G_EVT_HDLR TYPE REF TO LCL_EVT_HDLR,
G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
G_TREE TYPE REF TO CL_GUI_LIST_TREE,
G_OK_CODE TYPE SY-UCOMM.
TYPES:ITEM_TABLE_TYPE LIKE STANDARD TABLE OF MTREEITM
WITH DEFAULT KEY.
CLASS lcl_evt_hdlr DEFINITION
CLASS LCL_EVT_HDLR DEFINITION.
PUBLIC SECTION.
METHODS:
*---- methods for action handling for nodes
NODE_DBL_CLK
FOR EVENT NODE_DOUBLE_CLICK
OF CL_GUI_LIST_TREE
IMPORTING NODE_KEY,
HANDLE_NODE_KEY_PRESS
FOR EVENT NODE_KEYPRESS
OF CL_GUI_LIST_TREE
IMPORTING NODE_KEY KEY,
*---- methods for action handling for Items
ITEM_DBL_CLK
FOR EVENT ITEM_DOUBLE_CLICK
OF CL_GUI_LIST_TREE
IMPORTING NODE_KEY ITEM_NAME,
HANDLE_ITEM_KEY_PRESS
FOR EVENT ITEM_KEYPRESS
OF CL_GUI_LIST_TREE
IMPORTING NODE_KEY ITEM_NAME KEY,
*---- Common methods for action handling
HANDLE_RIGHT_CLICK
FOR EVENT RIGHT_CLICK
OF CL_GUI_LIST_TREE,
HANDLE_EXPAND_NO_CHILDREN
FOR EVENT EXPAND_NO_CHILDREN
OF CL_GUI_LIST_TREE
IMPORTING NODE_KEY.
ENDCLASS. "lcl_evt_hdlr DEFINITION
CLASS lcl_evt_hdlr IMPLEMENTATION
CLASS LCL_EVT_HDLR IMPLEMENTATION.
METHOD NODE_DBL_CLK.
this method handles the node double click event of the tree control
and shows the key of the double clicked node in a dynpro field
G_EVENT = 'NODE_DOUBLE_CLICK'.
G_NODE_KEY = NODE_KEY.
G_ITEM_NAME = ' '.
ENDMETHOD. "node_dbl_clk
METHOD ITEM_DBL_CLK.
G_EVENT = 'ITEM_DOUBLE_CLICK'.
G_NODE_KEY = NODE_KEY.
G_ITEM_NAME = ITEM_NAME.
ENDMETHOD. "ITEM_DBL_CLK
METHOD HANDLE_NODE_KEY_PRESS.
G_EVENT = 'NODE_KEYPRESS'.
G_NODE_KEY = NODE_KEY.
G_ITEM_NAME = ' '.
G_KEY = KEY.
ENDMETHOD. "HANDLE_NODE_KEY_PRESS
METHOD HANDLE_ITEM_KEY_PRESS.
G_EVENT = 'ITEM_KEYPRESS'.
G_NODE_KEY = NODE_KEY.
G_ITEM_NAME = ITEM_NAME.
G_KEY = KEY.
ENDMETHOD. "HANDLE_ITEM_KEY_PRESS
METHOD HANDLE_RIGHT_CLICK.
G_EVENT = 'RIGHT_CLICK'.
ENDMETHOD. "handle_right_click
METHOD HANDLE_EXPAND_NO_CHILDREN.
G_EVENT = 'EXPAND_NO_CHILDREN'.
G_NODE_KEY = NODE_KEY.
ENDMETHOD. "handle_EXPAND_NO_CHILDREN
ENDCLASS. "lcl_evt_hdlr IMPLEMENTATION
*------ start-of-selection.
START-OF-SELECTION.
*data: G_EVT_HDLR TYPE REF TO LCL_EVT_HDLR.
CREATE OBJECT G_EVT_HDLR. "create an object for the class lcl_evt_hdlr
SET SCREEN 100.
MODULE pbo_100 OUTPUT
MODULE PBO_100 OUTPUT.
SET PF-STATUS 'BUT'.
IF G_TREE IS INITIAL.
the tree control has not yet been created
create a tree control and insert nodes into it.
PERFORM CREATE_AND_INIT_TREE.
ENDIF.
ENDMODULE. "pbo_100 OUTPUT
MODULE pai_100 INPUT
MODULE PAI_100 INPUT.
DATA:RETURN_CODE TYPE I.
CL_GUI_CFW=>DISPATCH must be called if events are registered
that trigger PAI
this method calls the event handler method of an event
CALL METHOD CL_GUI_CFW=>DISPATCH
IMPORTING
RETURN_CODE = RETURN_CODE.
IF RETURN_CODE <> CL_GUI_CFW=>RC_NOEVENT.
" a control event occured => exit PAI
CLEAR G_OK_CODE.
EXIT.
ENDIF.
*at user-command.
g_ok_code = sy-ucomm.
CASE G_OK_CODE.
WHEN 'BACK'. " Finish program
IF NOT G_CUSTOM_CONTAINER IS INITIAL.
" destroy tree container (detroys contained tree control, too)
CALL METHOD G_CUSTOM_CONTAINER->FREE
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CNTL_ERROR = 2.
IF SY-SUBRC <> 0.
MESSAGE A000.
ENDIF.
CLEAR G_CUSTOM_CONTAINER.
CLEAR G_TREE.
ENDIF.
LEAVE PROGRAM.
ENDCASE.
CAUTION: clear ok code!
CLEAR G_OK_CODE.
ENDMODULE. "pai_100 INPUT
*& Form create_and_init_tree
text
--> p1 text
<-- p2 text
FORM CREATE_AND_INIT_TREE .
DATA:NODE_TABLE TYPE TREEV_NTAB,
ITEM_TABLE TYPE ITEM_TABLE_TYPE,
EVENTS TYPE CNTL_SIMPLE_EVENTS,
EVENT TYPE CNTL_SIMPLE_EVENT.
create a container for the tree control.
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING
the container is linked to the custom control with the
name 'TREE_CONTAINER' on the dynpro
CONTAINER_NAME = 'TREE_CONTAINER'
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
CREATE_ERROR = 3
LIFETIME_ERROR = 4
LIFETIME_DYNPRO_DYNPRO_LINK = 5.
IF SY-SUBRC <> 0.
MESSAGE A000.
ENDIF.
create a list tree control
CREATE OBJECT G_TREE
EXPORTING
PARENT = G_CUSTOM_CONTAINER
NODE_SELECTION_MODE = CL_GUI_LIST_TREE=>NODE_SEL_MODE_SINGLE
ITEM_SELECTION = 'X'
WITH_HEADERS = ' '
EXCEPTIONS
CNTL_SYSTEM_ERROR = 1
CREATE_ERROR = 2
FAILED = 3
ILLEGAL_NODE_SELECTION_MODE = 4
LIFETIME_ERROR = 5.
IF SY-SUBRC <> 0.
MESSAGE A000.
ENDIF.
*------- KEY = enter
CALL METHOD G_TREE->ADD_KEY_STROKE
EXPORTING
KEY = CL_TREE_CONTROL_BASE=>KEY_ENTER
EXCEPTIONS
FAILED = 1
ILLEGAL_KEY = 2
CNTL_SYSTEM_ERROR = 3.
IF SY-SUBRC <> 0.
MESSAGE W006 WITH 'ADD_KEY_STROKE'.
ENDIF.
define the events which will be passed to the backend
node double click
EVENT-EVENTID = CL_GUI_LIST_TREE=>EVENTID_NODE_DOUBLE_CLICK.
EVENT-APPL_EVENT = 'X'.
APPEND EVENT TO EVENTS.
EVENT-EVENTID = CL_GUI_LIST_TREE=>EVENTID_ITEM_DOUBLE_CLICK.
EVENT-APPL_EVENT = 'X'.
APPEND EVENT TO EVENTS.
EVENT-EVENTID = CL_GUI_LIST_TREE=>EVENTID_NODE_KEYPRESS.
EVENT-APPL_EVENT = 'X'.
APPEND EVENT TO EVENTS.
EVENT-EVENTID = CL_GUI_LIST_TREE=>EVENTID_ITEM_KEYPRESS.
EVENT-APPL_EVENT = 'X'.
APPEND EVENT TO EVENTS.
EVENT-EVENTID = LCL_EVT_HDLR=>EVENT_RIGHT_CLICK.
EVENT-APPL_EVENT = 'X'.
APPEND EVENT TO EVENTS.
EVENT-EVENTID = CL_GUI_LIST_TREE=>EVENTID_EXPAND_NO_CHILDREN.
EVENT-APPL_EVENT = 'X'.
APPEND EVENT TO EVENTS.
*------ register the events
CALL METHOD G_TREE->SET_REGISTERED_EVENTS
EXPORTING
EVENTS = EVENTS
EXCEPTIONS
CNTL_ERROR = 1
CNTL_SYSTEM_ERROR = 2
ILLEGAL_EVENT_COMBINATION = 3.
IF SY-SUBRC <> 0.
MESSAGE A000.
ENDIF.
assign event handlers in the application class to each desired events
SET HANDLER G_EVT_HDLR->NODE_DBL_CLK FOR G_TREE.
SET HANDLER G_EVT_HDLR->ITEM_DBL_CLK FOR G_TREE.
SET HANDLER G_EVT_HDLR->HANDLE_NODE_KEY_PRESS FOR G_TREE.
SET HANDLER G_EVT_HDLR->HANDLE_ITEM_KEY_PRESS FOR G_TREE.
SET HANDLER G_EVT_HDLR->HANDLE_RIGHT_CLICK FOR G_TREE.
SET HANDLER G_EVT_HDLR->HANDLE_EXPAND_NO_CHILDREN FOR G_TREE.
add some nodes to the tree control
PERFORM BUILD_NODE_AND_ITEM_TABLE USING NODE_TABLE ITEM_TABLE.
CALL METHOD G_TREE->ADD_NODES_AND_ITEMS
EXPORTING
NODE_TABLE = NODE_TABLE
ITEM_TABLE = ITEM_TABLE
ITEM_TABLE_STRUCTURE_NAME = 'mtreeitm'
EXCEPTIONS
FAILED = 1
CNTL_SYSTEM_ERROR = 3
ERROR_IN_TABLES = 4
DP_ERROR = 5
TABLE_STRUCTURE_NAME_NOT_FOUND = 6.
IF SY-SUBRC <> 0.
MESSAGE A000.
ENDIF.
ENDFORM. " create_and_init_tree
*& Form build_node_and_item_table
text
-->P_NODE_TABLE text
-->P_ITEM_TABLE text
FORM BUILD_NODE_AND_ITEM_TABLE USING
NODE_TABLE TYPE TREEV_NTAB
ITEM_TABLE TYPE ITEM_TABLE_TYPE.
DATA:NODE TYPE TREEV_NODE,
ITEM TYPE MTREEITM.
build the node table
node with key 'root'.
CLEAR NODE.
NODE-NODE_KEY = 'Root'. " key of the node
CLEAR NODE-RELATKEY. " root node has no parent node
CLEAR NODE-RELATSHIP.
NODE-HIDDEN = ' '. " the node is visible
NODE-DISABLED = ' '. " selectable
NODE-ISFOLDER = 'X'. " a folder
CLEAR NODE-N_IMAGE. " folder-/ leaf symbol in state "closed"
"use default.
CLEAR NODE-EXP_IMAGE. " folder-/ leaf symbol in state "open"
"use default.
CLEAR NODE-EXPANDER. " the width of the item is adjusted to its "
" content (text)
APPEND NODE TO NODE_TABLE.
node with key 'child1'.
CLEAR NODE.
NODE-NODE_KEY = 'Child1'. "key of the node
NODE-RELATKEY = 'Root'.
NODE-RELATSHIP = CL_GUI_LIST_TREE=>RELAT_LAST_CHILD.
NODE-ISFOLDER = 'X'.
APPEND NODE TO NODE_TABLE.
node with key 'Subchild1' for child1.
CLEAR NODE.
NODE-NODE_KEY = 'SubChild1'.
NODE-RELATKEY = 'Child1'.
NODE-RELATSHIP = CL_GUI_LIST_TREE=>RELAT_LAST_CHILD.
NODE-ISFOLDER = 'X'.
APPEND NODE TO NODE_TABLE.
node with key 'subchild2' for child1.
CLEAR NODE.
NODE-NODE_KEY = 'SubChild2'.
NODE-RELATKEY = 'Child1'.
NODE-RELATSHIP = CL_GUI_LIST_TREE=>RELAT_LAST_CHILD.
APPEND NODE TO NODE_TABLE.
node with key 'subchild3' for child1.
CLEAR NODE.
NODE-NODE_KEY = 'SubChild3'.
NODE-RELATKEY = 'Child1'.
NODE-RELATSHIP = CL_GUI_LIST_TREE=>RELAT_LAST_CHILD.
APPEND NODE TO NODE_TABLE.
node with key 'child2'.
CLEAR NODE.
NODE-NODE_KEY = 'Child2'. "key of the node
NODE-RELATKEY = 'Root'.
NODE-RELATSHIP = CL_GUI_LIST_TREE=>RELAT_LAST_CHILD.
NODE-ISFOLDER = 'X'.
NODE-EXPANDER = 'X'. " The node is marked with a '+', although
" it has no children. When the user clicks on the
" + to open the node, the event expand_nc is
" fired. The programmerr can
" add the children of the
" node within the event handler of the expand_nc
" event (see callback handle_expand_nc).
APPEND NODE TO NODE_TABLE.
items of the nodes
item with key 'root'.
CLEAR ITEM.
ITEM-NODE_KEY = 'Root'.
ITEM-ITEM_NAME = '1'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT. " text item
ITEM-ALIGNMENT = CL_GUI_LIST_TREE=>ALIGN_AUTO. "the width of the item
"is adjusted to its content
ITEM-FONT = CL_GUI_LIST_TREE=>ITEM_FONT_PROP. "use proportional font
" for the item
ITEM-TEXT = 'object'.
APPEND ITEM TO ITEM_TABLE.
item with key 'child1'.
CLEAR ITEM.
ITEM-NODE_KEY = 'Child1'.
ITEM-ITEM_NAME = '11'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
ITEM-ALIGNMENT = CL_GUI_LIST_TREE=>ALIGN_AUTO.
ITEM-FONT = CL_GUI_LIST_TREE=>ITEM_FONT_PROP.
ITEM-TEXT = 'dynpros'.
APPEND ITEM TO ITEM_TABLE.
item with key 'child2'.
CLEAR ITEM.
ITEM-NODE_KEY = 'Child2'.
ITEM-ITEM_NAME = '12'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
ITEM-ALIGNMENT = CL_GUI_LIST_TREE=>ALIGN_AUTO.
ITEM-FONT = CL_GUI_LIST_TREE=>ITEM_FONT_PROP.
ITEM-TEXT = 'programme'.
APPEND ITEM TO ITEM_TABLE.
items of node with key 'Subchild1'.
CLEAR ITEM.
ITEM-NODE_KEY = 'SubChild1'.
ITEM-ITEM_NAME = '111'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
ITEM-LENGTH = 11.
ITEM-TEXT = 'include'.
APPEND ITEM TO ITEM_TABLE.
items of node with key 'SubChild2'.
CLEAR ITEM.
ITEM-NODE_KEY = 'SubChild2'.
ITEM-ITEM_NAME = '112'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
ITEM-LENGTH = 4. " the width of the item is 4 chars
ITEM-IGNOREIMAG = 'X'. " see documentation of structure treev_item
ITEM-USEBGCOLOR = 'X'.
ITEM-T_IMAGE = '@01@'.
APPEND ITEM TO ITEM_TABLE.
CLEAR ITEM.
ITEM-NODE_KEY = 'SubChild2'.
ITEM-ITEM_NAME = '113'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
ITEM-LENGTH = 4. " the width of the item is 4 chars
ITEM-USEBGCOLOR = 'X'.
ITEM-TEXT = '0100'.
APPEND ITEM TO ITEM_TABLE.
CLEAR ITEM.
ITEM-NODE_KEY = 'SubChild2'.
ITEM-ITEM_NAME = '114'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
ITEM-LENGTH = 11.
ITEM-USEBGCOLOR = 'X'.
ITEM-TEXT = ' mueller'.
APPEND ITEM TO ITEM_TABLE.
CLEAR ITEM.
ITEM-NODE_KEY = 'SubChild2'.
ITEM-ITEM_NAME = '115'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
ITEM-ALIGNMENT = CL_GUI_LIST_TREE=>ALIGN_AUTO.
ITEM-FONT = CL_GUI_LIST_TREE=>ITEM_FONT_PROP.
ITEM-TEXT = ' comment to dynpro 100'.
APPEND ITEM TO ITEM_TABLE.
items of node with key 'SubChild3'.
CLEAR ITEM.
ITEM-NODE_KEY = 'SubChild3'.
ITEM-ITEM_NAME = '121'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
ITEM-LENGTH = 20.
ITEM-IGNOREIMAG = 'X'.
ITEM-USEBGCOLOR = 'X'.
ITEM-T_IMAGE = '@02@'.
ITEM-TEXT = ' 0200 harryhirsch'.
APPEND ITEM TO ITEM_TABLE.
CLEAR ITEM.
ITEM-NODE_KEY = 'SubChild3'.
ITEM-ITEM_NAME = '122'.
ITEM-CLASS = CL_GUI_LIST_TREE=>ITEM_CLASS_TEXT.
ITEM-ALIGNMENT = CL_GUI_LIST_TREE=>ALIGN_AUTO.
ITEM-FONT = CL_GUI_LIST_TREE=>ITEM_FONT_PROP.
ITEM-TEXT = ' comment to dynpro 200'.
APPEND ITEM TO ITEM_TABLE.
ENDFORM. " build_node_and_item_table
also i have sent a material to ur id
I hope you will get a clear idea on events
Regards,
Sowjanya -
Example programs on abap object events?
Hi Experts,
I need some example programs on abap object events.
regards,
vijayHi,
go thru the below program. hope it could help you.
REPORT sapmz_hf_alv_grid .
Type pool for icons - used in the toolbar
TYPE-POOLS: icon.
TABLES: zsflight.
To allow the declaration of o_event_receiver before the
lcl_event_receiver class is defined, decale it as deferred in the
start of the program
CLASS lcl_event_receiver DEFINITION DEFERRED.
G L O B A L I N T E R N A L T A B L E S
*DATA: gi_sflight TYPE STANDARD TABLE OF sflight.
To include a traffic light and/or color a line the structure of the
table must include fields for the traffic light and/or the color
TYPES: BEGIN OF st_sflight.
INCLUDE STRUCTURE zsflight.
Field for traffic light
TYPES: traffic_light TYPE c.
Field for line color
types: line_color(4) type c.
TYPES: END OF st_sflight.
TYPES: tt_sflight TYPE STANDARD TABLE OF st_sflight.
DATA: gi_sflight TYPE tt_sflight.
G L O B A L D A T A
DATA: ok_code LIKE sy-ucomm,
Work area for internal table
g_wa_sflight TYPE st_sflight,
ALV control: Layout structure
gs_layout TYPE lvc_s_layo.
Declare reference variables to the ALV grid and the container
DATA:
go_grid TYPE REF TO cl_gui_alv_grid,
go_custom_container TYPE REF TO cl_gui_custom_container,
o_event_receiver TYPE REF TO lcl_event_receiver.
DATA:
Work area for screen 200
g_screen200 LIKE zsflight.
Data for storing information about selected rows in the grid
DATA:
Internal table
gi_index_rows TYPE lvc_t_row,
Information about 1 row
g_selected_row LIKE lvc_s_row.
C L A S S E S
CLASS lcl_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS:
handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
IMPORTING
e_object e_interactive,
handle_user_command FOR EVENT user_command OF cl_gui_alv_grid
IMPORTING e_ucomm.
ENDCLASS.
CLASS lcl_event_receiver IMPLEMENTATION
CLASS lcl_event_receiver IMPLEMENTATION.
METHOD handle_toolbar.
Event handler method for event toolbar.
CONSTANTS:
Constants for button type
c_button_normal TYPE i VALUE 0,
c_menu_and_default_button TYPE i VALUE 1,
c_menu TYPE i VALUE 2,
c_separator TYPE i VALUE 3,
c_radio_button TYPE i VALUE 4,
c_checkbox TYPE i VALUE 5,
c_menu_entry TYPE i VALUE 6.
DATA:
ls_toolbar TYPE stb_button.
Append seperator to the normal toolbar
CLEAR ls_toolbar.
MOVE c_separator TO ls_toolbar-butn_type..
APPEND ls_toolbar TO e_object->mt_toolbar.
Append a new button that to the toolbar. Use E_OBJECT of
event toolbar. E_OBJECT is of type CL_ALV_EVENT_TOOLBAR_SET.
This class has one attribute MT_TOOLBAR which is of table type
TTB_BUTTON. The structure is STB_BUTTON
CLEAR ls_toolbar.
MOVE 'CHANGE' TO ls_toolbar-function.
MOVE icon_change TO ls_toolbar-icon.
MOVE 'Change flight' TO ls_toolbar-quickinfo.
MOVE 'Change' TO ls_toolbar-text.
MOVE ' ' TO ls_toolbar-disabled.
APPEND ls_toolbar TO e_object->mt_toolbar.
ENDMETHOD.
METHOD handle_user_command.
Handle own functions defined in the toolbar
CASE e_ucomm.
WHEN 'CHANGE'.
PERFORM change_flight.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMETHOD.
ENDCLASS.
S T A R T - O F - S E L E C T I O N.
START-OF-SELECTION.
SET SCREEN '100'.
*& Module USER_COMMAND_0100 INPUT
MODULE user_command_0100 INPUT.
CASE ok_code.
WHEN 'EXIT'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module STATUS_0100 OUTPUT
MODULE status_0100 OUTPUT.
DATA:
For parameter IS_VARIANT that is sued to set up options for storing
the grid layout as a variant in method set_table_for_first_display
l_layout TYPE disvariant,
Utillity field
l_lines TYPE i.
After returning from screen 200 the line that was selected before
going to screen 200, should be selected again. The table gi_index_rows
was the output table from the GET_SELECTED_ROWS method in form
CHANGE_FLIGHT
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines > 0.
CALL METHOD go_grid->set_selected_rows
EXPORTING
it_index_rows = gi_index_rows.
CALL METHOD cl_gui_cfw=>flush.
REFRESH gi_index_rows.
ENDIF.
Read data and create objects
IF go_custom_container IS INITIAL.
Read data from datbase table
PERFORM get_data.
Create objects for container and ALV grid
CREATE OBJECT go_custom_container
EXPORTING container_name = 'ALV_CONTAINER'.
CREATE OBJECT go_grid
EXPORTING
i_parent = go_custom_container.
Create object for event_receiver class
and set handlers
CREATE OBJECT o_event_receiver.
SET HANDLER o_event_receiver->handle_user_command FOR go_grid.
SET HANDLER o_event_receiver->handle_toolbar FOR go_grid.
Layout (Variant) for ALV grid
l_layout-report = sy-repid. "Layout fo report
Setup the grid layout using a variable of structure lvc_s_layo
Set grid title
gs_layout-grid_title = 'Flights'.
Selection mode - Single row without buttons
(This is the default mode
gs_layout-sel_mode = 'B'.
Name of the exception field (Traffic light field) and the color
field + set the exception and color field of the table
gs_layout-excp_fname = 'TRAFFIC_LIGHT'.
gs_layout-info_fname = 'LINE_COLOR'.
LOOP AT gi_sflight INTO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
Value of traffic light field
g_wa_sflight-traffic_light = '1'.
Value of color field:
C = Color, 6=Color 1=Intesified on, 0: Inverse display off
g_wa_sflight-line_color = 'C610'.
ELSEIF g_wa_sflight-paymentsum => 100000 AND
g_wa_sflight-paymentsum < 1000000.
g_wa_sflight-traffic_light = '2'.
ELSE.
g_wa_sflight-traffic_light = '3'.
ENDIF.
MODIFY gi_sflight FROM g_wa_sflight.
ENDLOOP.
Grid setup for first display
CALL METHOD go_grid->set_table_for_first_display
EXPORTING i_structure_name = 'SFLIGHT'
is_variant = l_layout
i_save = 'A'
is_layout = gs_layout
CHANGING it_outtab = gi_sflight.
*-- End of grid setup -
Raise event toolbar to show the modified toolbar
CALL METHOD go_grid->set_toolbar_interactive.
Set focus to the grid. This is not necessary in this
example as there is only one control on the screen
CALL METHOD cl_gui_control=>set_focus EXPORTING control = go_grid.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0200 INPUT
MODULE user_command_0200 INPUT.
CASE ok_code.
WHEN 'EXIT200'.
LEAVE TO SCREEN 100.
WHEN'SAVE'.
PERFORM save_changes.
ENDCASE.
ENDMODULE. " USER_COMMAND_0200 INPUT
*& Form get_data
FORM get_data.
Read data from table SFLIGHT
SELECT *
FROM zsflight
INTO TABLE gi_sflight.
ENDFORM. " load_data_into_grid
*& Form change_flight
Reads the contents of the selected row in the grid, ans transfers
the data to screen 200, where it can be changed and saved.
FORM change_flight.
DATA:l_lines TYPE i.
REFRESH gi_index_rows.
CLEAR g_selected_row.
Read index of selected rows
CALL METHOD go_grid->get_selected_rows
IMPORTING
et_index_rows = gi_index_rows.
Check if any row are selected at all. If not
table gi_index_rows will be empty
DESCRIBE TABLE gi_index_rows LINES l_lines.
IF l_lines = 0.
CALL FUNCTION 'POPUP_TO_DISPLAY_TEXT'
EXPORTING
textline1 = 'You must choose a line'.
EXIT.
ENDIF.
Read indexes of selected rows. In this example only one
row can be selected as we are using gs_layout-sel_mode = 'B',
so it is only ncessary to read the first entry in
table gi_index_rows
LOOP AT gi_index_rows INTO g_selected_row.
IF sy-tabix = 1.
READ TABLE gi_sflight INDEX g_selected_row-index INTO g_wa_sflight.
ENDIF.
ENDLOOP.
Transfer data from the selected row to screenm 200 and show
screen 200
CLEAR g_screen200.
MOVE-CORRESPONDING g_wa_sflight TO g_screen200.
LEAVE TO SCREEN '200'.
ENDFORM. " change_flight
*& Form save_changes
Changes made in screen 200 are written to the datbase table
zsflight, and to the grid table gi_sflight, and the grid is
updated with method refresh_table_display to display the changes
FORM save_changes.
DATA: l_traffic_light TYPE c.
Update traffic light field
Update database table
MODIFY zsflight FROM g_screen200.
Update grid table , traffic light field and color field.
Note that it is necessary to use structure g_wa_sflight
for the update, as the screen structure does not have a
traffic light field
MOVE-CORRESPONDING g_screen200 TO g_wa_sflight.
IF g_wa_sflight-paymentsum < 100000.
g_wa_sflight-traffic_light = '1'.
C = Color, 6=Color 1=Intesified on, 0: Inverse display off
g_wa_sflight-line_color = 'C610'.
ELSEIF g_wa_sflight-paymentsum => 100000 AND
g_wa_sflight-paymentsum < 1000000.
g_wa_sflight-traffic_light = '2'.
clear g_wa_sflight-line_color.
ELSE.
g_wa_sflight-traffic_light = '3'.
clear g_wa_sflight-line_color.
ENDIF.
MODIFY gi_sflight INDEX g_selected_row-index FROM g_wa_sflight.
Refresh grid
CALL METHOD go_grid->refresh_table_display.
CALL METHOD cl_gui_cfw=>flush.
LEAVE TO SCREEN '100'.
ENDFORM. " save_changes
regards
-Rakesh -
Creation of an event : problem with the container
Hi Gurus,
I'm facing a problem in creation of an event.
I'm in SAP ECC 6.0 for a migration project from 4.6B
In an ABAP program I'm trying to create an event in order to launch a workflow.
1st step : Set datas in the container -> In INTERNAL_TABLE I have 5 lines.
swc_set_table event_container 'INTERNAL_TABLE' t_cnp_container.
2nd step : Create an event :
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
objtype = w_wf_objtype
objkey = w_wf_objkey
event = w_wf_event
creator = applicant
start_recfb_synchron = 'X'
TABLES
event_container = event_container
EXCEPTIONS
objtype_not_found = 1
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.
WRITE sy-subrc.
ENDIF.
Now when I check my container with SWI2_FREQ I see that INTERNAL_TABLE has just one ligne, the rest disapears.
I have this problem only when I set an internal table in an container
I don't know why, but it perfectly works on 4.6B.
Thanks a lot
WalidHi,
I dont see a point in having this statement
swc_set_table event_container 'INTERNAL_TABLE' t_cnp_container. Infact it is not needed !!
SWE_EVENT_CREATE like any other FM, take a
lt_var type standard table of SWCONT.
ls_var type SWCONT.
fill your ls_var with all fields and append it to lt_var each time and pass lt_var to event_table of SWE_EVENT_CREATE. It should work !!
However, suggested way is to use SAP_WAPI_CREATE_EVENT instead of SWE_EVENT_CREATE from ECC 5.0 onwards. There are fe concerns with SWE_EVENT_CREATE mainly with respect to commit and persistancy. Better we should use SAP_WAPI* as much as possible from ECC 5.0.
Try above and Good Luck !!
Regards
Krishna Mohan -
ABAP webdynpro events in Portal
Hi All,
I am a novice in Portal. I am not sure if this is the right forum also to ask this question.
I created an application in ABAP webdynpro , created an iview using the ABAP webdynpro option.
My scenario : I have to create a work request in a ztable that I have created.
For this 1) create a uniques number using number_get_next
2) insert the values into the z table and show message
what is happening -->
Application appears with no problems.
when I click on button message appears
What is not happening on the portal
number get next doesnot get created
data doesnot get inserted in ztable
portal and abap webdynpro are on different URL
I tried to subscribe events that also didnot work .:(
Appreciate all the help.
Regards,
NarayaniHi All,
solved as below.
Regards,
Narayani -
Events problem with (Java and ActiveX)
Hi,
I use an ActiveX component with Java and i've got a problem with events.
Java classes were generated with Bridge2Java (IBM).
In order to manage events I added a listener in my application :
javaMyActiveX = new MyActiveX();
javaMyActiveX.add_DMyActiveXEventsListener(new _DMyActiveXEventsAdapter());
I also added a constructor in the _DMyActiveXEventsAdapter class and I fill the body of methods.
The ActiveX generates two types of events :
- The ones are directly generated by methods.
- The others are generated by a thread.
With MS Products (VB, Visual C++, Visual J++), I catch all events.
With java (jdk 1.4), I catch only events generated by methods.
Can anyone help me.I'm not 100% sure, but the last time I used that bridge, it only worked if you ran your Java app within a Microsoft VM.
-
Help needed with Image Events problem
Hi there I'm writing what I thought was a simple script to convert a folder full of images from jpg to tiff. But the script fails when trying to convert the first image in the folder. Instead of converting the image, Preview opens with the image shown and I get this error message: error "The variable ImageRef is not defined." number -2753 from "ImageRef".
I have seen some posts about other people having the same problem, but I haven't seen any solutions.
Here's the script.
on run
tell application "Finder"
set PicturesFolder to ((path to home folder) as string) & "Pictures:SenseCam" as alias
set Photographs to (get entire contents of PicturesFolder) as alias list
end tell
tell application "Image Events"
launch
repeat with Photo in Photographs
if (Photo as string) ends with "jpg" then
set ImageRef to open Photo
save ImageRef in Photographs as TIFF
close ImageRef
end if
end repeat
end tell
tell application "Finder"
repeat with Photo in Photographs
delete Photo
end repeat
end tell
end run
Thanks in advance for any help.
JohnHello
You may try something like the modified code below.
Noticiable changes :
#1 - Removed the parentheses. Your original code won't yield alias list but a list of finder objects, which is the reason why Preview opens the image. (The statment 'open finderObject' behaves the same as double clicking it in Finder)
#2 - Only delete the original jpeg files which are converted to tiff.
#3 - Build new path for converted image.
#4 - Save in new path. (When saving image in a format other than its original format, always save the image to a new file and do not attempt to overwrite the source file.)
cf.
http://www.macosxautomation.com/applescript/imageevents/08.html
on run
tell application "Finder"
set PicturesFolder to (path to home folder as string) & "Pictures:SenseCam:" as alias
set Photographs to get entire contents of PicturesFolder as alias list -- #1
end tell
set DonePhotos to {} -- #2
tell application "Image Events"
launch
repeat with Photo in Photographs
set Photo to Photo's contents
set oldPath to Photo as string
if oldPath ends with ".jpg" then
set newPath to oldPath's text 1 thru -5 & ".tif" -- #3
set ImageRef to open Photo
save ImageRef as TIFF in newPath -- #4
close ImageRef
set end of DonePhotos to Photo -- #2
end if
end repeat
end tell
tell application "Finder"
delete DonePhotos -- #2
end tell
end run
Hope this may help,
H -
iCal on my iPad worked fine for a while. Now, many of my all day events (but not all of them) are showing up a day early on my iPad on week view. Everything is fine on all other devices (iPhone, MacBook) and all is fine on iPad on day, month and list view. All timed events are in the right place. But all day events in week view are a disaster and turning off the iPad isn't helping. Any advice?
Did you travel out of your home time zone and first notice the problem then? I spent an hour and a half on the phone with Apple Care while I was in the Central zone (I live in Eastern) and nothing the supervisor suggested worked (deleting the account, resetting, turning ipad off, etc). They'd bumped me up to a supervisor because the regular guy had no idea. Supervisor said no one on the internal tech board had seen that particular problem. The final assumption was it was a software glitch on my ipad--the advice was a complete restore which was going to have to wait until I returned home because he said it would take too long over the Verizon mi-fi I was using while traveling. Anyway--I got home to Eastern time, immediately pulled out the ipad to do the restore and all the all-day events were in the right place and have remained in the right place since then. My best guess is that it's a time zone issue but it doesn't make much sense. All my timed events stayed right where they were supposed to be the whole time (time zone support turned off).
-
Hi All,
My Screen consist of 3 Input/Output Field and a Radio button group which consist of 8 radio button.
Problem 1:
When select a radio button, 2 of the Input/Output Field data that was define previously was clear and 1 of the Input/Output Field data still remain.
Problem 2:
Data was enter in the 3 Input/Output Field. When i submit, the program will validate the 1st Input/Output Field. When it validate, the 2 of the Input/Output Field data was clear off.
How to prevent the data being clear off?
Code Sample:
==============================================================
Flow Logic
==============================================================
PROCESS BEFORE OUTPUT.
MODULE STATUS_9000.
PROCESS AFTER INPUT.
CHAIN.
FIELD:
TB_OBJECTID,
TB_LOADID,
TB_LOADDESC.
MODULE USER_COMMAND_9000.
ENDCHAIN.
==============================================================
==============================================================
ABAP Program
==============================================================
REPORT ZTEST_RADIOBTN.
DATA: TB_OBJECTID(20) TYPE c,
TB_OBJECTDESC(100) TYPE c,
RB_STEP1(1) TYPE c,
RB_STEP2(1) TYPE c,
RB_STEP3(1) TYPE c,
RB_STEP4(1) TYPE c,
RB_STEP5(1) TYPE c,
RB_STEP6(1) TYPE c,
RB_STEP7(1) TYPE c,
RB_STEP8(1) TYPE c.
START-OF-SELECTION.
CALL SCREEN 9000.
" Main Screen - PBO.
MODULE STATUS_9000 OUTPUT.
SET PF-STATUS 'MAIN_SCREEN'.
SET TITLEBAR 'MAIN_SCREEN'.
ENDMODULE.
" Main Screen - PAI.
MODULE USER_COMMAND_9000 INPUT.
CASE sy-ucomm.
WHEN 'EXIT'.
LEAVE PROGRAM.
WHEN 'BACK'.
Leave to SCREEN '0'.
WHEN 'EXECUTE'.
CASE TB_OBJECTID.
WHEN '1'.
TB_OBJECTDESC = '1'.
WHEN '2'.
TB_OBJECTDESC = '2'.
WHEN OTHERS.
TB_OBJECTDESC = 'Invalid Input'.
ENDCASE.
PERFORM validate_ObjectID.
ENDCASE.
ENDMODULE.
FORM validate_ObjectID.
IF TB_OBJECTID IS INITIAL.
SET CURSOR FIELD 'TB_OBJECTID'.
MESSAGE e000(ZSCSDM_MSG) WITH 'Please define Object ID'.
ENDIF.
ENDFORM.
Best Regards,
RaydenHi Ray,
The issue seems to be that there is no varaible decalred in your top include to hold the values of the screen variables.
Concept is that on any user actio like an 'Enter' etc causes the flow logic ( PBO & PAI ) to be executed. So during these first the system transfers the screen field values to the available variables ( Only if it finds any .. so declare variables in Top Include with same name.)
Later during PBO execution it transfers the values back from variables in Top include ( Local variables ) to the screen field.
<b>On User Action :
PAI Executed => Screen Values --> Local Var.
then
PBO Executed => Local Var --> Screen Values.
This is the flow concept.</b>
<i><b>Reward Points if useful .</b></i> -
This report will take delivery document number and delivery date from user and fetches details from delivery table and fetches
corresponding sales order details and billing details and displays sales order details with ALV list.
<< Please only post the relevant portions of your code >>
i just want to know that is this way of fetching the data into internal table okay ?are there any better ways of fetching the data into the internal table ? why is it looping in work area of lips, why not in likp?
(plz dont use field-symbols or oo abap or macros) I WANT TO USE PLAIN AND SIMPLE ABAP STATEMENTS LIKE ABOVE..
By using "vbeln type lips-vbeln" are we refering to the field or data element? plz suggest.
P.S. [my approach was to inner join likp and lips into itab(my internal table).
select data from kna1, vbak,vbap,vbrp into respective internal tables like it_kna1,it_vbak etc.
then using individual loops into the tables, i would use read table to insert data into itab(my final internal table) plz suggest which method wud be more efficient? ]
Edited by: Rob Burbank on Jun 8, 2009 11:54 AMok i am posting the select queries once again.
i want to know why are we looping in t_lips and why not t_likp? bcoz tlikp is the header table, if we loop thru it and then read the rest tables then what will be the problem? plz clarify with examples._
[my idea was to loop at t_likp then read t_lips.append the lips data into t_order(main internal table).then do read table on t_kna1,t_vbap etc indexing t_order. so plz suggest whether my approach was write or wrong?if wrong why?plz site any other ways of doing this query.
types: begin of ty_vbap,
vbeln type vbap-vbeln,
posnr type vbap-posnr, .....
does the declaration statement in types refer to tables or data elements? what is the difference if we declare it like:
types: begin of ty_vbap,
vbeln type vbeln,
posnr type posnr, .....
select-options:
s_deldoc FOR likp-vbeln, " Delivery
s_dldate FOR likp-lfdat. " Delivery Date
Get delivery document number,delivery date,customer number from
delivery header table
SELECT vbeln " Delivery
lfdat " Delivery Date
kunnr " Customer Number 1
FROM likp
INTO TABLE t_likp
WHERE vbeln IN s_deldoc
AND lfdat IN s_dldate.
IF sy-subrc EQ 0.
Get Customer name for customer numbers from Customer master table
SELECT kunnr " Customer Number 1
name1 " Name 1
FROM kna1
INTO TABLE t_kna1
FOR ALL ENTRIES IN t_likp
WHERE kunnr EQ t_likp-kunnr.
IF sy-subrc EQ 0.
Get delivery item number,sales document number,sales item number,
delivery quantity from delivery item table
SELECT vbeln " Delivery
posnr " Delivery Item
vgbel " Document number of
" reference document
vgpos " Item number of reference item
lfimg " Actual quantity delivered
vrkme " Sales unit
FROM lips
INTO TABLE t_lips
FOR ALL ENTRIES IN t_likp
WHERE vbeln EQ t_likp-vbeln.
IF sy-subrc EQ 0.
Get sales document number,item number,material,material description,
ordered quantity from sales item table
SELECT vbeln " Sales Document
posnr " Sales Document Item
matnr " Material Number
arktx " Short text for sales order
" item
kwmeng " Cumulative Order Quantity
vrkme " Sales unit
FROM vbap
INTO TABLE t_vbap
FOR ALL ENTRIES IN t_lips
WHERE vbeln EQ t_lips-vgbel
AND posnr EQ t_lips-vgpos.
IF sy-subrc EQ 0.
Get sales document number ,created date,purchase order number from
sales header table
SELECT vbeln " Sales Document
erdat " Date on Which Record Was" Created
aufnr " Order Number
FROM vbak
INTO TABLE t_vbak
FOR ALL ENTRIES IN t_lips
WHERE vbeln EQ t_lips-vgbel.
IF sy-subrc EQ 0.* Get billing document number,billing item,reference delivery document
number,delivery item number,billing item from billing item table
SELECT vbeln " Billing Document
posnr " Billing item
vgbel " Document number of the
" reference document
vgpos " Item number of the" reference" item
fklmg " Billing quantity in" stockkeeping unit
vrkme " Sales unit
FROM vbrp
INTO TABLE t_vbrp
FOR ALL ENTRIES IN t_lips
WHERE vgbel EQ t_lips-vbeln
AND vgpos EQ t_lips-posnr.
ENDIF. " IF SY-SUBRC EQ 0
ENDIF. " IF SY-SUBRC EQ 0
ENDIF. " IF SY-SUBRC EQ 0
ENDIF. " IF SY-SUBRC EQ 0
ELSE.
Display message if records are not found for entered values
MESSAGE S000.
EXIT.
ENDIF. " IF SY-SUBRC EQ 0
Looping Delivery item internal table to assign values to order
internal table
LOOP AT t_lips INTO fs_lips.
Get delivery date and customer number for delivery document number
from delivery header internal table
READ TABLE t_likp WITH KEY vbeln = fs_lips-vbeln
INTO fs_likp.
Get customer name for customer number from customer master internal
table
IF sy-subrc EQ 0.
READ TABLE t_kna1 WITH KEY kunnr = fs_likp-kunnr
INTO fs_kna1.
Get sales document number,item number,ordered quantity for delivery
document number,item number from sales item internal table
IF sy-subrc EQ 0.
READ TABLE t_vbap WITH KEY vbeln = fs_lips-vgbel
posnr = fs_lips-vgpos INTO fs_vbap.
Get goods issue date and purchase order number for sales document
number from sales header internal table
IF sy-subrc EQ 0.
READ TABLE t_vbak WITH KEY vbeln = fs_vbap-vbeln INTO fs_vbak.
IF sy-subrc EQ 0.
Get billing document number,billing item,billing quantity for delivery
document number,delivery item number from billing item internal table
READ TABLE t_vbrp WITH KEY vgbel = fs_lips-vbeln
vgpos = fs_lips-posnr INTO fs_vbrp.
Assign sales,delivery,billing fields into respective fields of sales
order internal table
IF sy-subrc EQ 0.
fs_order-vbeln = fs_vbap-vbeln.
fs_order-posnr = fs_vbap-posnr.
fs_order-erdat = fs_vbak-erdat.
fs_order-kunnr = fs_likp-kunnr.
fs_order-name1 = fs_kna1-name1.
fs_order-aufnr = fs_vbak-aufnr.
fs_order-matnr = fs_vbap-matnr.
fs_order-arktx = fs_vbap-arktx.
fs_order-kwmeng = fs_vbap-kwmeng.
fs_order-vrkme = fs_vbap-vrkme.
fs_order-vbeln1 = fs_lips-vbeln.
fs_order-posnr1 = fs_lips-posnr.
fs_order-lfimg = fs_lips-lfimg.
fs_order-vrkme1 = fs_lips-vrkme.
fs_order-vbeln2 = fs_vbrp-vbeln.
fs_order-posnr2 = fs_vbrp-posnr.
fs_order-fklmg = fs_vbrp-fklmg.
fs_order-vrkme2 = fs_vbrp-vrkme.
APPEND fs_order TO t_order.
CLEAR fs_order.
ENDIF. " IF SY-SUBRC EQ 0
ENDIF. " IF SY-SUBRC EQ 0
ENDIF. " IF SY-SUBRC EQ 0
ENDIF. " IF SY-SUBRC EQ 0
ENDIF. " IF SY-SUBRC EQ 0
ENDLOOP. " LOOP AT T_LIPS INTO FS_LIPS
Maybe you are looking for
-
Servlet- How to send the file as argument
I am able to compile the below program. But when I open it in explorer I m not able to get the response. Its giving me the error. Actually the program requires the file from the user. I am giving that in the url in the folowing way http://localhost:8
-
Creating Variant in Dialog Program Screen
Hi All, Can I create Variant in Dialog Program screen.If yes, how can I do this? Thanks Saurabh
-
Fresh install of Crystal Reports 11 pro. I have download CR R2 SP4 full, but when I try to install I get errors: "CRC failed in win32\CrstalReports.cab The file "???" header is corrupt". I have re-downloading a couple of times already. I don't kn
-
Can anyone recommend a webcam for me to use? I'm a bit worried about it clashing with the iphone sync as I've heard a lot of bad stories about blue screen of death when syncing if you have a logitech webcam. I'll be using the webcam for skype & msn m
-
Cannot download the evaluation copy of Server 2012 R2
Apologies if this is in the wrong place but I don't know where else to put it. I am trying to download an evaluation copy of Server 2012 R2 from the TechNet Evaluation Center. I have tried both ISO and VHD forms but am getting the error below (that