on 01-22-2010 7:54 AM
Hi all,
I am creating a sales order Using Interactive forms. In the form i am having Header data and line item data.I had created two structures one for Header data and one for Line item data. For entering the LINE ITEM DATA i had created a Dynamic table with Buttons ADD ROW and DELETE ROW.
User will Add the Row or Delete the Row based on the requirement.
My issue is When ever the user clicks the SUBMIT button after entering the header data and 3 line items data , Sales order has been created with only first line item and the remaining two line items are not created.
My Interactive form is like below
-
HEADER DATA
-
DOC_TYPE
SALES_ORG
DIST_CHN
DIVISION
PURCH_NO
PARTN_ROLE
PART_NO
-
LINE ITEM DATA
-
ITEM_NO MATERIAL PLANT QTY COND_TYPE COND_VALUE
ADD ROW
DELETE ROW
-
SUBMIT
My code for the method ONACTIONCLICK is like below
method ONACTIONCLICK .
data:
Node_Adobe type ref to If_Wd_Context_Node,
Node_Zsaleheader type ref to If_Wd_Context_Node,
Elem_Zsaleheader type ref to If_Wd_Context_Element,
Stru_Zsaleheader type If_Main=>Element_Zsaleheader,
Node_Zsaleitem type ref to If_Wd_Context_Node,
Elem_Zsaleitem type ref to If_Wd_Context_Element,
Stru_Zsaleitem type If_Main=>Element_Zsaleitem.
data: header_data type BAPISDHEAD.
data: item_wa type BAPIITEMIN.
data: item_data type table of BAPIITEMIN.
data: partner_wa type BAPIPARTNR.
data: partner_data type table of BAPIPARTNR.
data: sales_order type BAPIVBELN-VBELN.
data: Errorlog type BAPIRETURN1.
navigate from <CONTEXT> to <ADOBE> via lead selection
Node_Adobe = wd_Context->get_Child_Node( Name = IF_MAIN=>wdctx_Adobe ).
navigate from <ADOBE> to <Zsaleheader> via lead selection
Node_Zsaleheader = Node_Adobe->get_Child_Node( Name = IF_MAIN=>wdctx_Zsaleheader ).
Node_Zsaleitem = Node_Adobe->get_Child_Node( Name = IF_MAIN=>wdctx_Zsaleitem ).
get element via lead selection
Elem_Zsaleheader = Node_Zsaleheader->get_Element( ).
Elem_Zsaleitem = Node_Zsaleitem->get_Element( ).
get all declared attributes
Elem_Zsaleheader->get_Static_Attributes(
importing
Static_Attributes = Stru_Zsaleheader ).
header_data-DOC_TYPE = Stru_Zsaleheader-DOC_TYPE.
header_data-SALES_ORG = Stru_Zsaleheader-SALES_ORG.
header_data-DISTR_CHAN = Stru_Zsaleheader-DISTR_CHAN.
header_data-DIVISION = Stru_Zsaleheader-DIVISION.
header_data-PURCH_NO = Stru_Zsaleheader-PURCH_NO.
partner_wa-PARTN_ROLE = Stru_Zsaleheader-PARTN_ROLE.
partner_wa-PARTN_NUMB = Stru_Zsaleheader-PARTN_NUMB.
append partner_wa to partner_data.
Elem_Zsaleitem->get_Static_Attributes(
importing
Static_Attributes = Stru_Zsaleitem ).
item_wa-ITM_NUMBER = Stru_Zsaleitem-ITM_NUMBER.
item_wa-MATERIAL = Stru_Zsaleitem-MATERIAL.
item_wa-PLANT = Stru_Zsaleitem-PLANT.
item_wa-REQ_QTY = Stru_Zsaleitem-REQ_QTY.
item_wa-COND_TYPE = Stru_Zsaleitem-COND_TYPE.
item_wa-COND_VALUE = Stru_Zsaleitem-COND_VALUE.
append item_wa to item_data.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT1'
EXPORTING
ORDER_HEADER_IN = header_data
WITHOUT_COMMIT = ' '
CONVERT_PARVW_AUART = ' '
IMPORTING
SALESDOCUMENT = sales_order
SOLD_TO_PARTY =
SHIP_TO_PARTY =
BILLING_PARTY =
RETURN = errorlog
TABLES
ORDER_ITEMS_IN = item_data
ORDER_PARTNERS = partner_data
ORDER_ITEMS_OUT =
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CCARD =
ORDER_CFGS_BLOB =
ORDER_SCHEDULE_EX =
.
endmethod.
PLEASE SUGGEST ME IF ANY CODE CHANGE IS REQUIRED
Thanks in advance
Ajay
Hi,
The item data is not read because, the dynamically added rows should also reflect back to the Web Dynpro context. When the user clicks on Add Row, use the Onsubmit event to add a empty line to internal table and then bind it to the context. And if the user removes a row, remove a row from internal table and bind it back to the context.
You may refer this article.
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/802f0ed1-a17a-2c10-7db4-d515a5b047ed
Regards,
Runal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hai Runal,
I had done the same suggested by you in your article,
but system is showing syntax error at
DATA LS_ZDYN_TBL_FORM TYPE WD_THIS->ELEMENT_ZDYN_TBL_FORM.
I am not able to understand your declarations also
Requesting you to please send or update the screenshot of the CONTEXT tab
Thanks
Ajay
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.