Error in dynamic node creation ..........
Hi experts,
I am creating a node dynamically in WDDOINT and creating an input field in WDDOMODIFYVIEW , but am getting an error "attribute not found". Am pasting below my code...
Code in WDDOINT of a view :
data lr_par_node type ref to IF_WD_CONTEXT_NODE_INFO.
data lr_node type ref to IF_WD_CONTEXT_NODE_info.
data lr_node_info1 type ref to IF_WD_CONTEXT_NODE_INFO.
data lr_node1 type ref to IF_WD_CONTEXT_NODE.
data lr_attribute type WDR_CONTEXT_ATTRIBUTE_INFO.
data lt_child_node_map type wdr_context_child_info_map.
*****to get context parent node information
lr_par_node = wd_context->get_node_info( ).
*****to get child node of the parent
lt_child_node_map = lr_par_node->get_child_nodes( ).
*****check for the existence of node
read table lt_child_node_map transporting no fields with table key name = `RESULT`.
if sy-subrc = 0.
" REMOVE_CHILD_NODE
lr_par_node->remove_child_node( `RESULT` ).
endif.
*****inserting new node in context
CALL METHOD lr_par_node->ADD_NEW_CHILD_NODE
EXPORTING
NAME = 'RESULT'
* IS_MANDATORY = ABAP_FALSE
* IS_MANDATORY_SELECTION = ABAP_FALSE
IS_MULTIPLE = ABAP_TRUE
IS_MULTIPLE_SELECTION = ABAP_TRUE
* IS_SINGLETON = ABAP_FALSE
IS_INITIALIZE_LEAD_SELECTION = ABAP_false
* STATIC_ELEMENT_RTTI =
IS_STATIC = ABAP_TRUE
* ATTRIBUTES =
* IS_RANGE_NODE =
RECEIVING
CHILD_NODE_INFO = lr_node.
lr_node1 = wd_context->get_child_node( name = 'RESULT' ).
lr_node_info1 = lr_node1->GET_NODE_INFO( ).
*********Adding attribute
lr_attribute-NAME = 'TEST_GROUP'.
lr_attribute-TYPE_NAME = 'PLNNR'.
lr_attribute-NODE_INFO = lr_node_info1.
CALL METHOD lr_node_info1->ADD_ATTRIBUTE
EXPORTING
ATTRIBUTE_INFO = lr_attribute.
clear lr_attribute.
Code in the WDDOMODIFYVIEW :
method WDDOMODIFYVIEW .
if first_time = abap_true.
data : lt_header_block type zcdp_tt_mfte_header.
lt_header_block = WD_COMP_CONTROLLER->MT_HEADER_BLOCK.
DATA :lr_container TYPE REF TO cl_wd_uielement_container,
lr_input TYPE REF TO cl_wd_input_field,
lr_caption type ref to CL_WD_CAPTION,
lr_column type ref to CL_WD_TABLE_COLUMN,
lr_trans_cont TYPE REF TO CL_WD_TRANSPARENT_CONTAINER.
data lr_lbl type ref to CL_WD_TEXT_VIEW.
******to get root element container
lr_container ?= view->get_element( 'ROOTUIELEMENTCONTAINER' ).
lr_trans_cont ?= VIEW->GET_ELEMENT('TRANS_CONT_HEADER_BLOCK').
* Created one transparent container in the view.......
CALL METHOD CL_WD_TEXT_VIEW=>NEW_TEXT_VIEW
EXPORTING
* CONTEXT_MENU_BEHAVIOUR = E_CONTEXT_MENU_BEHAVIOUR-INHERIT
* CONTEXT_MENU_ID =
* DESIGN = E_DESIGN-STANDARD
* ENABLED = 'X'
* H_ALIGN = E_H_ALIGN-AUTO
* ID =
* LAYOUT = E_LAYOUT-NATIVE
* SEMANTIC_COLOR = E_SEMANTIC_COLOR-STANDARD
TEXT = 'TEST'
* TEXT_DIRECTION = E_TEXT_DIRECTION-INHERIT
* TOOLTIP =
* VIEW =
* VISIBLE = E_VISIBLE-VISIBLE
* WIDTH =
* WRAPPING =
RECEIVING
CONTROL = lr_lbl
cl_wd_matrix_head_data=>new_matrix_head_data(
element = lr_lbl ).
lr_trans_cont->ADD_CHILD( lr_lbl ).
CALL METHOD CL_WD_INPUT_FIELD=>NEW_INPUT_FIELD
EXPORTING
BIND_VALUE = 'RESULT.TEST_GROUP'
ENABLED = 'X'
* EXPLANATION =
ID = 'ABCD'
RECEIVING
CONTROL = lr_input.
cl_wd_matrix_data=>new_matrix_data(
element = lr_input ).
lr_trans_cont->ADD_CHILD( lr_input ).
endif.
endmethod.
Pls help me in this.....
Thanks
Aisurya.
Hi,
looking at code it seems that you are adding textview and inputfield. please check in debugging if the correct context node/attribute is being created and you are providing its reference while adding UI elements.
Thanks,
Chandra
Similar Messages
-
Dynamic node creation from RTTI structure and dynamic mapping
Hi,
I'd like to create a dynamic node in my component controller then map this node to a node in my view and bind it to a dynamic table.
I create the dynamic node in my component controller using the add_new_child_node method :
CALL METHOD root_node_info->add_new_child_node
EXPORTING
name = 'MY_TABLE'
static_element_rtti = struct_type
is_static = ABAP_true
RECEIVING
child_node_info = node_info
Then I use the add_new_mapped_child_node method to map the node in the view :
* Map the context node dynamically
wa_path = 'COMPONENTCONTROLLER.MY_TABLE'.
insert wa_path into table tab_mapping_path.
stru_mapping_info-controller = 'COMPONENTCONTROLLER'.
stru_mapping_info-path = tab_mapping_path.
lo_node_info = wd_context->get_node_info( ).
CALL METHOD lo_node_info->add_new_mapped_child_node
EXPORTING
child_name = 'MY_TABLE'
mapping_info = stru_mapping_info
receiving
child_node_info = lo_dyn_node_info
The child node is created in my view context but it doesn't have any attribute or static element RTTI.
Do I have to add each attribute with the add_attribute method and then the add_new_mapped_child_node method will copy them over?
Regards,
PierreProblem solved, the path was not good :
* Map the context node dynamically
* wa_path = 'COMPONENTCONTROLLER.MY_TABLE'.
* insert wa_path into table tab_mapping_path.
stru_mapping_info-controller = 'COMPONENTCONTROLLER'.
* stru_mapping_info-path = tab_mapping_path.
append 'COMPONENTCONTROLLER' to stru_mapping_info-path.
append 'MY_TABLE' to stru_mapping_info-path.
lo_node_info = wd_context->get_node_info( ).
CALL METHOD lo_node_info->add_new_mapped_child_node
EXPORTING
child_name = 'MY_TABLE'
mapping_info = stru_mapping_info
receiving
child_node_info = lo_dyn_node_info
Regards,
Pierre -
ADF - managed bean error in dynamic menu creation
scenario:
to create dynamic menu for two tabs : general..
general has a subtabmenu in form of menubar wid items: country, city,...
i created dynamic menus for my application.wen i ran my page i got this error:
SEVERE: Managedbean menuItem_General could not be created Can't get value from value binding expression:
'#{resources['erms.menu.gen']}'
(erms.menu.gen is an entry in UIResources.properties)
now, i followed the exact same process as mentioned in the SRDemo application, in adfdevguide!
double checked that
i. resource adapter is configured in faces-config.
ii.menu model and menuTreeModel are configured with thier default adapaters in faces-config.
iii.resource bundle specified in jsp page.
can sum1 plz refer
1.wat is the reason of this error? wat are the things dat shud hold true in order to run these dynamic menu? which files shud
b specified where?
2. in wat order are the managedbeans created ?
is it in order they apprear in faces-config file or in order they are used in the jsp page?
3: is it possible that u click on a menuTab item and it displays its particular menubar's items while staying on the same page? or
u click on a menubar item and it displays its particular dropdowns while staying on the same page?
is it posible wid ADF or javascript shud b used?Hi,
looking at code it seems that you are adding textview and inputfield. please check in debugging if the correct context node/attribute is being created and you are providing its reference while adding UI elements.
Thanks,
Chandra -
Hai all,
I am new to the Dynpro. i have to create 'n' number of drop down at dynamically. The values of 'n' only known at runtime, that is fetch from database.
Basically each dropdown must have one node and one attribute. So i have to create 'n' number of nodes. Each drop down have different values.
I created some node at runtime using the following code.
for(int j=0;j<count;j++){
IWDNodeInfo node = wdContext.getNodeInfo
().addChild ("Roles"+j,null,true, true,false,
false,false,true,null,null,null);
node.addAttribute(roles[j].toString
(),"com.sap.dictionary.string");
This is done inside the wdDoInit() method.
Then i have to fetch the node one by one and load values from database and finally bind into the drop down inside the wdDoModifyView() method.
I tried the following code,but i don't know whether is it correct way or not.
if (firstTime) {
IWDTransparentContainer container =
(IWDTransparentContainer) view.getElement
("RootUIElementContainer");
container.createLayout(IWDMatrixLayout.class);
for(int rolecunt=0;rolecunt<size;rolecunt++){
IWDNode node = wdContext.currentContextElement().node().getChildNode("Roles"+rolecunt,rolecunt);
IWDNodeElement nodeElement1 = node.getCurrentElement();
thanks in advance,
Mukesh Mani.Hai Noufal,
Thanks for your reply. I couldn't get you. From your suggestion i created dropdown only in domodify() like this,
IWDDropDownByIndex dropDownList = (IWDDropDownByIndex)
view.createElement (IWDDropDownByIndex.class, "inp");
How to bind node attribute into the above drop down. Before i created 'n' number of nodes in
wdinit() method using the following code.
for(int j=0;j<count;j++){
IWDNodeInfo node =
wdContext.getNodeInfo().addChild(
"Roles"+j,
null,
true,
true,
false,
false,
false,
true,
null,
null,
null);
// for(int k=0;k<count;k++){
node.addAttribute(roles[j].toString(),"com.sap.dictionary.string"); -
Hi all,
I am trying to create a node through Java code bellow is the code
IWDNodeInfo graph = wdContext.nodeGraph().getNodeInfo();
for(int i=0;i<10;i++)
int nodeNumber = i+4;
IWDNodeInfo seriseNode = graph.addChild("Serise"+nodeNumber,null,true,false,false,false,false,false,null,null,null);
seriseNode.addAttribute("S"+nodeNumber+"_size","com.sap.dictionary.double");
seriseNode.addAttribute("S"+nodeNumber+"_xVal","com.sap.dictionary.double");
seriseNode.addAttribute("S"+nodeNumber+"_yVal","com.sap.dictionary.double");
//seriseNode.addAttribute("S"+nodeNumber+"_tooltip","com.sap.dictionary.string");
IWDNode node = wdContext.nodeGraph().getChildNode("Serise"+nodeNumber,IWDNode.NO_SELECTION);
IWDNodeElement nodeElem = node.createElement();
nodeElem.setAttributeValue("S"+nodeNumber+"_xVal",new Double(0));
nodeElem.setAttributeValue("S"+nodeNumber+"_yVal",new Double(0));
nodeElem.setAttributeValue("S"+nodeNumber+"_size",new Double(0));
node.addElement(nodeElem);
IWDNode node = wdContext.nodeGraph().getChildNode("Serise4",IWDNode.NO_SELECTION);
node.getCurrentElement().getAttributeAsText("S4_size");
now it is giving me null pointer exception at last line any idea why it coming.
ThanksHi,
This problem is solved but now there is another problem,
I am creating a Node and attributes at runtime and want to bind to a business graphics UI element bellow is the code for that
IWDPoint se_point = (IWDPoint) view.createElement(IWDPoint.class,"Series"+seriseNumber+"_Point");
se.setPoint(se_point);
se.getPoint().bindValueSource("Graph.Serise"+seriseNumber);
se.setLabel(supp.getSupplier_Name());
IWDNumericValue numXVal = (IWDNumericValue) view.createElement(IWDNumericValue.class,"S_"+seriseNumber+"numXVal");
numXVal.bindValue("Graph.Series"+seriseNumber+".S"+seriseNumber+"_xVal");
numXVal.setType(WDValueTypeEnumeration.X);
numXVal.setValue(supp.getXcord());
and it gives bellow error for last line in the code
com.sap.tc.webdynpro.progmodel.context.ContextException: Node(GraphView.Graph): no child node 'Series1' at index -1
Can any one help in this
Thanks -
Dynamic Node bind to attribute of type "STRING_TABLE"
Hi ,
I want to create dynamic node which is bind to attribute of type "STRING_TABLE'.
Basically I want to create this node for inserting dynamic "TEXT EDIT' UI elements in my view .
can sm1 help me in this regard.Seems like you should be able to use the API: cl_wd_dynamic_tool=>create_nodeinfo_from_struct.
The real question is do you really need to create the node dynamically. Why not just create a node that has the string_table attribute in it. Make the node 1:n or 0:n. Bind this node to a RowReapter or MultiPane UI element. Then as a child of the RowReapter/MultiPane you place your textEdit UI element. This way, you will render dynamically how ever many textEdits as there are elements in your node. No need for dynamic node creation. -
Error message "ABAP/4 error during dynamic assign" on Contact Log creation.
Hi,
We are getting an error message "ABAP/4 error during dynamic assign beyond program bounds" displayed while creating contact log using transaction "BCT0".
Please suggest what can be the cause of the error message and how we can remove this.
Regards,
AnkurDear Andrea,
The problem should be caused by obsolete entry in table TFAWX.
Please use the following report for deleting this entry (test before in your TEST System) :
report ztfawx_delete.
tables tfawx.
select single * from tfawx where prog = 'SAPLBAS0'
and bldgr = '0110'
and mnum = 23
and bfeld = '$GENERAL'.
if sy-subrc = 0.
delete tfawx.
endif.
Buona Giornata
Mauro -
Problem with Dynamic Node & UI Elements
Hi,
The scenario is to create an Questioaire.Since the number questions which I get from R/3 may vary, I have created the Dynamic Node which is mapped with Dynamic set of Radio button Group by index for options & Dynamic text view for displaying Questions.. A New Dynamic Node will be created for each set of Questions .The Number of questions displayed per page is controlled by the Static Counter Variable....
Now the issue is ,if i click back button the count will be initialized so again it needs to trigger the DoModifyView(). at that time It is arising an exception "Duplicate ID for view & Radio button ..." because while creating Dynamic node i used to have "i" value along the Creation of node name...
for(i=Count;i<i<wdContext.nodeQuestions().size();i++)
customnod=<b>nodeinfo.getChild("Questionaire"+i);</b>
if(customnod==null)
Its not possible to create a new node whenever i click the Back button.
At the same time i am not able to fetch the elements which had already created Dynamically...
How do i make the Next & back button work?
If anyone bring me the solution It would be more helpful to me.
Thanks in advance..
Regards,
MalarHi,
We can Loop through the Node Elements but how can we do Option Button Creation for each set of question Options?. At design time we can not have the radio buttons,because we do not know how many set of questions are available at the Backend. -
Error in BPM - Error when processing node '0000000065' ParForEach index
Hi All,
I have an issue .. I have done 1:n mapping successfully and would like to place the Send step in loop instead of a Block .. The reason being I have the count of how many times the Send step should executed for multiline.. I need to receive an Acknowledgement for each send step.. If I dont receive the required number of Acknowledgements then .. I need to revert back some Creations which is a business requirement ..
So .. I have initialized a container operation variable i to '0' .. Then the loop condition is i < count .. Send the multi-container .. Receive the Response .. If dont receive the desired response for any one of the multi-line then I need to do a cancellation process in a loop again .. So .. now I am getting an Exception "Error when processing node '0000000065' (ParForEach index 000000)
Message no. SWP088" in the loop step ..
It is fine if somebody can suggest alternate logic can be applied as well but first preference to use a loop which consumes lesser system resources ..
Kindly look into the Issue
Regards,
Raj
Edited by: raj2112 on Sep 21, 2010 2:34 PMif you use a loop step, you will send one message per time. ussing block step you have parallel processing ussing ParForEach. now is for X reason the item cannot be created, do a roll back in the target system. the problem here you will do the rollback once the last message reach.
the other posibility is to handle application ack in the sender step. it will let you know it the message was processed success and this ack could be the end condition of your block step. but you cannot use this with loop step.
take a look to this
http://help.sap.com/saphelp_nw04/helpdata/en/55/65c844539349e9b1450581ab44a5e6/frameset.htm -
Portal Runtime Error in Dynamic Navigation Area
Hello gurus,
In our production portal all of sudden we are getting a portal runtime error in Dynamic Navigation Area. Earlier there was a problem with one of the clustered nodes and it was resolved. I was wondering if this error is in connection with that. Has anybody faced such problem? Following is the error we are facing in the dynamic navigation area.
<b>Portal Runtime Error
An exception occurred while processing a request for :
iView : pcd:portal_content/fenderfolder/defaultDesktop/frameworkPages/frameworkpage/com.sap.portal.innerpage/com.sap.portal.dynamicNavigationArea
Component Name : com.sap.portal.navigation.dynnavarea.DynamicNavigationArea</b>
Please advice on how to resolve the issue.
Thanks in advance.
VR.Hello all again,
We are not getting this Dynamic Navigation Error on ONE of the clustered nodes and all other clustered nodes are working fine.
Any idea how to resolve the issue?
Thanks in advance.
VR. -
Create Multiple dynamic Node in Web Dynpro Abap
Hi Friends,
I need your help.My object is to create Multiple dynamic dropdown UI element.I am able to create this dynamic Dropdown element. But i need to assign default different values to this dropdown elements.So i created dynamic nodes for each dropdown and created attribute with same name as that of value table.
My issue is its giving me error as : -
Lower-Level Node with Name ZDCN_BRD_STATUS.ME Does Not Exist
Help me to rectify this error..
Regards,
SantoshHi,
This information is not enough for anybody to help you. Write more in detail about your code and where exactly in the code this error is coming.
One trial experiment can be that you split your problem into two or more level.
Create several nodes in your context with attribute and sample data.
Create Dynamic UI (DDBI) and Bind these attributes to your DDBI.
When it works perfectly, then tryout how to create the Node and attribute dynamically. This way you are not making it too complex to solve this problem. -
Hi Experts,
I am creating Dynamic nodes from Model's Node, each time I execute in the application a function module, the Dynamic nodes must be realeased from session and created again and then the application must also create the user interface elements dynamically as well, from those dynamic nodes. The problem is: When I come back to the initial view and navigates to the report's view, I mean, when there is a new execution of the function's module, The application throws the following error:
com.sap.tc.webdynpro.progmodel.context.ContextException: DataNodeInfo(EdoCtaDetView): duplicate name for child node Nodo0
Can I somehow eliminate the instances of the nodes in order to create new dynamic nodes in each execution of the function's module?
Regards,
BrigerHi Briger,
Well it's very easy... only you have to put in your source code the following lines, after you invalidate all the elements of your context:
IWDContext ctx = wdContext.getContext();
ctx.reset(false);
There is two kind of reset method. the reset() reset all the metadata and destroy dynamics node. reset(false), reset all metadata destroy dynamics node but keeps the nodes build at design time.
Regards,
MC -
Permissions issue - node creation
Today our application developed a new bug related to posting messages into a SimpleChatModel node. It tells us that the user does not have permission to create the node.
We have approximately 50 rooms and all of them have the nodes we need already in them. There is no node creation that takes place during normal operation of our application.
Now, we've been doing this type of posting (successfully posting chat messages into the SimpleChatModel with only Publisher-level permissions) all last week and over the weekend. It may be that we wrote a bug of course, but I couldn't help noticing that the timing coincided with Nigel's blog post introducing the new SDK. Is it possible that the volume of new LCCS users, or the use of new server-side permission techniques is related to our issue?
Thanks,
-MikeHironmay, I appreciate your input, I know I didn't really provide enough info but I wanted to see if there actually was a problem of which you were aware.
The behavior was better this morning - but the error has returned (no changes to our code have been made). So I suspect it is either a timing issue related to how elements of the swf load, or a bug in your service.
Here is some of the code we use to initialize the chat pod.
import com.adobe.rtc.sharedModel.descriptors.ChatMessageDescriptor;
import com.adobe.rtc.events.ChatEvent;
import com.adobe.rtc.sharedModel.SimpleChatModel;
[Bindable]
public var chatModel:SimpleChatModel;
private function init():void{
chatModel = new SimpleChatModel();
chatModel.sharedID = "myChat_SimpleChatModel";
sync();
chatModel.addEventListener(ChatEvent.HISTORY_CHANGE, onChatMsg);
this.addEventListener(KeyboardEvent.KEY_UP, onKeyStroke);
public function sync():void
chatModel.subscribe();
protected function submitChat(str:String):void
var cmd:ChatMessageDescriptor = new ChatMessageDescriptor();
cmd.msg = str;
chatModel.sendMessage(cmd);
chat_mesg_input.text = "";
that code is in an mxml file that defines the chat pod. the only other place in which we call sync() is reproduced with a small bit of context here:
if (_usersInRoom == "2" && !_synched) {
startPublication();
if (chatPod) {
chatPod.sync();
_synched = true;
this issue does not seem to be confined to any specific room(s) and we are using version 10.
Error: MessageManager.createNode : insufficient permissions to create node
at com.adobe.rtc.messaging.manager::MessageManager/http://www.adobe.com/2006/connect/cocomo/messaging/internal::createNode()[C:\work\branches \connect\1004\cocomoPlayer10\src\com\adobe\rtc\messaging\manager\MessageManager.as:253]
at com.adobe.rtc.sharedModel::CollectionNode/publishItem()[C:\work\branches\connect\1004\coc omoPlayer10\src\com\adobe\rtc\sharedModel\CollectionNode.as:615]
at com.adobe.rtc.sharedModel::SimpleChatModel/sendMessage()[C:\work\branches\connect\1004\co comoPlayer10\src\com\adobe\rtc\sharedModel\SimpleChatModel.as:377]
at ChatComponent/submitChat()[/Users/mschwab/work/GoodChat/flex/src/ChatComponent.mxml:31]
at ChatComponent/onKeyStroke()[/Users/mschwab/work/GoodChat/flex/src/ChatComponent.mxml:55] -
RE: dynamic widget creation
This is a good tech note about this on the Forte website.
-----Original Message-----
From: Matthew Middleton [SMTP:[email protected]]
Sent: Friday, 25 June 1999 11:11
To: [email protected]
Subject: dynamic widget creation
I have done a few windows with dynamic widget creation. Sometimes it
seems I have to have done self.Open before, to get things to appear
properly, and sometimes not.
What I would like is a summation of the issues involved here so I can
write such code without resorting to trial and error.
with advance appreciation,
Matthew
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive
<URL:http://pinehurst.sageit.com/listarchive/>-
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>Tech Note 5156, which I have attached for your information.
-----Original Message-----
From: Foster, Todd [SMTP:[email protected]]
Sent: Saturday, 26 June 1999 1:27
To: 'Jason de Cean'
Subject: RE: dynamic widget creation
? What technote ?
-----Original Message-----
From: Jason de Cean [SMTP:[email protected]]
Sent: Thursday, June 24, 1999 9:19 PM
To: 'Matthew Middleton'
Cc: 'Forte Users'
Subject: RE: dynamic widget creation
This is a good tech note about this on the Forte website.
-----Original Message-----
From: Matthew Middleton [SMTP:[email protected]]
Sent: Friday, 25 June 1999 11:11
To: [email protected]
Subject: dynamic widget creation
I have done a few windows with dynamic widget creation. Sometimes
it
seems I have to have done self.Open before, to get things toappear
properly, and sometimes not.
What I would like is a summation of the issues involved here so Ican
write such code without resorting to trial and error.
with advance appreciation,
Matthew
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive
<URL:http://pinehurst.sageit.com/listarchive/>-
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive<URL:http://pinehurst.sageit.com/listarchive/> -
Error in : Purchase order Creation using BAPI_PO_CREATE1
Hell guys,
I am trying to create a PO using a BAPI - BAPI_PO_CREATE1
I want the new PO to have all the characteristics of an existing PO. whose PO # is stored in wa_order_split_create-docnr and for the new PO, i want the quantity from wa_order_split_create-qty_acptd and the delivery data to be wa_order_split_create-dly_date. But this process and code below gives a short dump in the std FM - MEPO_DOC_ITEM_GET . It raises an exception of failure. I am trying to create many new PO's in the loop below. If there is just one row, sometimes, it creates the PO even with the exception failure ( which is pretty weird).
Am i making any mistake while filling the header or item or schedule lines for the BAPI_PO_CREATE1 ? Any tips or clues why I am getting a dump ?
DATA: i_insert,
i_create_order,
i_cycle TYPE cycle,
i_qty_acpt TYPE dzmeng,
i_dly_date TYPE vbak-vdatu,
i_item TYPE roijnomiio .
DATA: i_order TYPE symsgv,
i_return TYPE swd_return .
DATA: i_vbak TYPE vbak,
i_vbap TYPE vbap,
i_ekko TYPE ekko,
i_ekpo TYPE ekpo,
i_bsoh TYPE bapisdhd1,
i_bsohx TYPE bapisdhd1x,
i_bpoh TYPE bapimepoheader,
i_bpohx TYPE bapimepoheaderx,
i_vbeln TYPE vbeln_va,
i_posnr TYPE posnr_va,
i_contr TYPE vbeln_va,
i_conit TYPE posnr_va,
i_ebeln TYPE ebeln,
i_ebelp TYPE ebelp,
i_pargr TYPE pargr,
i_thead TYPE thead,
i_line TYPE tline,
i_note TYPE txw_note,
i_new_vbeln TYPE vbeln_va,
i_new_ebeln TYPE ebeln,
i_wa_bsoi TYPE bapisditm,
i_wa_bsoix TYPE bapisditmx,
i_wa_bsop TYPE bapiparnr,
i_wa_bsos TYPE bapischdl,
i_wa_bsosx TYPE bapischdlx,
i_wa_vbpa TYPE vbpa,
i_wa_vbkd TYPE vbkd,
i_wa_bpoi TYPE bapimepoitem,
i_wa_bpoix TYPE bapimepoitemx,
i_wa_bpos TYPE bapimeposchedule,
i_wa_bposx TYPE bapimeposchedulx,
i_wa_bpop TYPE bapiekkop,
i_wa_ekpa TYPE ekpa,
i_message TYPE char72,
i_bapiretn TYPE bapiret2,
i_bapiret2 TYPE TABLE OF bapiret2 INITIAL SIZE 1,
i_vbpa TYPE TABLE OF vbpa INITIAL SIZE 1,
i_vbkd TYPE TABLE OF vbkd INITIAL SIZE 1,
i_ekpa TYPE TABLE OF ekpa INITIAL SIZE 1,
i_bsoi TYPE TABLE OF bapisditm INITIAL SIZE 1,
i_bsoix TYPE TABLE OF bapisditmx INITIAL SIZE 1,
i_bsos TYPE TABLE OF bapischdl INITIAL SIZE 1,
i_bsosx TYPE TABLE OF bapischdlx INITIAL SIZE 1,
i_bsop TYPE TABLE OF bapiparnr INITIAL SIZE 1,
i_bpoi TYPE TABLE OF bapimepoitem INITIAL SIZE 1,
i_bpoix TYPE TABLE OF bapimepoitemx INITIAL SIZE 1,
i_bpos TYPE TABLE OF bapimeposchedule INITIAL SIZE 1,
i_bposx TYPE TABLE OF bapimeposchedulx INITIAL SIZE 1,
i_bpop TYPE TABLE OF bapiekkop INITIAL SIZE 1,
i_text_tab TYPE TABLE OF tline INITIAL SIZE 1,
i_line_tab TYPE TABLE OF tline INITIAL SIZE 1,
i_txw_note TYPE TABLE OF txw_note INITIAL SIZE 1,
i_oij_el_doc_mot TYPE oij_el_doc_mot .
CONSTANTS: c_char_c VALUE 'C',
c_char_e VALUE 'E',
c_char_p VALUE 'P',
c_char_g VALUE 'G',
c_char_i VALUE 'I',
c_char_s VALUE 'S',
c_char_x VALUE 'X',
c_zsw(3) VALUE 'ZSW',
c_nomit_stat(4) VALUE 'ZDNY' .
DATA : lv_nomtk_split TYPE oij_nomtk.
DATA : i_order_split_create TYPE TABLE OF zsws_order_split.
DATA : wa_order_split_create TYPE zsws_order_split.
LOOP AT i_order_split_create INTO wa_order_split_create.
IF NOT i_create_order IS INITIAL .
CLEAR: i_create_order .
MOVE: wa_order_split_create-docnr TO i_ebeln,
wa_order_split_create-docitm TO i_ebelp .
CALL FUNCTION 'ME_EKKO_SINGLE_READ'
EXPORTING
pi_ebeln = i_ebeln
IMPORTING
po_ekko = i_ekko
EXCEPTIONS
no_records_found = 1
OTHERS = 2.
IF sy-subrc <> 0 .
ENDIF .
* Fill PO Header
i_bpoh-comp_code = i_ekko-bukrs .
i_bpoh-doc_type = i_ekko-bsart .
i_bpoh-vendor = i_ekko-lifnr .
i_bpoh-langu = i_ekko-spras .
i_bpoh-pmnttrms = i_ekko-zterm .
i_bpoh-purch_org = i_ekko-ekorg .
i_bpoh-pur_group = i_ekko-ekgrp .
i_bpoh-currency = i_ekko-waers .
i_bpoh-agreement = i_ekko-konnr .
i_bpoh-incoterms1 = i_ekko-inco1 .
i_bpoh-incoterms2 = i_ekko-inco2 .
* Fill PO update indicator 'X'
i_bpohx-comp_code = c_char_x .
i_bpohx-doc_type = c_char_x .
i_bpohx-vendor = c_char_x .
i_bpohx-langu = c_char_x .
i_bpohx-pmnttrms = c_char_x .
i_bpohx-purch_org = c_char_x .
i_bpohx-pur_group = c_char_x .
i_bpohx-currency = c_char_x .
i_bpohx-agreement = c_char_x .
i_bpohx-incoterms1 = c_char_x .
i_bpohx-incoterms2 = c_char_x .
CALL FUNCTION 'ME_EKPO_SINGLE_READ'
EXPORTING
pi_ebeln = i_ebeln
pi_ebelp = i_ebelp
IMPORTING
po_ekpo = i_ekpo
EXCEPTIONS
no_records_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.
ENDIF .
* Fill PO Item
i_wa_bpoi-po_item = i_ekpo-ebelp .
i_wa_bpoi-material = i_ekpo-matnr .
i_wa_bpoi-plant = i_ekpo-werks .
i_wa_bpoi-stge_loc = i_ekpo-lgort .
i_wa_bpoi-quantity = wa_order_split_create-qty_acptd .
i_wa_bpoi-po_unit = i_ekpo-meins .
i_wa_bpoi-tax_code = i_ekpo-mwskz .
i_wa_bpoi-val_type = i_ekpo-bwtar .
i_wa_bpoi-item_cat = i_ekpo-pstyp .
i_wa_bpoi-acctasscat = i_ekpo-knttp .
i_wa_bpoi-agreement = i_ekpo-konnr .
i_wa_bpoi-agmt_item = i_ekpo-ktpnr .
APPEND i_wa_bpoi TO i_bpoi .
* Fill PO Item update indicator 'X'
i_wa_bpoix-po_item = i_ekpo-ebelp .
i_wa_bpoix-po_itemx = c_char_x .
i_wa_bpoix-material = c_char_x .
i_wa_bpoix-plant = c_char_x .
i_wa_bpoix-stge_loc = c_char_x .
i_wa_bpoix-quantity = c_char_x .
i_wa_bpoix-po_unit = c_char_x .
i_wa_bpoix-tax_code = c_char_x .
i_wa_bpoix-val_type = c_char_x .
i_wa_bpoix-item_cat = c_char_x .
i_wa_bpoix-acctasscat = c_char_x .
i_wa_bpoix-agreement = c_char_x .
i_wa_bpoix-agmt_item = c_char_x .
APPEND i_wa_bpoix TO i_bpoix .
* Fill PO Item Schedule
i_wa_bpos-po_item = i_ekpo-ebelp .
i_wa_bpos-sched_line = '0001' .
i_wa_bpos-delivery_date = wa_order_split_create-dly_date .
i_wa_bpos-quantity = wa_order_split_create-qty_acptd .
APPEND i_wa_bpos TO i_bpos .
* Fill PO Item schedule update indicator 'X'
i_wa_bposx-po_item = i_ekpo-ebelp .
i_wa_bposx-sched_line = '0001' .
i_wa_bposx-delivery_date = c_char_x .
i_wa_bposx-quantity = c_char_x .
APPEND i_wa_bposx TO i_bposx .
CLEAR: i_pargr .
SELECT SINGLE pargr
INTO i_pargr
FROM t161
WHERE bstyp = i_ekko-bstyp
AND bsart = i_ekko-bsart .
CLEAR i_ekpa[].
CALL FUNCTION 'MM_READ_PARTNERS'
EXPORTING
application = c_char_p
ebeln = i_ebeln
bstyp = i_ekko-bstyp
pargr = i_pargr
TABLES
x_ekpa = i_ekpa[].
LOOP AT i_ekpa INTO i_wa_ekpa .
i_wa_bpop-partnerdesc = i_wa_ekpa-parvw .
i_wa_bpop-langu = sy-langu .
IF NOT i_wa_ekpa-lifn2 IS INITIAL .
i_wa_bpop-buspartno = i_wa_ekpa-lifn2 .
ELSE .
i_wa_bpop-buspartno = i_wa_ekpa-parnr .
ENDIF .
APPEND i_wa_bpop TO i_bpop .
CLEAR: i_wa_ekpa, i_wa_bpop .
ENDLOOP .
CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = i_bpoh
poheaderx = i_bpohx
IMPORTING
exppurchaseorder = i_new_ebeln
TABLES
return = i_bapiret2
poitem = i_bpoi[]
poitemx = i_bpoix[]
poschedule = i_bpos[]
poschedulex = i_bposx[].
i_order = i_new_ebeln .
SHIFT i_order LEFT DELETING LEADING '0' .
i_return-errortype = c_char_i .
i_return-workarea = c_zsw .
i_return-message = '064' .
i_return-variable1 = i_order .
loop at i_bapiret2 into i_bapiretn where type ca 'EAX' .
append i_bapiretn to t_bapi_return .
endloop .
if t_bapi_return[] is initial .
i_create_order = c_char_x .
CALL FUNCTION 'SWD_POPUP_MESSAGE_SEND'
EXPORTING
act_return = i_return. "Popup with new PO no.
ENDCASE . " Docind
ENDIF .
ENDLOOP.Hi Shareen,
I think in the following parts of the code,
CALL FUNCTION 'MM_READ_PARTNERS'
EXPORTING
application = c_char_p
ebeln = i_ebeln
bstyp = i_ekko-bstyp
pargr = i_pargr
TABLES
x_ekpa = i_ekpa[].
Error in : Purchase order Creation using BAPI_PO_CREATE1
Posted: Mar 20, 2006 7:39 PM Reply E-mail this post
Hell guys,
I am trying to create a PO using a BAPI - BAPI_PO_CREATE1
I want the new PO to have all the characteristics of an existing PO. whose PO # is stored in wa_order_split_create-docnr and for the new PO, i want the quantity from wa_order_split_create-qty_acptd and the delivery data to be wa_order_split_create-dly_date. But this process and code below gives a short dump in the std FM - MEPO_DOC_ITEM_GET . It raises an exception of failure. I am trying to create many new PO's in the loop below. If there is just one row, sometimes, it creates the PO even with the exception failure ( which is pretty weird).
Am i making any mistake while filling the header or item or schedule lines for the BAPI_PO_CREATE1 ? Any tips or clues why I am getting a dump ?
DATA: i_insert,
i_create_order,
i_cycle TYPE cycle,
i_qty_acpt TYPE dzmeng,
i_dly_date TYPE vbak-vdatu,
i_item TYPE roijnomiio .
DATA: i_order TYPE symsgv,
i_return TYPE swd_return .
DATA: i_vbak TYPE vbak,
i_vbap TYPE vbap,
i_ekko TYPE ekko,
i_ekpo TYPE ekpo,
i_bsoh TYPE bapisdhd1,
i_bsohx TYPE bapisdhd1x,
i_bpoh TYPE bapimepoheader,
i_bpohx TYPE bapimepoheaderx,
i_vbeln TYPE vbeln_va,
i_posnr TYPE posnr_va,
i_contr TYPE vbeln_va,
i_conit TYPE posnr_va,
i_ebeln TYPE ebeln,
i_ebelp TYPE ebelp,
i_pargr TYPE pargr,
i_thead TYPE thead,
i_line TYPE tline,
i_note TYPE txw_note,
i_new_vbeln TYPE vbeln_va,
i_new_ebeln TYPE ebeln,
i_wa_bsoi TYPE bapisditm,
i_wa_bsoix TYPE bapisditmx,
i_wa_bsop TYPE bapiparnr,
i_wa_bsos TYPE bapischdl,
i_wa_bsosx TYPE bapischdlx,
i_wa_vbpa TYPE vbpa,
i_wa_vbkd TYPE vbkd,
i_wa_bpoi TYPE bapimepoitem,
i_wa_bpoix TYPE bapimepoitemx,
i_wa_bpos TYPE bapimeposchedule,
i_wa_bposx TYPE bapimeposchedulx,
i_wa_bpop TYPE bapiekkop,
i_wa_ekpa TYPE ekpa,
i_message TYPE char72,
i_bapiretn TYPE bapiret2,
i_bapiret2 TYPE TABLE OF bapiret2 INITIAL SIZE 1,
i_vbpa TYPE TABLE OF vbpa INITIAL SIZE 1,
i_vbkd TYPE TABLE OF vbkd INITIAL SIZE 1,
i_ekpa TYPE TABLE OF ekpa INITIAL SIZE 1,
i_bsoi TYPE TABLE OF bapisditm INITIAL SIZE 1,
i_bsoix TYPE TABLE OF bapisditmx INITIAL SIZE 1,
i_bsos TYPE TABLE OF bapischdl INITIAL SIZE 1,
i_bsosx TYPE TABLE OF bapischdlx INITIAL SIZE 1,
i_bsop TYPE TABLE OF bapiparnr INITIAL SIZE 1,
i_bpoi TYPE TABLE OF bapimepoitem INITIAL SIZE 1,
i_bpoix TYPE TABLE OF bapimepoitemx INITIAL SIZE 1,
i_bpos TYPE TABLE OF bapimeposchedule INITIAL SIZE 1,
i_bposx TYPE TABLE OF bapimeposchedulx INITIAL SIZE 1,
i_bpop TYPE TABLE OF bapiekkop INITIAL SIZE 1,
i_text_tab TYPE TABLE OF tline INITIAL SIZE 1,
i_line_tab TYPE TABLE OF tline INITIAL SIZE 1,
i_txw_note TYPE TABLE OF txw_note INITIAL SIZE 1,
i_oij_el_doc_mot TYPE oij_el_doc_mot .
CONSTANTS: c_char_c VALUE 'C',
c_char_e VALUE 'E',
c_char_p VALUE 'P',
c_char_g VALUE 'G',
c_char_i VALUE 'I',
c_char_s VALUE 'S',
c_char_x VALUE 'X',
c_zsw(3) VALUE 'ZSW',
c_nomit_stat(4) VALUE 'ZDNY' .
DATA : lv_nomtk_split TYPE oij_nomtk.
DATA : i_order_split_create TYPE TABLE OF zsws_order_split.
DATA : wa_order_split_create TYPE zsws_order_split.
LOOP AT i_order_split_create INTO wa_order_split_create.
IF NOT i_create_order IS INITIAL .
CLEAR: i_create_order .
MOVE: wa_order_split_create-docnr TO i_ebeln,
wa_order_split_create-docitm TO i_ebelp .
CALL FUNCTION 'ME_EKKO_SINGLE_READ'
EXPORTING
pi_ebeln = i_ebeln
IMPORTING
po_ekko = i_ekko
EXCEPTIONS
no_records_found = 1
OTHERS = 2.
IF sy-subrc <> 0 .
ENDIF .
Fill PO Header
i_bpoh-comp_code = i_ekko-bukrs .
i_bpoh-doc_type = i_ekko-bsart .
i_bpoh-vendor = i_ekko-lifnr .
i_bpoh-langu = i_ekko-spras .
i_bpoh-pmnttrms = i_ekko-zterm .
i_bpoh-purch_org = i_ekko-ekorg .
i_bpoh-pur_group = i_ekko-ekgrp .
i_bpoh-currency = i_ekko-waers .
i_bpoh-agreement = i_ekko-konnr .
i_bpoh-incoterms1 = i_ekko-inco1 .
i_bpoh-incoterms2 = i_ekko-inco2 .
Fill PO update indicator 'X'
i_bpohx-comp_code = c_char_x .
i_bpohx-doc_type = c_char_x .
i_bpohx-vendor = c_char_x .
i_bpohx-langu = c_char_x .
i_bpohx-pmnttrms = c_char_x .
i_bpohx-purch_org = c_char_x .
i_bpohx-pur_group = c_char_x .
i_bpohx-currency = c_char_x .
i_bpohx-agreement = c_char_x .
i_bpohx-incoterms1 = c_char_x .
i_bpohx-incoterms2 = c_char_x .
CALL FUNCTION 'ME_EKPO_SINGLE_READ'
EXPORTING
pi_ebeln = i_ebeln
pi_ebelp = i_ebelp
IMPORTING
po_ekpo = i_ekpo
EXCEPTIONS
no_records_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.
ENDIF .
Fill PO Item
i_wa_bpoi-po_item = i_ekpo-ebelp .
i_wa_bpoi-material = i_ekpo-matnr .
i_wa_bpoi-plant = i_ekpo-werks .
i_wa_bpoi-stge_loc = i_ekpo-lgort .
i_wa_bpoi-quantity = wa_order_split_create-qty_acptd .
i_wa_bpoi-po_unit = i_ekpo-meins .
i_wa_bpoi-tax_code = i_ekpo-mwskz .
i_wa_bpoi-val_type = i_ekpo-bwtar .
i_wa_bpoi-item_cat = i_ekpo-pstyp .
i_wa_bpoi-acctasscat = i_ekpo-knttp .
i_wa_bpoi-agreement = i_ekpo-konnr .
i_wa_bpoi-agmt_item = i_ekpo-ktpnr .
APPEND i_wa_bpoi TO i_bpoi .
Fill PO Item update indicator 'X'
i_wa_bpoix-po_item = i_ekpo-ebelp .
i_wa_bpoix-po_itemx = c_char_x .
i_wa_bpoix-material = c_char_x .
i_wa_bpoix-plant = c_char_x .
i_wa_bpoix-stge_loc = c_char_x .
i_wa_bpoix-quantity = c_char_x .
i_wa_bpoix-po_unit = c_char_x .
i_wa_bpoix-tax_code = c_char_x .
i_wa_bpoix-val_type = c_char_x .
i_wa_bpoix-item_cat = c_char_x .
i_wa_bpoix-acctasscat = c_char_x .
i_wa_bpoix-agreement = c_char_x .
i_wa_bpoix-agmt_item = c_char_x .
APPEND i_wa_bpoix TO i_bpoix .
Fill PO Item Schedule
i_wa_bpos-po_item = i_ekpo-ebelp .
i_wa_bpos-sched_line = '0001' .
i_wa_bpos-delivery_date = wa_order_split_create-dly_date .
i_wa_bpos-quantity = wa_order_split_create-qty_acptd .
APPEND i_wa_bpos TO i_bpos .
Fill PO Item schedule update indicator 'X'
i_wa_bposx-po_item = i_ekpo-ebelp .
i_wa_bposx-sched_line = '0001' .
i_wa_bposx-delivery_date = c_char_x .
i_wa_bposx-quantity = c_char_x .
APPEND i_wa_bposx TO i_bposx .
CLEAR: i_pargr .
SELECT SINGLE pargr
INTO i_pargr
FROM t161
WHERE bstyp = i_ekko-bstyp
AND bsart = i_ekko-bsart .
CLEAR i_ekpa[].
CALL FUNCTION 'MM_READ_PARTNERS'
EXPORTING
application = c_char_p
ebeln = i_ebeln
bstyp = i_ekko-bstyp
pargr = i_pargr
TABLES
x_ekpa = <b>i_ekpa[].</b>
LOOP AT i_ekpa INTO i_wa_ekpa .
i_wa_bpop-partnerdesc = i_wa_ekpa-parvw .
i_wa_bpop-langu = sy-langu .
IF NOT i_wa_ekpa-lifn2 IS INITIAL .
i_wa_bpop-buspartno = i_wa_ekpa-lifn2 .
ELSE .
i_wa_bpop-buspartno = i_wa_ekpa-parnr .
ENDIF .
APPEND i_wa_bpop TO i_bpop .
CLEAR: i_wa_ekpa, i_wa_bpop .
ENDLOOP .
CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = i_bpoh
poheaderx = i_bpohx
IMPORTING
exppurchaseorder = i_new_ebeln
TABLES
return = i_bapiret2
<b> poitem = i_bpoi[]
poitemx = i_bpoix[]
poschedule = i_bpos[]
poschedulex = i_bposx[].</b>
it should be only i_bpoi, i_bpoix, i_bpos, i_bposx but not i_bpoi[], i_bpoix[], i_bpos[], i_bposx[].
CHange the code as follows:
DATA: i_insert,
i_create_order,
i_cycle TYPE cycle,
i_qty_acpt TYPE dzmeng,
i_dly_date TYPE vbak-vdatu,
i_item TYPE roijnomiio .
DATA: i_order TYPE symsgv,
i_return TYPE swd_return .
DATA: i_vbak TYPE vbak,
i_vbap TYPE vbap,
i_ekko TYPE ekko,
i_ekpo TYPE ekpo,
i_bsoh TYPE bapisdhd1,
i_bsohx TYPE bapisdhd1x,
i_bpoh TYPE bapimepoheader,
i_bpohx TYPE bapimepoheaderx,
i_vbeln TYPE vbeln_va,
i_posnr TYPE posnr_va,
i_contr TYPE vbeln_va,
i_conit TYPE posnr_va,
i_ebeln TYPE ebeln,
i_ebelp TYPE ebelp,
i_pargr TYPE pargr,
i_thead TYPE thead,
i_line TYPE tline,
i_note TYPE txw_note,
i_new_vbeln TYPE vbeln_va,
i_new_ebeln TYPE ebeln,
i_wa_bsoi TYPE bapisditm,
i_wa_bsoix TYPE bapisditmx,
i_wa_bsop TYPE bapiparnr,
i_wa_bsos TYPE bapischdl,
i_wa_bsosx TYPE bapischdlx,
i_wa_vbpa TYPE vbpa,
i_wa_vbkd TYPE vbkd,
i_wa_bpoi TYPE bapimepoitem,
i_wa_bpoix TYPE bapimepoitemx,
i_wa_bpos TYPE bapimeposchedule,
i_wa_bposx TYPE bapimeposchedulx,
i_wa_bpop TYPE bapiekkop,
i_wa_ekpa TYPE ekpa,
i_message TYPE char72,
i_bapiretn TYPE bapiret2,
i_bapiret2 TYPE TABLE OF bapiret2 INITIAL SIZE 1,
i_vbpa TYPE TABLE OF vbpa INITIAL SIZE 1,
i_vbkd TYPE TABLE OF vbkd INITIAL SIZE 1,
i_ekpa TYPE TABLE OF ekpa INITIAL SIZE 1,
i_bsoi TYPE TABLE OF bapisditm INITIAL SIZE 1,
i_bsoix TYPE TABLE OF bapisditmx INITIAL SIZE 1,
i_bsos TYPE TABLE OF bapischdl INITIAL SIZE 1,
i_bsosx TYPE TABLE OF bapischdlx INITIAL SIZE 1,
i_bsop TYPE TABLE OF bapiparnr INITIAL SIZE 1,
i_bpoi TYPE TABLE OF bapimepoitem INITIAL SIZE 1,
i_bpoix TYPE TABLE OF bapimepoitemx INITIAL SIZE 1,
i_bpos TYPE TABLE OF bapimeposchedule INITIAL SIZE 1,
i_bposx TYPE TABLE OF bapimeposchedulx INITIAL SIZE 1,
i_bpop TYPE TABLE OF bapiekkop INITIAL SIZE 1,
i_text_tab TYPE TABLE OF tline INITIAL SIZE 1,
i_line_tab TYPE TABLE OF tline INITIAL SIZE 1,
i_txw_note TYPE TABLE OF txw_note INITIAL SIZE 1,
i_oij_el_doc_mot TYPE oij_el_doc_mot .
CONSTANTS: c_char_c VALUE 'C',
c_char_e VALUE 'E',
c_char_p VALUE 'P',
c_char_g VALUE 'G',
c_char_i VALUE 'I',
c_char_s VALUE 'S',
c_char_x VALUE 'X',
c_zsw(3) VALUE 'ZSW',
c_nomit_stat(4) VALUE 'ZDNY' .
DATA : lv_nomtk_split TYPE oij_nomtk.
DATA : i_order_split_create TYPE TABLE OF zsws_order_split.
DATA : wa_order_split_create TYPE zsws_order_split.
LOOP AT i_order_split_create INTO wa_order_split_create.
IF NOT i_create_order IS INITIAL .
CLEAR: i_create_order .
MOVE: wa_order_split_create-docnr TO i_ebeln,
wa_order_split_create-docitm TO i_ebelp .
CALL FUNCTION 'ME_EKKO_SINGLE_READ'
EXPORTING
pi_ebeln = i_ebeln
IMPORTING
po_ekko = i_ekko
EXCEPTIONS
no_records_found = 1
OTHERS = 2.
IF sy-subrc <> 0 .
ENDIF .
Fill PO Header
i_bpoh-comp_code = i_ekko-bukrs .
i_bpoh-doc_type = i_ekko-bsart .
i_bpoh-vendor = i_ekko-lifnr .
i_bpoh-langu = i_ekko-spras .
i_bpoh-pmnttrms = i_ekko-zterm .
i_bpoh-purch_org = i_ekko-ekorg .
i_bpoh-pur_group = i_ekko-ekgrp .
i_bpoh-currency = i_ekko-waers .
i_bpoh-agreement = i_ekko-konnr .
i_bpoh-incoterms1 = i_ekko-inco1 .
i_bpoh-incoterms2 = i_ekko-inco2 .
Fill PO update indicator 'X'
i_bpohx-comp_code = c_char_x .
i_bpohx-doc_type = c_char_x .
i_bpohx-vendor = c_char_x .
i_bpohx-langu = c_char_x .
i_bpohx-pmnttrms = c_char_x .
i_bpohx-purch_org = c_char_x .
i_bpohx-pur_group = c_char_x .
i_bpohx-currency = c_char_x .
i_bpohx-agreement = c_char_x .
i_bpohx-incoterms1 = c_char_x .
i_bpohx-incoterms2 = c_char_x .
CALL FUNCTION 'ME_EKPO_SINGLE_READ'
EXPORTING
pi_ebeln = i_ebeln
pi_ebelp = i_ebelp
IMPORTING
po_ekpo = i_ekpo
EXCEPTIONS
no_records_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.
ENDIF .
Fill PO Item
i_wa_bpoi-po_item = i_ekpo-ebelp .
i_wa_bpoi-material = i_ekpo-matnr .
i_wa_bpoi-plant = i_ekpo-werks .
i_wa_bpoi-stge_loc = i_ekpo-lgort .
i_wa_bpoi-quantity = wa_order_split_create-qty_acptd .
i_wa_bpoi-po_unit = i_ekpo-meins .
i_wa_bpoi-tax_code = i_ekpo-mwskz .
i_wa_bpoi-val_type = i_ekpo-bwtar .
i_wa_bpoi-item_cat = i_ekpo-pstyp .
i_wa_bpoi-acctasscat = i_ekpo-knttp .
i_wa_bpoi-agreement = i_ekpo-konnr .
i_wa_bpoi-agmt_item = i_ekpo-ktpnr .
APPEND i_wa_bpoi TO i_bpoi .
Fill PO Item update indicator 'X'
i_wa_bpoix-po_item = i_ekpo-ebelp .
i_wa_bpoix-po_itemx = c_char_x .
i_wa_bpoix-material = c_char_x .
i_wa_bpoix-plant = c_char_x .
i_wa_bpoix-stge_loc = c_char_x .
i_wa_bpoix-quantity = c_char_x .
i_wa_bpoix-po_unit = c_char_x .
i_wa_bpoix-tax_code = c_char_x .
i_wa_bpoix-val_type = c_char_x .
i_wa_bpoix-item_cat = c_char_x .
i_wa_bpoix-acctasscat = c_char_x .
i_wa_bpoix-agreement = c_char_x .
i_wa_bpoix-agmt_item = c_char_x .
APPEND i_wa_bpoix TO i_bpoix .
Fill PO Item Schedule
i_wa_bpos-po_item = i_ekpo-ebelp .
i_wa_bpos-sched_line = '0001' .
i_wa_bpos-delivery_date = wa_order_split_create-dly_date .
i_wa_bpos-quantity = wa_order_split_create-qty_acptd .
APPEND i_wa_bpos TO i_bpos .
Fill PO Item schedule update indicator 'X'
i_wa_bposx-po_item = i_ekpo-ebelp .
i_wa_bposx-sched_line = '0001' .
i_wa_bposx-delivery_date = c_char_x .
i_wa_bposx-quantity = c_char_x .
APPEND i_wa_bposx TO i_bposx .
CLEAR: i_pargr .
SELECT SINGLE pargr
INTO i_pargr
FROM t161
WHERE bstyp = i_ekko-bstyp
AND bsart = i_ekko-bsart .
CLEAR i_ekpa[].
CALL FUNCTION 'MM_READ_PARTNERS'
EXPORTING
application = c_char_p
ebeln = i_ebeln
bstyp = i_ekko-bstyp
pargr = i_pargr
TABLES
x_ekpa = i_ekpa.
LOOP AT i_ekpa INTO i_wa_ekpa .
i_wa_bpop-partnerdesc = i_wa_ekpa-parvw .
i_wa_bpop-langu = sy-langu .
IF NOT i_wa_ekpa-lifn2 IS INITIAL .
i_wa_bpop-buspartno = i_wa_ekpa-lifn2 .
ELSE .
i_wa_bpop-buspartno = i_wa_ekpa-parnr .
ENDIF .
APPEND i_wa_bpop TO i_bpop .
CLEAR: i_wa_ekpa, i_wa_bpop .
ENDLOOP .
CALL FUNCTION 'DIALOG_SET_NO_DIALOG'.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
poheader = i_bpoh
poheaderx = i_bpohx
IMPORTING
exppurchaseorder = i_new_ebeln
TABLES
return = i_bapiret2
poitem = i_bpoi
poitemx = i_bpoix
poschedule = i_bpos
poschedulex = i_bposx.
i_order = i_new_ebeln .
SHIFT i_order LEFT DELETING LEADING '0' .
i_return-errortype = c_char_i .
i_return-workarea = c_zsw .
i_return-message = '064' .
i_return-variable1 = i_order .
loop at i_bapiret2 into i_bapiretn where type ca 'EAX' .
append i_bapiretn to t_bapi_return .
endloop .
if t_bapi_return[] is initial .
i_create_order = c_char_x .
CALL FUNCTION 'SWD_POPUP_MESSAGE_SEND'
EXPORTING
act_return = i_return. "Popup with new PO no.
ENDCASE . " Docind
ENDIF .
ENDLOOP.
Maybe you are looking for
-
Payment Card in SD - Unable to unpack to reduce quantity on delivery
Hi, We are implementing the payment card functionality and has the below issue. Say the order is authorized for $ 1, and it is going to authorize at the delivery stage. Say the order is for 100 and the allocation was done for 100 PCS. The delivery ne
-
Hello everyone, I have a question, how to use the keyword exit? I want to add something in F1. Thank you very much! Edited by: li zhu on Nov 7, 2008 10:35 AM
-
Where do I put a new module?
I am installing wireless networking on an Asus P5B Deluxe WiFi motherboard. It uses a realtek 8187L. I got the linux driver off of the realtek site and built it; now I have a file named r8187.ko. Where do I put it so I can use it at boot?
-
I'm trying to download some application from App Store I'm abroad now using wifi but it's not going through I have a message saying that I have to switch to uk store before purchase what to do to solve the problems..
-
Hi questions on ejb??????
hi everybody.... can you give my questions answers......................... if we write abstract class in case of home and object interface? and all the methods needed put in the Abstract class is the ejb code is working..... if yes...so why.... if n