‎2010 Feb 24 12:35 PM
Hi all,
I am creating sales order using FM IDOC_INPUT_ORDERS with Inbound IDoc using WE19.
But I am unable to copy storage location and quantity to sales order.
I have written code in EXIT_SAPLVEDA_001 as below:
WHEN 'E1EDP01'.
x_E1EDP01 = segment-sdata.
xvbap-ZMENG = x_E1EDP01-MENGE.
xvbap-lgort = x_E1EDP01-LGORT.
Move-Corresponding xvbap to dxvbap.
But still I am unable to see the lgort and quantity in the sales order.
Am I missing something?
Thanks,
~Sachin
‎2010 Feb 24 7:49 PM
‎2010 Feb 25 4:53 AM
Hi Sachin,
I also faced the same problem earlier regarding populating storage location through IDoc. Please follow below mentioned points for the resolution of your problem :
1. The customer exit which you are using won't satisfy your requirement (coz it is not having DXBDCDATA parameter). So, use EXIT_SAPLVEDA_002 which is having 'ZXVEDU04' include.
2. Now write BDC program in that include and inserting the BDCDATA table at appropriate indexes. Since this BDCDATA table is being used by standard program (which is using BDC call transaction method), inserting your BDCDATA table at appropriate indexes will solve your problem and when you will run the Idoc having LGORT field value in we19 storage location will get posted in sales order.
Please see the below mentioned code for your reference.
LOOP AT dxbdcdata WHERE fnam = 'BDC_OKCODE' AND fval = 'SICH'.
CLEAR: l_flagselkz.
DELETE dxbdcdata WHERE fnam CS 'RV45A-VBAP_SELKZ'.
IF l_flagselkz IS INITIAL.
CLEAR: v_sytabix,
l_lineitem,
wa_didoc_data-segnum.
LOOP AT dxbdcdata FROM v_sytabix WHERE fnam CS 'VBAP-MATNR'.
v_sytabix = sy-tabix.
LOOP AT didoc_data FROM wa_didoc_data-segnum WHERE segnam = 'E1EDP01' AND segnum > wa_didoc_data-segnum.
IF ( wa_didoc_data-segnum NE didoc_data-segnum ).
wa_didoc_data-segnum = didoc_data-segnum.
CLEAR wa_e1edp01.
MOVE didoc_data-sdata TO wa_e1edp01.
l_lineitem = l_lineitem + 1.
LOOP AT dxbdcdata FROM v_sytabix WHERE fnam = 'BDC_OKCODE'.
v_sytabix = sy-tabix.
PERFORM bdc_dynpro IN PROGRAM ysdu_sbrtn_insalesord USING c_sapmv45a c_4001
CHANGING dxbdcdata.
INSERT dxbdcdata INTO dxbdcdata INDEX v_sytabix.
CLEAR: dxbdcdata.
v_sytabix = v_sytabix + 1.
CLEAR: l_field.
CONCATENATE 'RV45A-VBAP_SELKZ' '(' l_lineitem ')' INTO l_field.
PERFORM bdc_field IN PROGRAM ysdu_sbrtn_insalesord USING l_field
c_x
CHANGING dxbdcdata.
INSERT dxbdcdata INTO dxbdcdata INDEX v_sytabix.
CLEAR: dxbdcdata.
v_sytabix = v_sytabix + 1.
EXIT.
ENDLOOP.
PERFORM f_storage_loc TABLES dxbdcdata
USING wa_e1edp01-lgort
CHANGING v_sytabix.
ENDIF.
EXIT.
ENDLOOP.
ENDLOOP.
ENDIF.
ENDLOOP.
FORM F_STORAGE_LOC TABLES dxbdcdata STRUCTURE bdcdata
USING wa_e1edp01-LGORT
CHANGING v_sytabix.
if wa_e1edp01-LGORT is not initial.
"BDC OK CODE - schedule lines tab
PERFORM bdc_field IN PROGRAM ysdu_sbrtn_insalesord USING c_okcode
c_t07 "PEIN
CHANGING dxbdcdata.
INSERT dxbdcdata INTO dxbdcdata INDEX v_sytabix.
CLEAR: dxbdcdata.
v_sytabix = v_sytabix + 1.
"Screen
PERFORM bdc_dynpro IN PROGRAM ysdu_sbrtn_insalesord USING c_sapmv45a
c_4003
CHANGING dxbdcdata.
INSERT dxbdcdata INTO dxbdcdata INDEX v_sytabix.
CLEAR: dxbdcdata.
v_sytabix = v_sytabix + 1.
PERFORM bdc_field IN PROGRAM ysdu_sbrtn_insalesord USING c_okcode
'T\03'
CHANGING dxbdcdata.
INSERT dxbdcdata INTO dxbdcdata INDEX v_sytabix.
CLEAR: dxbdcdata.
v_sytabix = v_sytabix + 1.
PERFORM bdc_dynpro IN PROGRAM ysdu_sbrtn_insalesord USING c_sapmv45a
c_4003
CHANGING dxbdcdata.
INSERT dxbdcdata INTO dxbdcdata INDEX v_sytabix.
CLEAR: dxbdcdata.
v_sytabix = v_sytabix + 1.
"field for storage location
clear l_field.
l_field = 'VBAP-LGORT'.
PERFORM bdc_field IN PROGRAM ysdu_sbrtn_insalesord USING l_field
wa_e1edp01-LGORT
CHANGING dxbdcdata.
INSERT dxbdcdata INTO dxbdcdata INDEX v_sytabix.
CLEAR: dxbdcdata.
v_sytabix = v_sytabix + 1.
endif.
ENDFORM.
Similarly you can do it for 'MENGE' field as well.
Hope this will solve your problem. Please let me know if you have some doubts.
Cheers
VJ
Edited by: Vishal Jindal on Feb 25, 2010 5:56 AM
‎2010 Feb 25 7:57 PM
Hi Sachin Dandekar
Try with this code:
WHEN 'E1EDP01'.
x_E1EDP01 = segment-sdata.
READ TABLE dxvbap INTO xvbap WITH KEY posnr = x_E1EDP01-POSEX.
lv_index = sy-tabix.
xvbap-ZMENG = x_E1EDP01-MENGE.
xvbap-lgort = x_E1EDP01-LGORT.
MODIFY dxvbap INDEX lv_index FROM xvbap.
Data: lv_index TYPE i .
Thanks
Ramesh
‎2025 Aug 26 9:36 PM
‎2010 Mar 01 9:49 AM
Hi Ramesh,
Thanks for ur inputs.
I got ur logic and seems useful but But I am getting zero entries in table dxvbap in this user exit all the time so I can not read this table as it has no entires.
Can you tell any other option / user exit?
Thanks,
~Sachin
‎2010 Mar 01 10:11 AM
Hi Sachin,
Did you try with the customer exit EXIT_SAPLVEDA_002 which is having 'ZXVEDU04' include as I mentioned in my previous post?. I used the same exit and my program is working fine since I also had exactly same requirement.
CLEAR: v_sytabix,
l_lineitem,
wa_didoc_data-segnum.
LOOP AT dxbdcdata WHERE fnam = 'BDC_OKCODE' AND
fval = 'SICH'.
CLEAR: l_flagselkz.
DELETE dxbdcdata WHERE fnam CS 'RV45A-VBAP_SELKZ'.
IF l_flagselkz IS INITIAL.
CLEAR: v_sytabix,
l_lineitem,
wa_didoc_data-segnum.
LOOP AT dxbdcdata FROM v_sytabix WHERE fnam CS 'VBAP-MATNR'.
v_sytabix = sy-tabix.
LOOP AT didoc_data FROM wa_didoc_data-segnum WHERE segnam = 'E1EDP01' AND segnum > wa_didoc_data-segnum.
IF ( wa_didoc_data-segnum NE didoc_data-segnum ).
wa_didoc_data-segnum = didoc_data-segnum.
CLEAR wa_e1edp01.
MOVE didoc_data-sdata TO wa_e1edp01.
l_lineitem = l_lineitem + 1.
LOOP AT dxbdcdata FROM v_sytabix WHERE fnam = 'BDC_OKCODE'.
* fval = 'UER2'.
v_sytabix = sy-tabix.
* IF wa_E1EDP01-LGORT IS NOT INITIAL.
PERFORM bdc_dynpro IN PROGRAM ysdu_sbrtn_insalesord USING c_sapmv45a
c_4001
CHANGING dxbdcdata.
INSERT dxbdcdata INTO dxbdcdata INDEX v_sytabix.
CLEAR: dxbdcdata.
v_sytabix = v_sytabix + 1.
CLEAR: l_field.
CONCATENATE 'RV45A-VBAP_SELKZ' '(' l_lineitem ')' INTO l_field.
PERFORM bdc_field IN PROGRAM ysdu_sbrtn_insalesord USING l_field
c_x
CHANGING dxbdcdata.
INSERT dxbdcdata INTO dxbdcdata INDEX v_sytabix.
CLEAR: dxbdcdata.
v_sytabix = v_sytabix + 1.
* ENDIF.
EXIT.
ENDLOOP.
PERFORM f_storage_loc TABLES dxbdcdata
USING wa_e1edp01-lgort
CHANGING v_sytabix.
ENDIF.
EXIT. " M007
ENDLOOP.
* EXIT.
ENDLOOP.
ENDIF.
ENDLOOP.
Please let me know if you have some doubts.
Cheers
VJ
Edited by: Vishal Jindal on Mar 1, 2010 11:16 AM
‎2010 Mar 18 6:57 AM
‎2010 May 10 11:35 AM
Hi Sachin,
Could you explain how the issue is solved please? We have the same requirement.
Based on Vishal's post above, I tried to use exit EXIT_SAPLVEDA_002 (include 'ZXVEDU04') by setting a breakpoint but the system doesn't stop in the exit; looks like it doesn't come into play during inbound processing for creating a sales order.
Regards,
KC
‎2012 Oct 23 2:42 PM
Hi
I also had the same problem today but have a slight different solution (and one I think is simpler and neater). I also had the problem that the Shipping Tab screen was not being triggered for the Sales Order Item so could not check for that screen in the exit EXIT_SAPLVEDA_00.
You need to set the flag 'X' on the DD_FLAG_P-DPE2 field, this triggers the building of the Shipping Tab screen later on in the code.
You also need to move the Storage Location from the Idoc Line item segment E1EDP01-LGORT to the XVDAP-LGORT field.
By doing so, eliminates the need to build the additional screen elements and I think is safer.
I used exit EXIT_SAPLVEDA_009 (include ZXVEDU11).
Here is the code:
*&---------------------------------------------------------------------*
*& Include ZXVEDU11
*&---------------------------------------------------------------------*
* Enhancement to pass the storage location (on the line item) to the
* Sales Order Shipping Tab (on the line item). Standard SAP does not populate
* this field.
* There are two parts to this enhancement:
* 1) Set the PDE2 flag so the that the Shipping Tab screen is triggered
* 2) Transfer the Storage Location LGORT from the IDOC to the XVBAP structure
*
*&---------------------------------------------------------------------*
data: ls_e1edp01 type e1edp01,
lv_index type syindex,
lv_field type ecm_tabfld,
lv_field2 type ecm_tabfld,
ls_dd_flag_p type ref to data,
ls_xvbap type ref to data.
field-symbols: <lfs_dd_flag_p> type any,
<lfs_xvbap> type any,
<lfs_field> type any.
* Create data structures for the Flag structure
* Referencing the structure as they are not defined in the dictionary
create data ls_dd_flag_p like line of dd_flag_p.
assign ls_dd_flag_p->* to <lfs_dd_flag_p>.
* Create data structures for the Item structure
* Referencing the structure as although they are not defined in the dictionary
* If you look in include LVEDACOM the DXVBAP structure it includes the VBAP structure
* but has appended extra fields as well. If you just define your struture as VBAP
* you will loose these fields and end up with an incomplete Sales Order.
create data ls_xvbap like line of dxvbap.
assign ls_xvbap->* to <lfs_xvbap>.
clear lv_index.
* Loop at the Idoc items
loop at dedidd where segnam = 'E1EDP01'.
add 1 to lv_index.
* Transfer the E1EDP01 data to the segment
ls_e1edp01 = dedidd-sdata.
if not ls_e1edp01-lgort is initial.
" assumes the DXVBAP & DD_FLAG_P entries are in the same order as the Idoc
read table dxvbap index lv_index into <lfs_xvbap>. if sy-subrc = 0.
lv_field = '<LFS_XVBAP>-LGORT'.
assign (lv_field) to <lfs_field>.
<lfs_field> = ls_e1edp01-lgort.
modify dxvbap from <lfs_xvbap> index lv_index.
read table dd_flag_p index lv_index into <lfs_dd_flag_p>.
if sy-subrc = 0.
* Set the flag to for the Shipping Screen
lv_field = '<LFS_DD_FLAG_P>-PDE2'.
assign (lv_field) to <lfs_field>.
<lfs_field> = 'X'.
modify dd_flag_p from <lfs_dd_flag_p> index lv_index.
endif.
endif.
endif.
endloop.
Regards
Adam Goodsell
‎2022 Aug 09 9:48 PM