Compare sales order items (specific fields)
Hi guys,
I need to compare some fields from vbap and vbkd and to add values from sales order items, before I print then on screen.
I need to compare if vbkd-ihrez_e and vbkd-bstkd and vbap-matnr are the same for two records from sales order (10 and 20), If they are the same then add vbkd-ihrez values (for items 10 and 20), also add vbap-kwmeng, and write that sum on screen.
Compare item with previous one. if doing for 20 compare with 10, for item 30 compare with 20 etc.
I start like this.
select aubel posnr into (wa_tab-vbeln, wa_tab-posnr)
from vbrp
where vbeln = p_vbeln.
append wa_tab to it_tab.
endselect.
loop at it_tab into wa_tab. << I need somewhere to compare fields if they are the same before I print them.
select single fbuda bstkd_e ihrez_e ihrez bstkd
into
(wa_tab-fbuda,
wa_tab-bstkd_e,
wa_tab-ihrez_e,
wa_tab-ihrez,
wa_tab-bstkd)
from vbkd
where vbeln = wa_tab-vbeln and
posnr = wa_tab-posnr.
select single kbmeng waerk netwr arktx kwmeng
into
(wa_tab-kbmeng,
wa_tab-waerk,
wa_tab-netwr,
wa_tab-arktx,
wa_tab-kwmeng)
from vbap
where vbeln = wa_tab-vbeln and
posnr = wa_tab-posnr.
modify it_tab from wa_tab.
endloop.
How can I modify code to get this process? Thanks,
Edited by: nihad omerbegovic on Nov 2, 2009 9:45 AM
Hi Nihad
select aubel posnr into CORRESPONDING FIELDS OF TABLE it_tab
from vbrp
where vbeln EQ p_vbeln.
select a~vbeln a~posnr a~fbuda a~bstkd_e a~ihrez_e a~ihrez a~bstkd
b~kbmeng b~waerk b~netwr b~arktx b~kwmeng
into CORRESPONDING FIELDS OF TABLE it_vb
from vbkd as a INNER JOIN vbap as b ON a~vbeln EQ b~vbeln AND a~posnr EQ b~posnr
FOR ALL ENTRIES IN it_tab
where vbeln EQ it_tan-vbeln and
posnr EQ it_tab-posnr.
SORT it_tab BY vbeln posnr.
LOOP AT it_tab INTO wa_tab.
IF lv_vbeln EQ wa_tab-vbeln. "means it's the same order but a different item
IF ( lv_ihrez_e = wa_tab-ihrez_e ) AND ( lv_bstkd = wa_tab-bstkd ) AND ( lv_matnr = wa_tab-matnr ).
ADD wa_tab-kwmeng TO lv_kwmeng.
WRITE lv_kwmeng.
ENDIF.
CLEAR lv_kwmeng.
lv_ihrez_e = wa_tab-ihrez_e.
lv_bstkd = wa_tab-bstkd.
lv_matnr = wa_tab-matnr.
lv_vbeln = wa_tab-vbeln.
lv_kwmeng = wa_tab-kwmeng.
endloop.
Thanks
Pushpraj
Similar Messages
-
Sale Order Item : Custom Field : Table Control
I have added two fields to sale order item table control in program SAPMV45A screen no . 4900. Now the field which i have added are working fine while creating sale order but while changing those fields are not changing.
condition is like this: the custom field are automatically filled by some logic and if the user want to change those field he will able to do. Now 1st condition is fine and when i change those field they will show the previous saved value inspite of changed value.
I have also added those field in additional data b tab in screen 8459 , there they are working fine but here the problem remains the same.Hi,
u can use BAPI_SALESORDER_CHANGE to update the values of those fields. for that u need to extend few tables and coding that u can get from the BAPI documentation. If not getting reply back. i can help u..
regards,
pavan. -
Lean Order OIF application - Sales Order - Item Overview - field Article
Hi colleagues,
my problem is that I do not find the view where the field Article(material) is located. The F1 technical details of the screen says the component and view are
appl LO_OIF_MAIN_APP
Web Dynpro Component: FPM_LIST_UIBB
View Information: V_LIST
but this view V_LIST is a configurable list UIBB (I do not know much about it) and it does not contains the fields in Item Overview subscreen.
I need to know that view because I have to change the field attributes for field Article.
By the way someone knows what view is this? or any tips to find it?
regards,Hi,
Right click on the field and select->Technical settings->you can find the component configuration under current view section. Navigate to configuration and you can choose field and click on attributes button on menu. there you can change values. else find feeder class in general settings. Go to feeder class and method "Get_Definition". here also you can change attributes.
Regards,
Jaipal -
Sale Order Item Quantity Not Populating When Create A Sale Order Using BAPI
I am having a problem when creating a sale order using BAPI
BAPI_SALESORDER_CREATEFROMDAT2
Problem is that sale order item quantity field is not populating
code is as follows
ORDER_ITEMS_IN-ITM_NUMBER = '0010'.
ORDER_ITEMS_IN-MATERIAL = '000000000010000262'.
ORDER_ITEMS_IN-TARGET_QU = 'LB'.
ORDER_ITEMS_IN-TARGET_QTY = 1.Hi,
Try populating ORDER_SCHEDULES_IN table in the bapi field REQ_QTY.
Regds,
Rudra -
/DSD/SL_COCKPIT - Change the Reference in the sales order items
The requirement is to set each sales order items reference field (IHREZ) to a derived value when generating the settlement document. i want to know if anyone has done something like this before and what would be the best way of going about it?
Thanks for the replies.
@ A.L.V Ramana,
Yes they all have confirmed qty. The one thing I noticed is that only the first item is being saved to table VBBE from which MD04 is getting sa sales documents. Is there any condition that must be met in order for this table to be filled except that if the item has reason for rejection or does not have confirmed qty?
@ Anirudh.vb
Thanks for the suggestion but the users wants a real time update on MD04.
Best regards,
Andre -
Hi,
I need to add a few attributes to 0S_ORD_ITEM (Sales order item). I have 2 sales order item status fields I want to add as attributes. Has anyone done this? If so, what is used as the data source?
Thanks for your help.
AaronHi Aaron,
well as Kristian already mentioned, this is not a very good idea. If you really need to do it you also have to compound 0s_ord_item by the document number and you need to create your own datasource for it and populate the status in the user exit. But: isn't it possible for you to add the status fields to the transactional data, is it? This might be the better approach. Another approach might be to create a ods which contains the document number, the item and the status fields and create a multiprovider on this new ods and your cube.
Siggi -
Sale Order Item Level Text Field which table and field
Hi,
Thanks for your prompt reply and best solution.
Can you please tell me one more thing, in sale order at item level the TEXT Field maintaining by user at transaction level now they want that field in one of the report, so can you please tell what is the table and field where i will get this sale order item level text details.Hello,
is this going to work for item level text as well.
can you tell how to proceed with this functional module
or is there any other thing required.Please elaborate to
understand better way.
You can check out two table in respect to Sales TEXT i.e. STXH (STXD SAPscript text file header) and STXL(SAPscript text file lines).
The best approach of tracing out the Text in respect to Sales Order would be to use the Function module READ_TEXT and put this FM in SE37 and execute with the following parameter.
Client
Text ID of text to be read
Language of text to be read
Name of text to be read
Object of text to be read
Archive handle
Text catalog local
When you are essentially looking to read item level Text with respect to Sales Order then your Text OBject would be VBBP.
Regards,
Sarthak -
Sales Order: Item Field Layout
I would like to change the order in which fields of Sales Order Item display in. Basically move some fields forward so client does not need to scroll so far to right to maintain for example Order number. Is there a place in config where you can control the sequencing of fields for the Order line items?
You can create the screen variant as mentioned , using SHD0. Activate the variant.
If you do not want to display the changes for all transactions , then without activating the variant, assign it to the order type which you want these changes to be displayed. For example for OR order type. Assign the variant in Order type configuration (VOV8 T Code) > Transaction flow > Variant .
Regards
Sai -
Process to populate the new field added by AET in Sales Order item
Hi
We are on CRM 7.0 , EP1.
I have added a new field in Sales order item view (UI comp : BT115IT_SLSO , View :Items).
The field is called MTO (made to order), it should be populated based on settings in material master.
I would like to know how can I populate this field with custom logic.
Thanks
SwapnilDear Swapnil,
You can use the following steps to set the default value in field Made To Order:
1. Enhance Component BT115IT_SLSO and View Items
2. Redefine method DO_PREPARE_OUTPUT method of the View Controller Class and implement the following sample code:
super->do_prepare_output( ).
if iv_first_time = abap_true.
lr_ent->set_property_as_string( iv_attr_name = 'ZXXX' " Attribute Name
iv_value = 'YYYY' ) " Value to be set
endif.
This will make sure that the logic to set the value in this field is called only once and not after every event.
You might not like to redefine the Getter and Setter method because these methods will be triggered after each event in that view.
Hope this helps.
Thanks
Vishal -
Create additional field in sales order item and copy to purchase order item
Dear SAP Gurus,
I am hoping that someone could help me by providing me with how to implement the following 2 requirements in the SD order and in the purchase order.
1. I am wanting to add a custom field to the SD sales order item copying a value from the vendor customer master.
2. I then want to add a custom field to the purchase order item and copy the value from my custom field in 1. to this new custom field..
Can you please advise how I would go about implementing the above requirements? I am assuming that there are exits to allow me to implement these 2 requirements.
Many thanks
HenryHi,
For the first requirement you can use the USEREXIT_MOVE_FIELD_TO_VBAP in report MV45AFZZ.
For the second, as I think that you will create a RFQ you can try to use the enhancement MEREQ001.
Regards,
Eduardo -
How to add three fields in Sales order item level and supress/hide many
Hi Gurus,
My client requirement is :
1. Three fields to be added at Sales order Item level and they should flow till billing.
2. Supress/hide most of the fields in Sales order, so that end user will be happy( thru SHDO how to do)
Please share your experiences and help me.
BEST REGARDS
SrikanthHi Subba Rao
in VA01 screen - Material /qty/ after entering this client wants to enter three more details say X/Y/Z
and after that he dont want to see maximum fields displayed in VA01 Screen.
I think it makes sense.
Regards
Srikanth -
Sales Employee mandatory field in sales order item level
Hi all
I want to do SALES Employee mandatory on sales doc. item level, once i have gone through customization i did it check BOX on but once i save there where no effect, that check BOX still blank
please provide me how i should do it
Regards,
Abhijeethi Cong,
i earlier i unable to save due to VE and PE confusing partner function but now i have to save the setting means check BOX marked but still there where not effect.
Again i want to tell you the requirement i have to do Mandatory Partner function (Sales Employee) on sales order item level,may be that will be PE or VE i m not sure....
Management want to track like who is the owner of this business at the per item level for incentives purpose and after that marketing team can analyze the incentive or commission by the end of the every months from early this practice is going on but every sales order or every line item every time user not used to fill sales employee so that i have to do Mandatory, If any user creating sales order and if in sales order there end of line item means 2-3- 5-10-50...so on....may be every item has different sales employee and all has to be complete or els sales order should be pending or sales order not going to save...
I hope u understand the requirement and pls provide me solution
Regards,
Abhijeet -
Changes to sales order item not reflected if Call Transaction is used
I m updating another Sales Order item quantity and reason for rejection programmatically from another sales order.
The code is working fine and the quantity does get changed as well as the reason for rejection flag get set (if required). But if I go to the change log from the menu in VA02 for the order item which has been changed. It does not record the changes.
I have tried using both BDC call transaction method as well as BAPI_SALESORDER_CHANGE in neither case the change log for the order which has been changed reflects the programmatically made changes?
What m I doing wrong. Here is the code.
IF v_update_order_flg = 'X'.
REFRESH t_bdcdata.
CLEAR s_bdcdata.
REFRESH t_messtab.
PERFORM bdc_dynpro USING 'SAPMV45A' '0102'.
PERFORM bdc_field USING 'VBAK-VBELN' <wa_r_rtb_posnrs>-zrtbvbeln.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.
For Going to specific Item Number
LOOP AT t_schedule_lines.
PERFORM bdc_field USING 'BDC_OKCODE' '=POPO'.
READ TABLE t_item_in WITH KEY itm_number = t_schedule_lines-itm_number.
PERFORM bdc_dynpro USING 'SAPMV45A' '0251'.
PERFORM bdc_field USING 'RV45A-POSNR' t_schedule_lines-itm_number.
PERFORM bdc_field USING 'BDC_OKCODE' '=POSI'.
PERFORM bdc_dynpro USING 'SAPMV45A' '4001'.
v_ro_qty = t_schedule_lines-req_qty.
CONDENSE v_ro_qty.
PERFORM bdc_field USING 'RV45A-KWMENG(01)' v_ro_qty.
PERFORM bdc_field USING 'VBAP-ABGRU(01)' t_item_in-reason_rej.
ENDLOOP.
PERFORM bdc_field USING 'BDC_OKCODE' '=SICH'.
v_call_transaction_flg = 'X'.
EXPORT v_call_transaction_flg TO MEMORY ID 'call_transaction'.
CALL TRANSACTION 'VA02'
USING t_bdcdata
UPDATE 'S'
MODE 'N'
MESSAGES INTO t_messtab.
v_call_transaction_flg = space.
FREE MEMORY ID 'call_transaction'.Hi Srikrisna,
This is a typical problem with BDC for updating QUANTITY and CURRENCY fields.
You need to create a character variable of the same length as your quantity field. Move your quantity value to the newly created Character variable.
Now use this new char variable in the BDC.
This correction should solve your problem.
NOTE: BDC RECOGNIZES CHARACTER FIELDS ONLY.
Regards,
Prakash Pandey -
How to put some tabs in sales order item level invisible mode
Hello Gurus ,
Good evening everybody ,
We have some specific requirement from the client - Client does n't want few end users to see the price details in sales so they want the condition tab to be invisible mode in sales order item lvel only for few users i.e the condition tab should not be displayed for that user is this possible ?
Note : I only have idea setting few fields in sales order but not tabs in sales order through screen variant -SHD0
Looking for your inputs
Thanks and regards
VenkatHi,
There are a couple of options you can go with.
1) You can use Transaction and Screen variants to create your own ZVariant and then put that to user profile. Allow the user to run only with the variant you setup for the user via authorizations.
2) Get GUIXT software by Synactive, to perform the above task for you.
3) If you happen to have latest version of SAP ECC i.e. 6.0 with EHP3 or above, you can go with NWBC (Netweaver Business Client).
Thanks
Kapil Sharma -
Incompletion procedure -Sales order Item level.
Hi
I want to add the field "MATERIAL SALES TEXT" in Incompletion procedure -Sales order Item level.
The Table that i need to enter in procedure is VBAP.
But what should be the "Field Name" and Screen for creating missing data?
Plz Help....
Regards
SubhasishField ARKTX refers to 'Description' of material in sales order and not to 'material item text'.
'Material sales text' flows into sales order from the text you maintained in customer master record or Material master record.
Of course, you could also maintain sales text at sales order stage also.
Incompletion process inspects specific fields in order to see if data has been maintained in these fields. Should data not be maintained in these specified fields, the system is told how to respond, that is, whether or not to give a warning message and to what extent does it allow further processing of the document.
Material sales text is not a field.
So, you cannot add material sales text at incompletion procedure.
Please reward points for good answers as this would help increase the total donation that SAP will make to the United Nations World Food Programme.
Maybe you are looking for
-
How to get all the data stored on a table?
Hi. I'm tryng to get all the data stored on a database table but I'm losing in trouble. I've looked for a soloution to my problem in the forums but each post I follow related to this issue gives me a different way to solve the problem and no one work
-
In Preview, I suddenly am unable to get the "Adjust Color" tool panel to edit images. I just get the rectangular image selection tool instead. How do I ge the "Adjust Color" tool panel back?
-
my phone wont find my bluetooth speakers, and just keeps searching. ive tried switching them both off and starting again - i also know that the speakers work with bluetooth on my ipad ... any thoughts??
-
Hi, I need to buy a soundcard wich could work under Windows NT4. Can you tell me if such a product still exist ? Evilo from France.
-
Can I encrypt an indexed field?Why?
Hi,everybody! Can I encrypt an indexed fields ?Why? lgs Edited by: user495600 on 2010-8-11 上午7:18