bdc -sales order
Dear All
We have system which captures sales order data from customer & this data gets stored in one 'Z' table. From this 'Z' table we are creting SAP standard sales orders by running a BDC prog.
Problem
We are trying to upload more than 5 line items per order through the
BDC prog. We are successful to do this but when we ran the same prog on a PC having display i.e. Screen Area 1024 by 768 pixels the same prog. does not upload the orders with more than 5 line items.
i.e prog works ok in screen area 800by600pixels but does not work for 1024by768pixels.
We dont want to keep this code as hardcoded..it should understand this sceen area dynamically & should upload the order with whatever ordered items.
Waiting for replies.
Thanks & Regards
AG
use new line/new item command. It will bring the new item to line 2 always. ( I think OK Code POAN).
As Guest says.... use new line.
You should never rely on physical system attributes being the same as yours. A user will change everything he can from screen colours to resolution and font size - you're on a losing battle.
Here's a bit of code demonstrating what guest is on about:
Form Add_Item_Line Tables t_Item_Data
using pu_program type Program_Name
pu_screen like sy-dynnr
pu_insert_line like sy-ucomm
pu_insert_at like sy-tabix
pu_werks like Zorder_Header-Dwerk.
*
Data: t_characteristics type Order_Lines,
w_Characteristic like Zorder_Line.
*
Perform Zbdc_Screen using pu_Program pu_Screen.
Perform Zbdc_Field using c_OkCode pu_insert_line.
Perform Zbdc_Screen using pu_Program pu_Screen.
*
Loop at t_Item_Data into w_Characteristic.
*
* Is this actually part of the item line or is it a
* Characteristic ?
*
Translate w_Characteristic-AtNam to Upper Case.
Case w_Characteristic-AtNam.
When 'MATNR'. " Material
Perform Zbdc_Subscript using 'VBAP-MATNR'
pu_insert_at
W_Characteristic-AtWrt.
You can also select item lines using navigation features such as POPO....
Loop at t_Real_Values into w_orderline
Where atnam = 'PR00'.
*
* Move the required line (from posnr) to line 1.
*
Perform Zbdc_Field using c_okcode c_position_line.
Perform Zbdc_Screen using c_POPO_0251-Program
c_POPO_0251-Screen.
Perform Zbdc_Field using 'RV45A-POSNR' w_orderline-posnr.
Perform Zbdc_Field using c_okcode c_enter.
Perform Zbdc_Screen using c_MAIN_4001-Program
c_MAIN_4001-Screen.
*
* Select this item and then.....
*
Perform Zbdc_Field using 'RV45A-VBAP_SELKZ(01)' True.
*
* Off to the pricing screen....Get the Quantity to price.
*
Read Table t_Real_Values into w_quantity
with key posnr = w_orderline-posnr
atnam = 'Quantity'.
Perform Pricing_Costing using 'PR00'
w_orderline-atwrt
w_quantity-atwrt.
In general where ever you have a tab control you should not try and calculate how many lines are on the screen but should use the in built navigational features.
Here's another example.
I want to allocate some raw material and part of this involves batch splits. This code uses the 'SORT' button in CO02 to bring items that have not been batch split to the top of the table so that I can process them:
*Eject
***********************************************************************
*
* Procedure: CO02_Sort_Components
*
* Purpose: Sorts CO02 by component quantity, forcing
* new batch splits to the top.
*
* Entry:
*
* Tables:
*
* Exit: BDC Table updated with BDC statements
*
* Called By:
*
* Calls:
*
Form CO02_Sort_Components using pu_sortkey like tcopt-profid.
*
Perform ZBDC_Screen using c_co02_0120-program
c_co02_0120-screen.
Perform Zbdc_Field using c_okcode 'SORT'.
Perform Zbdc_Screen using c_sort_0100-program
c_sort_0100-screen.
*
* Named sort or a standard sort ?
If pu_sortkey <> ''.
Perform Zbdc_Field using 'TCOPT-PROFID' pu_sortkey.
Perform Zbdc_Field using c_okcode '/5'.
Perform Zbdc_Screen using c_sort_0100-program
c_sort_0100-screen.
Perform Zbdc_Field using c_okcode '/5'.
Else.
Perform Zbdc_Field using c_okcode '/6'.
EndIf.
Perform ZBDC_Screen using c_co02_0120-program
c_co02_0120-screen.
Perform Zbdc_Field using c_okcode c_report_top.
*
Endform.
Regards
R
Dear Guest
Thanks for your valuable input...trhis has really worked for our prog.
Thanks a ton again
Best Regards
AG
I got the similar problem. How could you find out the 'new line/new item' OK Code for KE11? When I run SHDB, I didn't see any possible selections for this in 3.1i.
Thanks in advance!
May
You will not see this option in any recording unless you click on it. Look in the menus for any navigation options.
If you can't find any go see an experienced end-user (all the projects I've been on have power-users who know their part of SAP inside out.....)
Once they show you how, set debugging on using '/h' immediately prior to clicking the relevant button or selecting the relevant menu option and then click the button. The okcode you need is in sy-ucomm.
R
Thank you, R.
I tried all the menus and right-click navigation options. It wasn't anywhere. Is this because that the 'new line' function doesn't exist in this Tcod. KE11? I saw the 'Position Cursor' in menus for Tcod. MB01.
May
That looks as though it's the case May, although I'm no expert on KE11!