Win32 - timer class error
heres my timer class:
class Timer
private:
UINT_PTR timerid=0;
unsigned int intInterval=0;
HWND timerwindow=NULL;
void TimerProc(HWND hwnd,UINT uMsg,UINT idEvent,DWORD dwTime)
timerprocedure();
static void CALLBACK _TimerProc(HWND hwnd,UINT uMsg,UINT idEvent,DWORD dwTime )
reinterpret_cast<Timer*>(idEvent)->TimerProc(hwnd,uMsg,idEvent,dwTime);
public:
std::function<void()> timerprocedure=NULL;
property<unsigned int> Interval
Get(unsigned int)
return intInterval;
Set(unsigned int uintInterval)
intInterval = uintInterval;
if (intInterval==0 && timerid!=0)
KillTimer(timerwindow,timerid);
void Start()
if(timerid!=0)
KillTimer(timerwindow,timerid);
timerwindow=GetForegroundWindow();
timerid=SetTimer( timerwindow,reinterpret_cast<UINT_PTR>(this),(UINT)intInterval,&Timer::_TimerProc);
SetWindowText(timerwindow,to_string(GetLastError()).c_str());
void Stop()
KillTimer(timerwindow,timerid);
timerid=0;
~Timer()
KillTimer(timerwindow,timerid);
yesterday was working. and i was seen 1 bug, stoped sometimes when the window loses the focus.
but now the GetLastError() give 6: invalid handle.
these don't makes sence to me :(
is there another timer that don't need the HWND?(for avoid future problems)
On 2/15/2015 1:29 PM, Cambalinho wrote:
i had created them on window procedure.
What is "them"? Created how? What do you mean by "on window procedure".
and that timer class is another timer. what i mean is the timer
WM_TIMER and my timer class aren't created
The only SetTimer call in the code you've shown is the one you admit is failing. To the extent a problem exists, it must be in the code you haven't shown. Lacking mind-reading abilities, I'm afraid I'm unable to assist you any further.
so maybe the message loop is crazy :(
Looks OK to me. Well, it may call IsDialogMessage with a NULL handle, but I believe this should cause IsDialogMessage to return FALSE and then the normal message dispatch takes place. Just to be sure, you may want to make it
[code]
if (!FormActivated || !IsDialogMessage(FormActivated, &msgEvents))
[code]
Igor Tandetnik
my problem is: no timer is executed :(
and i don't understand why. only the handle been invalid :(
see my form\window window procedure:
void setParent(HWND parent=GetDesktopWindow())
if (hwnd==NULL)
WNDCLASSEX FormClass;
char classname[20]="Form";
sprintf(classname,"%s",strCaption.c_str());
HINSTANCE mod = (HINSTANCE)GetModuleHandle(NULL);
FormClass.cbSize = sizeof(WNDCLASSEX);
FormClass.style = CS_HREDRAW | CS_VREDRAW;
FormClass.lpfnWndProc = WndProcForm;
FormClass.cbClsExtra = 0;
FormClass.cbWndExtra = 0;
FormClass.hInstance = mod;
FormClass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
FormClass.hCursor = LoadCursor(NULL, IDC_ARROW);
FormClass.hbrBackground = (HBRUSH)((COLOR_WINDOW)+1);
FormClass.lpszMenuName = NULL;
FormClass.lpszClassName = classname;
FormClass.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
// register the new window class
RegisterClassEx(&FormClass);
hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, classname, strCaption.c_str(),WS_OVERLAPPEDWINDOW | WS_TABSTOP,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, parent, NULL, mod, this);
if (hwnd == NULL)
MessageBox(NULL, "Can't create the control", "error", MB_OK);
else
SetParent(hwnd,parent);
ShowWindow(hwnd, SW_NORMAL);
InvalidateRect(hwnd,NULL,true);//i add these line for fix that
UpdateWindow(hwnd);
clrBackColor =GetDCBrushColor(GetDC(hwnd));
clrTextColor = GetTextColor(GetDC(hwnd));
//window procedure:
static LRESULT CALLBACK WndProcForm(HWND HandleWindow, UINT msg, WPARAM wParam, LPARAM lParam)
static POINT PreviousLocation, Location;
static bool Tracking = false;
static MouseButtons MBButtons;
static bool blControl = false;
static bool blShift = false;
static bool blResize = false;
static int KeyDownCount=0;
static int keyboard[256];
static int xPos = 0;
static int yPos = 0;
static UINT_PTR timerid=0;
static UINT_PTR KeyBoardTimer=2;
static UINT_PTR JoystickTimer=1;
static bool blnDrag = false;
static bool KeyPressed=false;
static HMENU menuhandle=NULL;
HDC hdcimage = CreateCompatibleDC(NULL);
HBITMAP hbitmap=NULL;
//UINT JoystickCount =0;
form *inst = (form *)GetWindowLongPtr(HandleWindow, GWLP_USERDATA);
if(inst!=NULL && inst->Create!=NULL )
static bool i=true;
if(i==true)
i=false;
RECT a;
GetWindowRect(inst ->hwnd,&a);
inst -> Create(a.left, a.top);
//Working with messages
switch(msg)
case WM_NCCREATE:
CREATESTRUCT *p = (CREATESTRUCT *)lParam;
inst = (form *)p->lpCreateParams;
SetWindowLongPtr(HandleWindow, GWLP_USERDATA, (LONG_PTR)inst);
inst->hwnd = HandleWindow;
break;
case WM_ACTIVATE:
if (wParam==WA_INACTIVE) // becoming inactive
FormActivated = NULL;
else // becoming active
FormActivated = inst->hwnd;
return 0;
break;
case WM_DRAWITEM:
DRAWITEMSTRUCT *test=(DRAWITEMSTRUCT*) lParam;
SendMessage(test->hwndItem, WM_DRAWITEM, wParam, lParam);
break;
case WM_USER + 1:
if(lParam==WM_RBUTTONUP)
POINT pCursor;
GetCursorPos(&pCursor);
HMENU test=GetSubMenu(GetMenu(HandleWindow),0);
SetForegroundWindow(HandleWindow);
TrackPopupMenu(test, TPM_LEFTBUTTON | TPM_RIGHTALIGN, pCursor.x, pCursor.y, 0, HandleWindow, NULL);
PostMessage(HandleWindow, WM_NULL, 0, 0);
break;
case WM_ERASEBKGND:
return DefWindowProc(HandleWindow, msg, wParam, lParam);
break;
case WM_CTLCOLORSTATIC:
return DefWindowProc(HandleWindow, msg, wParam, lParam);
break;
case WM_CREATE:
if(WindowMain == NULL || WindowMain ==GetDesktopWindow())
WindowMain = HandleWindow;
SetTimer(inst->hwnd,JoystickTimer,150,NULL);
SetTimer(inst->hwnd,KeyBoardTimer,150,NULL);
SendMessage((HWND)lParam , WM_CREATE, wParam, lParam);
break;
case WM_SIZE:
RECT a;
GetWindowRect(inst->hwnd,&a);
InvalidateRect(inst->hwnd, &a,true);
inst->Resize();
break;
//for get the menu click event
//i'm using menu notifications
case WM_MENUCOMMAND:
MENUITEMINFO menuInfo;
menuInfo.cbSize = sizeof(MENUITEMINFO);
menuInfo.fMask=MIIM_DATA;
if(GetMenuItemInfo((HMENU)lParam,(UINT) wParam, TRUE, &menuInfo )!=0)
Menu *mMenu = (Menu *) menuInfo.dwItemData;
if(mMenu!=NULL)
mMenu->Click();
menuhandle=NULL;
break;
case WM_TIMER:
if (wParam == timerid)//for mouse stoped and it's working normaly
PreviousLocation = Location;
GetCursorPos(&Location);
if ((Location.x == PreviousLocation.x) && (Location.y == PreviousLocation.y))
KillTimer(inst->hwnd, timerid);
inst->MouseStoped();
else if(wParam==KeyBoardTimer)
static bool KeyDown=false;
static int RepeatKeyDown;
int key[256];
GetKeyBoardKeyState(key);
static int key2[256];
if(key[AnyKey]==1 && KeyDown==false)
KeyDown=true;
RepeatKeyDown++;
GetKeyBoardKeyState(key2);
inst->SysKeyDown(key,RepeatKeyDown);
else if(key[AnyKey]==0 && KeyDown==true)
KeyDown=false;
inst->SysKeyUp(key2,RepeatKeyDown);
RepeatKeyDown=0;
else if(wParam==JoystickTimer)
JOYINFOEX b;
b.dwSize=sizeof(JOYINFOEX );
b.dwFlags=JOY_RETURNALL;
//cicle all possible joysticks
for (int i=0; i<16; i++)
int direction=0;
if(joyGetPosEx(i,&b)!= JOYERR_NOERROR) //if theres any error then continue to next joystick
if(i==0)
inst->Joystick(-1, -1,-1);
else
inst->Joystick(0, -1,-1);
break;
long h =b.dwButtons;
//testing the directions
//will be 8 directions(inclued diagonals)
if (b.dwXpos == 0 && b.dwYpos ==65535)
direction=5;
else if (b.dwXpos == 65535 && b.dwYpos ==0)
direction=6;
else if (b.dwXpos == 65535 && b.dwYpos ==65535)
direction=7;
else if(b.dwXpos == 0 && b.dwYpos ==65535)
direction=8;
else if (b.dwXpos == 0)
direction=1;
else if (b.dwXpos == 65535)
direction=2;
else if (b.dwYpos == 0)
direction=3;
else if (b.dwYpos == 65535)
direction=4;
inst->Joystick(i, direction,h);
break;
these don't make sence to me :(
Similar Messages
-
Hi,
In SNC system, the supplier is getting the following error when he is trying to update the planned receipt quantity.
Due to that error the ASN canu2019t be created and sent to ECC system.
Time series error in class /SCF/CL_ICHDM_DATAAXS method /SCF/IF_ICHDMAXS_2_CNTL~SAVE
Please give your inputs as to how to resolve this error.
Regards,
ShivaliHi Shivali,
This is not related to time series data issue.
ASN (ASN number:122593)XML failed may be because of there no Purchase order(Reference order) exists for supplier 0000104466 which will be there in failed XML.(see the DespatchedDeliveryNotification_In XML check XML tag <PurchaseOrderReference> value under tag <Item>)
Login as a supplier 0000104466 and search for purchase order (or replenishment order) and this PO(or RO) won't be there in supplier 0000104466 .
That's why ASN got failed.
Regards,
Nikhil -
I installed Reader X and when I tried opening it, I received a Visual Studio Just-in-time Debugger error "An unhandled win32 exception occurred in AcroRd32.exe [3116]. I uninstalled, rebooted and tried reinstalling and received the same error.
I tried disabling the just in time debugger mentioned in http://www.programmerfish.com/disable-visual-studio-just-in-time-debugger/ and received the error "An unhandled win32 exception occurred in AcroRd32.exe [4080]. Just-in-time debugging this exception failed with the following error: No installed debugger has just-in-time debugging enabled. In Visual Studio, Just-in-time debugging can be enabled.....
I do have Microsoft Visual Studio 2005 installed.
Any ideas?We discovered that Reader X users that had an older version of PGP installed received this error. We implemented a registry change on these devices which resolved the issued. PGP recognized it was an incompatibility issue on their end, and supposedly, with the newer version of PGP it will be resolved. In order to resolve this, try using Adobe Readers whitelisting feature. Below are the steps to follow:
i. Add a registry entry enabling the use of whitelisting:
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Adobe\Acrobat Reader\10.0\FeatureLockDown]
"bUseWhitelistConfigFile"=dword:00000001
ii. Create a whitelist file called "ProtectedModeWhitelistConfig.txt" and place it
in the Adobe Reader executable path i.e. C:\Program Files\Adobe\Reader 10.0\Reader
iii. The ProtectedModeWhitelistConfig.txt file will need to contain the string
SECTION_ALLOW_ANY = *PGPhk* -
Plug-in load class error while running portalapp.xml file in NWDS7.0
hi,
im facing a problem in NWDS7.0 while running portalapp.xml file im getting error realted some plug-in load class error.
Even 3 times i have re-installed but still getting same error.
Please help me how to over come this. This is error im getting :
Please open this link with Firefox so that you can able to see error.
http://www.imageurlhost.com/images/jri5lj7lpftu23ejyye0_Error.jpg
Regards,
prasad.Dear Prasad
Please right click on portalapp.xml > open with > check all the available editors.
Also restore default edition in NWDS. Go to windows > preference > Workbench OR Web editors > click on restore default and Apply and then Ok.
then close the NWDS and open it.
Hope it will helps
Best Regards
Arun Jaiswal -
Time limit error no matter what optimization I do...
Hello Experts,
I am trying to optimize the code below since it always results in time limi error when we transport
it to production server. I have tried eliminating some select inside the loop and using for all entries
but it still gets the error. Anyway, below is the code and I hoe you can help me out on this one guys.
Thank you and take care!
LOOP AT lt_vbap ASSIGNING <wa_vbap>.
IF <wa_vbap>-auart EQ 'ZUCI' OR
<wa_vbap>-auart EQ 'ZURV' OR
<wa_vbap>-auart EQ 'ZUPR'.
Check if a delivery document has been created
CLEAR wa_vbill. "used wa_vbfa-vbeln instead of wa_vbill
*Start of modification - AVH - 04/11/07
*/ Used read table instead of fetching records from database every loop
SELECT SINGLE vbeln
FROM vbfa
INTO wa_vbill
WHERE vbelv = <wa_vbap>-vbeln
AND ( ( vbtyp_n EQ 'J' AND vbtyp_v = 'C' )
OR ( vbtyp_n EQ 'T' AND vbtyp_v = 'H' ) ).
CLEAR wa_vbfa.
READ TABLE lt_vbfa INTO wa_vbfa WITH KEY vbelv = <wa_vbap>-vbeln
vbtyp_n = 'J'
vbtyp_v = 'C'
BINARY SEARCH
TRANSPORTING vbeln.
IF sy-subrc <> 0.
READ TABLE lt_vbfa INTO wa_vbfa WITH KEY vbelv = <wa_vbap>-vbeln
vbtyp_n = 'T'
vbtyp_v = 'H'
BINARY SEARCH
TRANSPORTING vbeln.
ENDIF.
*End of modification - AVH - 04/11/07
IF sy-subrc <> 0.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ELSE.
Check if within selection parameters
CLEAR wa_likp.
*Start of modification - AVH - 04/11/07
READ TABLE lt_likp INTO wa_likp WITH KEY vbeln = wa_vbill.
READ TABLE lt_likp INTO wa_likp WITH KEY vbeln = wa_vbfa-vbeln.
*End of modification - AVH - 04/11/07
*Start of modification - AVH - 04/11/07
*/ Used wa_vbfa instead of variable wa_vbill
IF sy-subrc <> 0.
SELECT SINGLE *
FROM likp
INTO wa_likp
WHERE vbeln = wa_vbill.
SELECT SINGLE *
FROM likp
INTO wa_likp
WHERE vbeln = wa_vbfa-vbeln.
*End of modification - AVH - 04/11/07
APPEND wa_likp TO lt_likp.
ENDIF.
IF NOT wa_likp-wadat_ist IN s_erdat.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDIF.
ENDIF.
ELSE.
Check if this has already been billed
CLEAR wa_vbill. "Used wa_vbfa instead of wa_vbill
*Start of modification - AVH - 04/11/07
*/ Used read table instead of fetching records from database every loop
SELECT SINGLE vbeln
FROM vbfa
INTO wa_vbill
WHERE vbelv = <wa_vbap>-vbeln
AND ( ( vbtyp_n EQ 'M' AND vbtyp_v = 'C' )
OR ( vbtyp_n EQ 'O' AND vbtyp_v = 'H' ) ).
CLEAR wa_vbfa.
READ TABLE lt_vbfa INTO wa_vbfa WITH KEY vbelv = <wa_vbap>-vbeln
vbtyp_n = 'M'
vbtyp_v = 'C'
BINARY SEARCH
TRANSPORTING vbeln.
IF sy-subrc <> 0.
READ TABLE lt_vbfa INTO wa_vbfa WITH KEY vbelv = <wa_vbap>-vbeln
vbtyp_n = 'O'
vbtyp_v = 'H'
BINARY SEARCH
TRANSPORTING vbeln.
ENDIF.
*End of modification - AVH - 04/11/07
IF sy-subrc <> 0.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ELSE.
Check if within selection parameters
CLEAR wa_vbrk.
*Start of modification - AVH - 04/11/07
*/ Used wa_vbfa instead of variable wa_vbill.
READ TABLE lt_vbrk INTO wa_vbrk WITH KEY vbeln = wa_vbill.
READ TABLE lt_vbrk INTO wa_vbrk WITH KEY vbeln = wa_vbfa-vbeln.
IF sy-subrc <> 0.
SELECT SINGLE vbeln fkdat
FROM vbrk
INTO wa_vbrk
WHERE vbeln = wa_vbill.
APPEND wa_vbrk TO lt_vbrk.
SELECT SINGLE vbeln fkdat
FROM vbrk
INTO wa_vbrk
WHERE vbeln = wa_vbfa-vbeln.
APPEND wa_vbrk TO lt_vbrk.
ENDIF.
*End of modification
IF NOT wa_vbrk-fkdat IN s_erdat.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDIF.
ENDIF.
ENDIF.
Get Material Type and Division
IF <wa_vbap>-spart IS NOT INITIAL.
SELECT SINGLE mtart
FROM mara
INTO lv_mtart
WHERE matnr = <wa_vbap>-matnr.
ELSE.
SELECT SINGLE mtart spart
FROM mara
INTO (lv_mtart,<wa_vbap>-spart)
WHERE matnr = <wa_vbap>-matnr.
ENDIF.
If material division is same as parameter division
IF <wa_vbap>-spart = p_spart.
If material is subsidiary-owned
IF <wa_vbap>-spart in lr_spart.
If customer is the same as that of parameter division
IF <wa_vbap>-kunnr NE lr_kunnr OR <wa_vbap>-auart EQ 'ZUDO' OR <wa_vbap>-auart EQ 'ZUS3'.
If item is a free good, tag order type as 'ZUPR' to treat
the item the same way as 'ZUPR'
IF <wa_vbap>-pstyv = 'TANN' OR
<wa_vbap>-pstyv = 'ZKNF' OR
<wa_vbap>-pstyv = 'ZKNN' OR
<wa_vbap>-pstyv = 'ZFLO' OR
<wa_vbap>-pstyv = 'ZKBF' OR
<wa_vbap>-pstyv = 'ZKLN' OR
<wa_vbap>-pstyv = 'ZREN'.
lv_auart = <wa_vbap>-auart.
IF lv_auart EQ 'ZUPR'.
CLEAR <wa_vbap>-pstyv.
ENDIF.
<wa_vbap>-auart = 'ZUPR'.
CLEAR: lv_mtart.
ENDIF.
Set Cost of Goods Sold Account
<wa_vbap>-cogshkont = '0050000010'.
CASE <wa_vbap>-auart.
WHEN 'ZUDO' OR 'ZUPR' OR 'ZUCI'.
IF p_rtrns EQ 'X'.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDIF.
WHEN 'ZURD'.
IF p_issue EQ 'X'.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDIF.
WHEN OTHERS.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDCASE.
CASE <wa_vbap>-auart.
WHEN 'ZUPR'.
CASE lv_mtart.
WHEN 'ZUL4'.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
WHEN OTHERS.
Check if division is defined in mapping table
READ TABLE lt_ulsub INTO wa_ulsub
WITH KEY spart = <wa_vbap>-spart.
IF sy-subrc = 0.
<wa_vbap>-kostl = wa_ulsub-kostlp.
<wa_vbap>-bukrs = wa_ulsub-bukrsp.
<wa_vbap>-type = 'TP'.
Set Cost of Goods Sold Account
IF lv_auart = 'ZUPR'.
<wa_vbap>-cogshkont = '0050000006'.
ENDIF.
ELSE.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDIF.
ENDCASE.
WHEN 'ZUCI' OR 'ZUDO' OR 'ZURD' OR 'ZUS3'.
Get cost center from header text
PERFORM get_cost_center USING <wa_vbap>-vbeln
CHANGING <wa_vbap>-kostl.
* Change by LGTE 11-02-2006
Check if Medvale sales
IF <wa_vbap>-auart EQ 'ZUCI' AND <wa_vbap>-kostl IS INITIAL.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
Check if UL Cost Center
ELSEIF <wa_vbap>-kostl NE gv_ul_kostl.
IF <wa_vbap>-kostl NE gv_ul_kostl.
* End change.
Get material division and check if subsidiary product
SELECT SINGLE spart FROM mara INTO <wa_vbap>-spart
WHERE matnr = <wa_vbap>-matnr.
READ TABLE lt_ulsub INTO wa_ulsub
WITH KEY spart = <wa_vbap>-spart.
IF sy-subrc = 0.
Get requestor's company code from cost center data
SELECT SINGLE bukrs
FROM csks
INTO <wa_vbap>-bukrs
WHERE kokrs = lc_kokrs
AND kostl = <wa_vbap>-kostl
AND datbi GE sy-datum
AND datab LE sy-datum.
IF sy-subrc = 0.
For donations, only include if a subsidiary company is donating
IF <wa_vbap>-auart EQ 'ZUDO' OR <wa_vbap>-auart EQ 'ZUS3'.
IF NOT <wa_vbap>-kunnr IN lr_kunnrnt.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDIF.
CHECK <wa_vbap>-kunnr IN lr_kunnrnt.
ENDIF.
For ZUCI, if the company code of the costcenter is UL, do not include
IF <wa_vbap>-bukrs EQ gc_ul_bukrs.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDIF.
IF <wa_vbap>-bukrs = wa_ulsub-bukrsp.
<wa_vbap>-type = 'RV'.
ELSE.
<wa_vbap>-type = 'RV'.
ENDIF.
ELSE.
Check if customer defined in table ZFI_DONATIONS
SELECT SINGLE kunnr FROM zfi_donations INTO <wa_vbap>-kostl
WHERE kunnr = <wa_vbap>-kostl.
IF sy-subrc <> 0.
lv_error = 'X'.
CONCATENATE 'Cost center/Customer' <wa_vbap>-kostl
'does not exist. Please check Sales Order'
<wa_vbap>-vbeln
INTO lt_disp-message SEPARATED BY space.
lt_disp-type = 'E'.
<wa_vbap>-del_ind = 'X'.
APPEND lt_disp.
CONTINUE.
ELSE.
<wa_vbap>-type = 'RV'.
ENDIF.
ENDIF.
ELSE.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDIF.
ELSE.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDIF.
WHEN OTHERS.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDCASE.
ELSE.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDIF.
ELSE.
<wa_vbap>-del_ind = 'X'.
CONTINUE.
ENDIF.
Get company code description
SELECT SINGLE butxt
FROM t001
INTO <wa_vbap>-butxt
WHERE bukrs = <wa_vbap>-bukrs.
IF sy-subrc <> 0.
SELECT SINGLE name1
FROM kna1
INTO <wa_vbap>-butxt
WHERE kunnr = <wa_vbap>-kostl.
ENDIF.
Change by LGTE on 11-02-2006
Get Transaction Type
CASE <wa_vbap>-auart.
WHEN 'ZUPR'. "UL Promo/Samples
IF <wa_vbap>-pstyv = 'TANN' OR
<wa_vbap>-pstyv = 'ZKNF' OR
<wa_vbap>-pstyv = 'ZKNN' OR
<wa_vbap>-pstyv = 'ZFLO' OR
<wa_vbap>-pstyv = 'ZKBF' OR
<wa_vbap>-pstyv = 'ZKLN' OR
<wa_vbap>-pstyv = 'ZREN'.
<wa_vbap>-ltext = 'Free Goods'.
ELSE.
<wa_vbap>-ltext = 'Product Samples'.
ENDIF.
WHEN 'ZUDO'. "Donations - R/3
<wa_vbap>-ltext = 'Donations - R/3'.
WHEN 'ZUCI'. "Donations - ZUCI
<wa_vbap>-ltext = 'Donations - ZUCI'.
WHEN 'ZURD' OR 'ZUS3'. "UL Returns - Donation
<wa_vbap>-ltext = 'UL Returns - Donation'.
ENDCASE.
Get cost center description
SELECT SINGLE ltext FROM cskt INTO <wa_vbap>-ltext
WHERE spras = sy-langu
AND kokrs = lc_kokrs
AND kostl = <wa_vbap>-kostl
AND datbi GE sy-datum.
End of change.
Get material description
SELECT SINGLE maktx
FROM makt
INTO <wa_vbap>-maktx
WHERE matnr = <wa_vbap>-matnr
AND spras = sy-langu.
Get division from material master
SELECT SINGLE spart FROM mara INTO <wa_vbap>-spart
WHERE matnr = <wa_vbap>-matnr.
Get division description
SELECT SINGLE vtext
FROM tspat
INTO <wa_vbap>-vtext
WHERE spras = sy-langu
AND spart = <wa_vbap>-spart.
Get Valuation Class
SELECT SINGLE bklas
FROM mbew
INTO lv_bklas
WHERE matnr = <wa_vbap>-matnr.
Determine G/L of FG Based on Valuation Class
READ TABLE lt_val_cls INTO wa_val_cls WITH TABLE KEY bklas = lv_bklas.
<wa_vbap>-fghkont = wa_val_cls-hkont.
Determine Cost Center of Cogs Account
READ TABLE lt_ulsub INTO wa_ulsub WITH TABLE KEY spart = <wa_vbap>-spart.
<wa_vbap>-cogskostl = wa_ulsub-kostlp.
ENDLOOP. "ENDLOOPHi,
Hopefully it can help you:
1. Try remove all SELECT statement within LOOP, replace with select all data before LOOP using For ALL ENTRIES.
2. Try use READ TABLE using BINARY SEARCH. Don't forget to SORT the table according your Search Key.
If it still couldn;t help, try run your report in background.
Regards, -
Timer Class in jsdk 1.4 w2000 doesn't compile
Since this is based in the tutorial, shouldn't be a big deal but I spent the whole day looking for a solution. Please help!
The tutorial presents this program:
//1.3
import java.util.timer;
public class Problem {
public static void main(String[] args) {
final Timer timer = new Timer();
timer.schedule(new TimerTask(), 5000);
System.out.println("In 5 seconds this application will exit. ");
public class TimerTask implements Timer {
public void run() {
System.out.println("Exiting.");
timer.cancel();
My problem starts because java.util doesn't have the timer class:
Problem.java:2: Class java.util.timer not found in import.
import java.util.timer;
^
Now, JSDK 1.4 doesn't have timer as a package, but as a class, nevertheless, the instruction:
import java.util.*; // instead of java.util.Timer
doesn't compile because
Problem.java:10: Interface Timer of inner class Problem. TimerTask not found.
Problem.java:6: Class Timer not found in type declaration.
I think Timer should be expressed as abstract, but how?
I'm new in Java and feel a little frustrated...>
ProblemSolved.java:3: Class java.util.Timer not found
in import.
import java.util.Timer;
^
1 error
Then you are not using java 1.3. You are using something before that.
for the Timer and
javac IteratorDemo.javaIteratorDemo.java:1: Interface java.util.Iterator of
class IteratorDemo not foun
d.
public class IteratorDemo implements
java.util.Iterator {
^
1 error
And this suggests that you are using something before 1.2.
Just a thought...
Windows comes with the MS version of java, which matches something like 1.1.6. It is in the path. So does you path put the jdk path first or last? -
Timer class and javax.......
Hi,
Downloaded the latest java version to d:\download folder. The downloaded file has the name
" j2re-1.4.2_03-wndows-i586-p.exe ". The file size was about 14.53MB. Double clicking the same installed j2re1.4.2_03 in "C:\Program Files\java\j2re1.4.2_03" folder.
When I tried to compile Reminder.java program that comes with online Tutorial
from within C:\Program Files\java\j2re1.4.2_03 at MS-DOS prompt, I got the error message �class java.util.Timer not found in import�.
I also have Jdk1.1.3 in C:\jdk1.1.3 folder. When I tried to compile Reminder.java from within C:\jdk1.1.3 at MS-DOS prompt, got the same error message,
Even after changing path variable to C:\jdk1.1.3\bin. Please help.
Trying to compile any swing program at both DOS prompts gives error message �javax.__________ not found in import�. Can�t figure out why. Please help.
ammukalai.j2re1.4 is a runtime only (ie j2re = Java Runtime Engine) It will not compile java files.
The timer class was introduced with Java version 1.3.
You currently have a very old version of 1.1.3.
You need to download the j2se1.4.2 SDK - http://java.sun.com/j2se/1.4.2/download.html
The size is closer to 50MB :-)
Cheers,
evnafets -
Foreground job - Standard report - Time out error
Hi,
I have a standard SAP report which is executed from portal and the report is failing in the foreground with a time out error. As there is time set for foreground process and probably the volume of the report is big which is not good enough to execute in the foreground time frame.
The customer wants to run it only in the foreground and does not want to schedule in the background and the reason being he wants to do some customization on the columns when the report is displayed back on the portal screen.
Now my question is there any other option to get the requirement and increasing the foreground time is ruled out by Basis team.
I was thinking if I can use a wrapper report on the standard report and include SAPGUI_PROGRESS_INDICATOR to keep the connection between the dialog and the presentation server going without dis-connecting. Is this a better option and I am not sure if it will work ?
Please let me know if any one else has resolved such issues earlier.
Regards
Praneeth Kumar
Edited by: gansprasan on Sep 20, 2011 2:07 PMHi,
Though it is not advisable to change max run time... if need you you consult with your basis and you can change run time dynamically in your program and reset to original. I agree even CL_gui_timer class wont help.
you can check below link.. handle it carefully..
[http://help.sap.com/bp_bw370/documentation/How_To_Change_the_Maximum_Dialog_Runtime_of_a_Process_in_NW2004s.pdf]
data: old_value(100).
CONSTANTS: parameter LIKE tpfet-parname
VALUE 'rdisp/max_wprun_time'.
CALL 'C_SAPGPARAM' ID 'NAME' FIELD parameter
ID 'VALUE' FIELD old_value. " old_value will have value set by basis.
IF sy-subrc <> 0.
RAISE not_found.
ENDIF.
use FM TH_CHANGE_PARAMETER to change value. Again reset the value with old value..
Regards,
Ravi. -
Generic Host process for WIN32 encountered an error and needed to close
Hi,
I hv installed SAP ECC6.0 SR3 on WIndows 2003 R2 Enterprise Edition. Many times i get an popup message on Windows Server "Generic Host process for WIN32 encountered an error and needed to close"
I hv checked the Event Viewer, in Event Viewer it shows the application error.
Consequences of this error is that my Transport path //hostname/sapmnt/trans becomes inaccesible, and I have to take the restart of Windows server to solve the problem. ONce Windows server is restarted for some time transports work, Again when receiving the same error popup on Windows, Transport path goes down.
Can anyone give input on this???Hello,
You have posted a question that is related to system transports. Unfortunately this category is not related to these kind of questions. SAP TM deals with logistics in the real world - moving pallets, containers, loading trucks, etc.
To learn more about SAP TM please visit http://service.sap.com/scm-tm
Therefore I will now move this thread to the category Software Logistics. Thank you for your understanding.
Kind regards,
Nico van Os. -
Combining LVOOP DVR with Asynchronous Dynamic Dispatch and Preserve Run-Time Class
OK, the title sounds like a cornucopia of LVOOP terms. But there's a reason. This is in a way an extension of THIS thread.
What I'm doing recently is creating a LVOOP approach to loading Completely Asynchronous UI elements into subpanels. This I have combined with a global repository for the objects (which are essentially singletons with a UI functionality) which are shared via DVR, thus eliminating a lot of synchronisation headaches).
This means that I can ahve a universal framework for launching the UI elements into a subpanel. The changes made on the Object there are automatically reflected in the global repository.
So far so good.
What I don't like too much is a combination of two seemingly awkward code constructs I need in order to keep things running.
Weird construct 1:
I have defined a "Launch UI" function in my parent class which is Dynamic Dispatch (Allowing each object to take care of launching its own UI). This takes a parent object DVR as a second input which I make sure is of the exact same type as the object type being invoked by using the code shown below. The ACTUAL Type of both inputs to the launch VI within the IPE are identical. This is guaranteed because I require each new class to override this function.
Here I pass the DVR from outside the IPE to the "Launch" VI but the Object obtained within the IPE retains information required for DD thus ensuring that the VI called for launching the UI is identical to the ACTUAL object type in the DVR. This works OK and by placing this weird construct WITHIN the parent class, abuse is minimised, it works fine and seems to have no major side-effects.
So now we have a VI running asynchronously in the background which belongs to a specific object but has a DVR which it *thinks* is of a Parent Type but, because of the steps taken earlier, is actually of the same type as the object itself.
In order to make use of the functionality defined in this actual object type, I need to continuously re-interpret the Object within the IPE as shown below. Otherwise only the Parent functionality is available.
If I am accessing only methods of the parent class, then the Preserve functionality is not needed.
Is there a more elegant way to do this? I find the net result of this code and type-juggling to be really useful and much easier to manage than the non-DVR route since the synchronisation issues disappear. By making the IPE usage near-atomic we remove the chances of deadlock.
All editing done in the UI of the asynchronous VI is reflected automatically in any subsequent usage of the DVR. Even if the DVRs are not shared between VIs, this makes (for me) the headache of synchronisation easier. If you start expanding this beyond the limits of a single VI, the benefits in Synchronisation become really huge. You can even have multiple UI objects operating on the same data in the background without extra synchronisation needs. The only synchronisation required is a global "Data updated" for the object in question whereby the UI elements simply update their indicators and controls from the DVR again. This is trivial.
Thus I am convinced that the net result of this is very beneficial.
My question is if there's a better, safer or more "official" way to do this?
I was about to start a new Idea for combining the "Preserve Run time Class" and the DVR Terminal of the IPE so that the casting is done automatically. We could then have a double input to the IPE, the DVR (of base type) plus the ACTUAL Type of the object but of course returning an error if the types are incompatible. It would be like an "Imposter" DVR input for the IPE which allows a re-interpretation of the object type.
Would all of this go away if we allowed Dynamic Dispatch to work with DVRs? Probably.
Shane
Say hello to my little friend.
RFC 2323 FHE-Compliant
Solved!
Go to Solution.You guys rock!
I didn't even think of casting the DVR like that. Kinds stupid of me but I never would have thought it would work. Cool.
Also, Yeah, the limitation of no IPE in the Launch VI was one I spotted quite early on. this is why my Launch VI also doesn't accept more data than is absolutely neccessara because a DVR access in that VI will of course cause a lockup. I have the system so far now that I can have a SINGLE Launch VI (Which is NOT overridden, so the limitation refers to only a single VI now which is certainly better.
So again guys, thanks for helping out an old newbie. I've been around for quite a while, have made many posts but I love the way I just keep learning from others in the Forum. This is just why I absolutely LOVE it here.
Shane.
Say hello to my little friend.
RFC 2323 FHE-Compliant -
Just in time Compilation Error
Hai ,
i got the following Error :
Just in Time Compilation Error
Invalid parser construct found on line 26 at position 19.
ColdFusion was looking at the following text:.Invalid
expression format.
The usual cause is an error in the expression structure.
this error occurs on cold fusion 5.
this class works fine on Cold fusion mx and 7.
This class basically uses the zip api of java to zip files.
<cfobject type="java" class="myZip" name="z">
<cfset result =
z._ZFolder("G:\Official\Development\Team05\zip\","G:\Official\Development\Team05\mi.zip") >
<cfoutput>#result# </cfoutput>It might help to escape the # character in the other two
colours, thus
bordercolordark="##006600" bordercolorlight="##66CC33" -
ServletInputStream.read() causes read time out error
this part of the jsp page
<jsp:useBean id="testServlet" scope="page" class="testServlet" />
<%
testServlet.doUpload(request);
%>
this is part of the servlet
public void doUpload(HttpServletRequest request) throws IOException
BufferedInputStream br = new BufferedInputStream(request.getInputStream());
/* error here! */
int i = br.read();
it will produce an read time out error when i reach the error line
btw..... i am using tomcat as server and parsing the form :
<form name="form1" enctype="multipart/form-data" method="get" action="converter.jsp">
<input type="file" name="filename">
</form>
thnx in advance!I'd think for the request to have an input stream, the request method on the form would need to be post, not get. Other than that, I don't know why you've created a Servlet - seems like you could have just created a simple class that takes a HttpServletRequest object (doesn't have to be a servlet). Your jsp page is the real servlet that's being called.
-
Getting time out error when running the assigned verification in DRM 9.3.2.
Hi,
I have installed DRM 9.3.2.0.0 in my system (windows 7), when i am trying to run assigned verifications i am getting the time out error within a minute.
As suggested by oracle,I have added DWORD with value 480000 under Master Data Management in Registry editor. But still getting the error.
Please suggest a solution for this issue.
regards,
sathiyaPlease suggest me the solution.
regards,
sathiya -
Time out error 1.6 million internal table fields are computed using FMs
Hi , All ...
The Report running fine in server with less 300 record but ...production server which has 1.6 million record it gives error as time-out error and takes hell amount of time.
Please suggest ugently ..
I have tried few things
Internal table having 1.6 lacs ... fields to compute .. i have token in a batch
loop at i_cinfo into s_cinfo from 1 to 100000.
and so on ...also applied all the performace related .. like indexs, work areas , deleting adjacent duplicates , for all entries ..wherever applicable.
Please Suggest .
Report is as below
REPORT ZUSOTCBD_CREDIT_REPORT .
TABLES : KNA1, " General Data Customer Master
KNB1, " Customer Master (Company Code)
KNC1, " Customer master (transaction figures)
KNKK, " Customer master credit management: Control area data
T009, " Fiscal Year Variants P
T009Y, " Shortened fiscal years in Asset Accounting P
T001, " Co. Codes
T001CM, " Permitted Credit Control Areas per Company Code
RF42B, " Structure to hold credit data.
RF035, " Structure to hold credit managment fields
RF02L, " Structure to hold credit data.
TRAS, " Interval for Days in Arrears P
T000CM. " Data for DSO calculation.
Types
TYPES:
BEGIN OF type_final,
string(50) TYPE c, " String Value for Title
END OF type_final.
data:wa_final TYPE type_final. " Work Area to hold Title Data
DATA: RASID TYPE RF035-RASID value 'R03N'. " For Days in interval
DATA: MONAT(2) TYPE N.
DATA: GJAHR TYPE KNC1-GJAHR.
DATA: LD_PERIODS(32) TYPE N
VALUE '01020304050607080910111213141516'.
DATA sytabix type sy-tabix.
DATA LAND TYPE KNA1-LAND1 VALUE 'US'. " Country Key
DATA: LD_PERIOD TYPE BSID-MONAT, " Fiscal Year Variant
LD_GJAHR TYPE KNC1-GJAHR,
LD_COUNTER TYPE SY-TABIX.
Internal Tables
Internal table to hold Title Data *
DATA:
i_final TYPE STANDARD TABLE OF type_final.
**Internal Table Permitted Credit Control Areas per Company Code
DATA: BEGIN OF TCMTAB OCCURS 10.
INCLUDE STRUCTURE T001CM.
DATA: END OF TCMTAB.
*Internal table to store Customer no.
DATA : BEGIN OF ICUST OCCURS 0,
KUNNR TYPE KNA1-KUNNR, " Customer No.
END OF ICUST.
DATA: BEGIN OF BUKTAB OCCURS 20,
KKBER LIKE T001-KKBER, " Credit Control Area
BUKRS LIKE T001-BUKRS, " Co. Code
WAERS LIKE T001-WAERS, " Currency
PERIV LIKE T001-PERIV, " Fiscal Year Variant
BUTXT LIKE T001-BUTXT,
END OF BUKTAB.
Internal Table to store Fiscal year Data .
DATA: BEGIN OF GJATAB OCCURS 5,
PERIV LIKE T001-PERIV, " Fiscal Year Variant
GJAHR LIKE KNC1-GJAHR, " Fiscal Year
MONAT LIKE T009-ANZBP, "
ANZBP LIKE T009-ANZBP, " Number of posting periods
END OF GJATAB.
*Main Output internal table to be used to store credit history Information
DATA : BEGIN OF I_CINFO occurs 0,
KUNNR TYPE KNB1-KUNNR, " Customer
KNKLI TYPE KNKK-KNKLI, " Customer's account number with credit limit reference
KKBER TYPE KNKK-KKBER, " Credit Control Area
CTLPC TYPE KNKK-CTLPC, " Risk Category
KLIMK TYPE KNKK-KLIMK, " Credit Limit
SBGRP TYPE KNKK-SBGRP, " Credit representative group for credit management
ERDAT TYPE KNKK-ERDAT, " Created On
DTREV TYPE KNKK-DTREV, " Last Internal Review
REVDB TYPE KNKK-REVDB, " Last External Review
SALDO TYPE RF42B-SALDO, " Balance
DSOIN TYPE RF02L-DSOIN, " DSO
H06SA TYPE RF035-H06SA, " Highest Balance at the end of 6 Months
H06JA TYPE RF035-H06JA, " Year highest Balance 6 Months
H06MO TYPE RF035-H06MO, " Month OF hihest Balance 6 Months
H12SA TYPE RF035-H12SA, " Highest Balance at the end of 12 Months
H12JA TYPE RF035-H12JA, " Year highest Balance 12 Months
H12MO TYPE RF035-H12MO, " Month OF hihest Balance 12 Months
UMP2U TYPE RF42B-UMP2U, " Sales from the current Year
UMP1U TYPE RF42B-UMP1U, " Sales from the Previous Year
SFAEL TYPE RF035-SFAEL, " Total Past Due Open Item
SFAE1 TYPE RF035-SFAE1, " Aging buckets 0-15
SFAE2 TYPE RF035-SFAE2, " Aging buckets 16-30
SFAE3 TYPE RF035-SFAE3, " Aging buckets 31-60
SFAE4 TYPE RF035-SFAE4, " Aging buckets 60-90
SFAE5 TYPE RF035-SFAE5, " Aging buckets Over 90
END Of I_CINFO.
DATA : BEGIN OF S_CINFO ,
KUNNR TYPE KNB1-KUNNR, " Customer
KNKLI TYPE KNKK-KNKLI, " Customer's account number with credit limit reference
KKBER TYPE KNKK-KKBER, " Credit Control Area
CTLPC TYPE KNKK-CTLPC, " Risk Category
KLIMK TYPE KNKK-KLIMK, " Credit Limit
SBGRP TYPE KNKK-SBGRP, " Credit representative group for credit management
ERDAT TYPE KNKK-ERDAT, " Created On
DTREV TYPE KNKK-DTREV, " Last Internal Review
REVDB TYPE KNKK-REVDB, " Last External Review
SALDO TYPE RF42B-SALDO, " Balance
DSOIN TYPE RF02L-DSOIN, " DSO
H06SA TYPE RF035-H06SA, " Highest Balance at the end of 6 Months
H06JA TYPE RF035-H06JA, " Year highest Balance 6 Months
H06MO TYPE RF035-H06MO, " Month OF hihest Balance 6 Months
H12SA TYPE RF035-H12SA, " Highest Balance at the end of 12 Months
H12JA TYPE RF035-H12JA, " Year highest Balance 12 Months
H12MO TYPE RF035-H12MO, " Month OF hihest Balance 12 Months
UMP2U TYPE RF42B-UMP2U, " Sales from the current Year
UMP1U TYPE RF42B-UMP1U, " Sales from the Previous Year
SFAEL TYPE RF035-SFAEL, " Total Past Due Open Item
SFAE1 TYPE RF035-SFAE1, " Aging buckets 0-15
SFAE2 TYPE RF035-SFAE2, " Aging buckets 16-30
SFAE3 TYPE RF035-SFAE3, " Aging buckets 31-60
SFAE4 TYPE RF035-SFAE4, " Aging buckets 60-90
SFAE5 TYPE RF035-SFAE5, " Aging buckets Over 90
END Of s_cinfo.
*Internal table to hold month-wise balance.
DATA: BEGIN OF SALTAB OCCURS 12,
LNUMM(2) TYPE N, " Month
SALDO LIKE RF42B-SALDO, " Balance
END OF SALTAB.
*Internal table used for computing the Balance fields
DATA: BEGIN OF SALDO,
UML01 LIKE KNC1-UM01S,
UML02 LIKE KNC1-UM01S,
UML03 LIKE KNC1-UM01S,
UML04 LIKE KNC1-UM01S,
UML05 LIKE KNC1-UM01S,
UML06 LIKE KNC1-UM01S,
UML07 LIKE KNC1-UM01S,
UML08 LIKE KNC1-UM01S,
UML09 LIKE KNC1-UM01S,
UML10 LIKE KNC1-UM01S,
UML11 LIKE KNC1-UM01S,
UML12 LIKE KNC1-UM01S,
END OF SALDO.
Structure to hold Bal fields ------ -------
DATA: BEGIN OF SKNKK,
KUNNR LIKE KNA1-KUNNR, " Customer Number 1: Debitor
KONTO LIKE KNKK-KUNNR,
SFAE1 LIKE RF035-SFAE1, " Aging buckets 0-15
SFAE2 LIKE RF035-SFAE2, " Aging buckets 16-30
SFAE3 LIKE RF035-SFAE3, " Aging buckets 30-60
SFAE4 LIKE RF035-SFAE4, " Aging buckets 60-90
SFAE5 LIKE RF035-SFAE5, " Aging buckets Over 90
SFAEL LIKE RF035-SFAEL, " Total Due of Items
UML01 LIKE KNC1-UM01S,
UML02 LIKE KNC1-UM01S,
UML03 LIKE KNC1-UM01S,
UML04 LIKE KNC1-UM01S,
UML05 LIKE KNC1-UM01S,
UML06 LIKE KNC1-UM01S,
UML07 LIKE KNC1-UM01S,
UML08 LIKE KNC1-UM01S,
UML09 LIKE KNC1-UM01S,
UML10 LIKE KNC1-UM01S,
UML11 LIKE KNC1-UM01S,
UML12 LIKE KNC1-UM01S,
UMP1U LIKE RF42B-UMP1U, " Sales from the Previous Year
UMP2U LIKE RF42B-UMP2U, " Sales from the current Year
SALDO LIKE RF42B-SALDO, " Balance
END OF SKNKK.
DATA : BEGIN OF ICUST1 OCCURS 0,
KUNNR TYPE KNA1-KUNNR, "For Customer Filter.
END OF ICUST1.
**Internal table to hold fiscal varriants
DATA: BEGIN OF LT_PERIODS OCCURS 12,
PERIOD LIKE BSID-MONAT,
GJAHR LIKE KNC1-GJAHR,
END OF LT_PERIODS.
**Constants
constants : BUKRS1 TYPE KNB1-BUKRS VALUE '1000',
BUKRS2 TYPE KNB1-BUKRS VALUE '1031',
Recs Type i value '200',
B_count type i value '2'.
INITIALIZATION
INITIALIZATION.
IF RASID IS INITIAL.
SELECT * FROM TRAS.
EXIT.
ENDSELECT.
IF SY-SUBRC = 0.
RASID = TRAS-RASID.
ENDIF.
ENDIF.
SELECTION-SCREEN
parameters : p_path type rlgrap-filename default 'C:\Documents and Settings\C890971\Desktop\Credit_history.XLS'.
Start of selection processing
START-OF-SELECTION.
**Get Customers for Co. Code 1000 & 1031.
PERFORM GET_CUST.
Get / Compute Credit Information data for Company Codes 1000 & 1031.
PERFORM GET_CREDIT_DATA.
End of selection processing
*END-OF-SELECTION.
Listing Credit History Data
PERFORM DOWNLOAD_CREDIT_DATA.
S U B R O U T I N E S
*& Form GET_CUST
text
--> p1 text
<-- p2 text
FORM GET_CUST .
Get US only Customers.
Refresh icust.
Select kunnr from kna1 appending table icust
where Land1 = land.
**Delete duplicate records
Delete Adjacent duplicates from icust comparing kunnr.
if icust[] is not initial.
Limit the selection some more to Co. Code 1000 & 1031
As join will cost overhead as compared.
Select kunnr from knb1 into table icust1
for all entries in icust
where kunnr = icust-kunnr
and bukrs = bukrs1
OR bukrs = bukrs2.
**Delete duplicate records
Delete Adjacent duplicates from icust1 comparing kunnr.
endif.
**Free memory.
Free icust.
Credit Control Area
select * from T001CM into table TCMTAB
where bukrs = bukrs1 OR
bukrs = bukrs2.
ENDFORM. " GET_CUST
*& Form GET_CREDIT_DATA
text
--> p1 text
<-- p2 text
FORM GET_CREDIT_DATA .
DATA : L_TEXT(60) TYPE C ,
Ltext1(50) type C value 'Computing Credit-History Data For',
Ltext2(10) type C value 'Customers',
L_PCT type i value '10',
L_recs type i,
l_batch_recs type i,
l_s_rec type i value 1,
l_recs1(7) type N.
***Fetch data from KNKK table
PERFORM GET_KNKK_DATA .
***Computing Crredit Fields
**Number of Customers For whom Deatils needed.
Describe table I_CINFO lines l_recs.
l_recs1 = l_recs.
Concatenate Ltext1 l_recs1 Ltext2 into l_text separated by ' '.
PERFORM GET_PGRESS_INDICATOR USING l_text l_pct.
***If records are more than 200000, should be processed batch-wise
If l_recs > recs.
l_batch_recs = abs( l_recs / b_count ).
Do b_count times.
loop at i_cinfo INTO S_CINFO from l_S_REC to l_batch_recs.
**Remember the row
sytabix = sy-tabix.
**Compute DSO
PERFORM GET_DSO_FIELD .
Compute rest credit history data.
PERFORM COMPUTE_SFIELDS.
endloop.
l_S_REC = l_S_REC + l_batch_recs.
l_batch_recs = l_batch_recs + l_batch_recs.
IF l_batch_recs ge l_recs.
l_batch_recs = l_recs.
eNDIF.
Commit up to here to release the DB locks.
Commit work.
enddo.
else.
loop at i_cinfo INTO S_CINFO.
**Remember the row
sytabix = sy-tabix.
**Compute DSO
PERFORM GET_DSO_FIELD .
Compute rest credit history data.
PERFORM COMPUTE_SFIELDS.
endloop.
Endif.
ENDFORM. " GET_CREDIT_DATA
*& Form GET_KNKK_DATA
text
-->P_ICUST_KUNNR text
FORM GET_KNKK_DATA .
if icust1[] is not initial.
SELECT KUNNR KNKLI KKBER CTLPC KLIMK
SBGRP ERDAT DTREV REVDB
from KNKK into corresponding fields of table I_Cinfo
for all entries in icust1
where kunnr = icust1-kunnr.
Delete Adjacent duplicates from i_cinfo comparing kunnr.
endif.
**Free Memory for internal table icust1.
Free icust1.
ENDFORM. " GET_KNKK_DATA
**& Form GET_DSO_FIELD
text
--> p1 text
<-- p2 text
FORM GET_DSO_FIELD .
***Determine DSO Parameter
PERFORM DSO_PARAMETER.
***Compute DSO
CALL FUNCTION 'CUSTOMER_DSO_CALCULATION'
EXPORTING
I_KKBER = s_cinfo-kkber
I_KUNNR = s_cinfo-kunnr
I_ANZBUPER = T000CM-DSOPP
I_XCHILDS = T000CM-DSOCH
I_ACTBALANCE = T000CM-DSOAB
IMPORTING
E_DSOIN = RF02L-DSOIN
EXCEPTIONS
ERROR_MESSAGE = 1.
ENDFORM. " GET_DSO_FIELD
*& Form DSO_PARAMETER
text
--> p1 text
<-- p2 text
FORM DSO_PARAMETER.
IF T000CM-DSOPP IS INITIAL.
SELECT SINGLE * FROM T000CM.
IF SY-SUBRC EQ 0.
IF T000CM-DSOPP IS INITIAL.
T000CM-DSOPP = '003'.
ENDIF.
ELSE.
T000CM-DSOPP = '003'.
T000CM-DSOCH = ' '.
T000CM-DSOAB = 'X'.
ENDIF.
ENDIF.
ENDFORM. " DSO_PARAMETER
--> p1 text
<-- p2 text
FORM PERIODE_ERMITTELN_EXC USING
P03_BUDAT LIKE SYST-DATUM
P03_GJAHR LIKE KNC1-GJAHR
P03_MONAT LIKE MONAT.
CALL FUNCTION 'FI_PERIOD_DETERMINE'
EXPORTING
I_BUDAT = P03_BUDAT
I_PERIV = T001-PERIV
I_BUKRS = T001-BUKRS
I_GJAHR = P03_GJAHR
I_MONAT = P03_MONAT
IMPORTING
E_GJAHR = P03_GJAHR
E_MONAT = P03_MONAT
EXCEPTIONS
ERROR_MESSAGE = 1.
ENDFORM. "PERIODE_ERMITTELN_EXC
*& Form COMPUTE_SFIELDS
text
--> p1 text
<-- p2 text
FORM COMPUTE_SFIELDS .
**Compute Balance
PERFORM GET_SFIELDS .
S_CINFO-DSOIN = RF02L-DSOIN.
S_CINFO-SALDO = RF035-SALDO.
S_CINFO-H06SA = RF035-H06SA.
S_CINFO-H06JA = RF035-H06JA.
S_CINFO-H06MO = RF035-H06MO.
S_CINFO-H12SA = RF035-H12SA.
S_CINFO-H12JA = RF035-H12JA.
S_CINFO-H12MO = RF035-H12MO.
S_CINFO-UMP2U = RF42B-UMP2U.
S_CINFO-UMP1U = RF42B-UMP1U.
S_CINFO-SFAEL = RF035-SFAEL.
S_CINFO-SFAE1 = RF035-SFAE1.
S_CINFO-SFAE2 = RF035-SFAE2.
S_CINFO-SFAE3 = RF035-SFAE3.
S_CINFO-SFAE4 = RF035-SFAE4.
S_CINFO-SFAE5 = RF035-SFAE5.
modify..
MODIFY I_CINFO FROM S_CINFO INDEX sytabix.
CLEAR: S_CINFO,RF035,RF02L, RF42B.
ENDFORM. " COMPUTE_SFIELDS
text
-->P_C_INFO_KUNNR text
FORM GET_CUST_BAL_INFO.
LOOP AT TCMTAB.
CALL FUNCTION 'FI_COMPANY_CODE_DATA'
EXPORTING
I_BUKRS = TCMTAB-BUKRS
IMPORTING
E_T001 = T001
EXCEPTIONS
ERROR_MESSAGE = 1.
IF SY-SUBRC = 0.
MOVE-CORRESPONDING T001 TO BUKTAB.
BUKTAB-KKBER = TCMTAB-KKBER.
COLLECT BUKTAB.
ENDIF.
ENDLOOP.
LOOP AT BUKTAB WHERE PERIV NE SPACE.
GJATAB-PERIV = BUKTAB-PERIV.
COLLECT GJATAB.
ENDLOOP.
CLEAR: MONAT.
LOOP AT GJATAB.
T001-PERIV = GJATAB-PERIV.
CLEAR: GJAHR, MONAT.
PERFORM PERIODE_ERMITTELN_EXC USING SY-DATLO GJAHR MONAT.
CHECK SY-SUBRC = 0.
GJATAB-GJAHR = GJAHR.
GJATAB-MONAT = MONAT.
SELECT SINGLE * FROM T009 WHERE PERIV = GJATAB-PERIV.
IF SY-SUBRC = 0.
GJATAB-ANZBP = T009-ANZBP.
ENDIF.
MODIFY GJATAB.
ENDLOOP.
LOOP AT BUKTAB.
CHECK NOT ( BUKTAB-PERIV IS INITIAL ).
READ TABLE GJATAB WITH KEY BUKTAB-PERIV.
CHECK SY-SUBRC = 0
AND NOT ( GJATAB-GJAHR IS INITIAL ).
CALL FUNCTION 'CUSTOMER_BALANCE'
EXPORTING
KUNNR = S_cinfo-kunnr
BUKRS = BUKTAB-BUKRS
GJAHR = GJATAB-GJAHR
MONAT = GJATAB-MONAT
PERIV = GJATAB-PERIV
ANZBP = GJATAB-ANZBP
XH6MON = 'X'
XH12MON = 'X'
IMPORTING
UMP2U = RF42B-UMP2U
VMP2U = RF42B-UMP1U
SALDO = RF035-SALDO
UML01 = SALDO-UML01
UML02 = SALDO-UML02
UML03 = SALDO-UML03
UML04 = SALDO-UML04
UML05 = SALDO-UML05
UML06 = SALDO-UML06
UML07 = SALDO-UML07
UML08 = SALDO-UML08
UML09 = SALDO-UML09
UML10 = SALDO-UML10
UML11 = SALDO-UML11
UML12 = SALDO-UML12
EXCEPTIONS
NO_BALANCE = 4.
IF SY-SUBRC = 0.
SKNKK-UMP1U = SKNKK-UMP1U + RF42B-UMP1U.
SKNKK-UMP2U = SKNKK-UMP2U + RF42B-UMP2U.
SKNKK-SALDO = SKNKK-SALDO + RF035-SALDO.
SKNKK-UML01 = SKNKK-UML01 + SALDO-UML01.
SKNKK-UML02 = SKNKK-UML02 + SALDO-UML02.
SKNKK-UML03 = SKNKK-UML03 + SALDO-UML03.
SKNKK-UML04 = SKNKK-UML04 + SALDO-UML04.
SKNKK-UML05 = SKNKK-UML05 + SALDO-UML05.
SKNKK-UML06 = SKNKK-UML06 + SALDO-UML06.
SKNKK-UML07 = SKNKK-UML07 + SALDO-UML07.
SKNKK-UML08 = SKNKK-UML08 + SALDO-UML08.
SKNKK-UML09 = SKNKK-UML09 + SALDO-UML09.
SKNKK-UML10 = SKNKK-UML10 + SALDO-UML10.
SKNKK-UML11 = SKNKK-UML11 + SALDO-UML11.
SKNKK-UML12 = SKNKK-UML12 + SALDO-UML12.
ENDIF.
ENDLOOP.
ENDFORM. "
*& Form GET_SFIELDS
text
--> p1 text
<-- p2 text
FORM GET_SFIELDS .
sknkk-kunnr = S_CINFO-KUNNR.
**Clear target to store computed values
CLEAR: RF035.
**Compute Balance fields
PERFORM GET_CUST_BAL_INFO.
REFRESH: SALTAB.
SALTAB-LNUMM = '01'. SALTAB-SALDO = SKNKK-UML01. APPEND SALTAB.
SALTAB-LNUMM = '02'. SALTAB-SALDO = SKNKK-UML02. APPEND SALTAB.
SALTAB-LNUMM = '03'. SALTAB-SALDO = SKNKK-UML03. APPEND SALTAB.
SALTAB-LNUMM = '04'. SALTAB-SALDO = SKNKK-UML04. APPEND SALTAB.
SALTAB-LNUMM = '05'. SALTAB-SALDO = SKNKK-UML05. APPEND SALTAB.
SALTAB-LNUMM = '06'. SALTAB-SALDO = SKNKK-UML06. APPEND SALTAB.
SALTAB-LNUMM = '07'. SALTAB-SALDO = SKNKK-UML07. APPEND SALTAB.
SALTAB-LNUMM = '08'. SALTAB-SALDO = SKNKK-UML08. APPEND SALTAB.
SALTAB-LNUMM = '09'. SALTAB-SALDO = SKNKK-UML09. APPEND SALTAB.
SALTAB-LNUMM = '10'. SALTAB-SALDO = SKNKK-UML10. APPEND SALTAB.
SALTAB-LNUMM = '11'. SALTAB-SALDO = SKNKK-UML11. APPEND SALTAB.
SALTAB-LNUMM = '12'. SALTAB-SALDO = SKNKK-UML12. APPEND SALTAB.
READ TABLE SALTAB INDEX 1.
RF035-H06SA = SALTAB-SALDO.
RF035-H06MO = SALTAB-LNUMM.
RF035-H12SA = SALTAB-SALDO.
RF035-H12MO = SALTAB-LNUMM.
------ SALTAB ---------------------------------------------
LOOP AT SALTAB.
IF SALTAB-SALDO > RF035-H06SA
AND SY-TABIX < 7.
RF035-H06SA = SALTAB-SALDO.
RF035-H06MO = SALTAB-LNUMM.
ENDIF.
IF SALTAB-SALDO > RF035-H12SA
AND SY-TABIX < 13.
RF035-H12SA = SALTAB-SALDO.
RF035-H12MO = SALTAB-LNUMM.
ENDIF.
ENDLOOP.
------ Period--------------------
REFRESH LT_PERIODS.
CLEAR LD_COUNTER.
READ TABLE BUKTAB INDEX 1.
IF SY-SUBRC = 0.
READ TABLE GJATAB WITH KEY BUKTAB-PERIV.
DO GJATAB-MONAT TIMES
VARYING LD_PERIOD FROM LD_PERIODS(2) NEXT LD_PERIODS+2(2)
RANGE LD_PERIODS.
LT_PERIODS-GJAHR = GJATAB-GJAHR.
LT_PERIODS-PERIOD = LD_PERIOD.
LD_COUNTER = LD_COUNTER + 1.
APPEND LT_PERIODS.
ENDDO.
IF LD_COUNTER LT 12.
LD_GJAHR = GJATAB-GJAHR - 1.
CLEAR T009Y.
SELECT SINGLE * FROM T009Y WHERE PERIV = GJATAB-PERIV
AND GJAHR = LD_GJAHR.
DO GJATAB-ANZBP TIMES
VARYING LD_PERIOD FROM LD_PERIODS(2) NEXT LD_PERIODS+2(2)
RANGE LD_PERIODS.
IF T009Y-ANZBP > 0.
CHECK SY-INDEX <= T009Y-ANZBP.
ENDIF.
LD_COUNTER = LD_COUNTER + 1.
LT_PERIODS-GJAHR = LD_GJAHR.
LT_PERIODS-PERIOD = LD_PERIOD.
APPEND LT_PERIODS.
ENDDO.
ENDIF.
IF LD_COUNTER LT 12.
LD_GJAHR = LD_GJAHR - 1.
DO GJATAB-ANZBP TIMES
VARYING LD_PERIOD FROM LD_PERIODS(2) NEXT LD_PERIODS+2(2)
RANGE LD_PERIODS.
LD_COUNTER = LD_COUNTER + 1.
LT_PERIODS-GJAHR = LD_GJAHR.
LT_PERIODS-PERIOD = LD_PERIOD.
APPEND LT_PERIODS.
ENDDO.
ENDIF.
SORT LT_PERIODS BY GJAHR ASCENDING PERIOD ASCENDING.
LD_COUNTER = LD_COUNTER - 12.
DO LD_COUNTER TIMES.
DELETE LT_PERIODS INDEX 1.
ENDDO.
SORT LT_PERIODS BY GJAHR DESCENDING PERIOD DESCENDING.
READ TABLE LT_PERIODS INDEX RF035-H06MO.
RF035-H06MO = LT_PERIODS-PERIOD.
RF035-H06JA = LT_PERIODS-GJAHR.
READ TABLE LT_PERIODS INDEX RF035-H12MO.
RF035-H12MO = LT_PERIODS-PERIOD.
RF035-H12JA = LT_PERIODS-GJAHR.
ENDIF.
**Compute Due Dates fields
PERFORM GET_AGING_BUCKETS .
RF035-SFAE1 = SKNKK-SFAE1.
RF035-SFAE2 = SKNKK-SFAE2.
RF035-SFAE3 = SKNKK-SFAE3.
RF035-SFAE4 = SKNKK-SFAE4 .
RF035-SFAE5 = SKNKK-SFAE5.
ENDLOOP.
ENDFORM. " GET_BALANCE_SFIELDS
*& Form GET_AGING_BUCKETS
text
--> p1 text
<-- p2 text
FORM GET_AGING_BUCKETS .
DATA: BEGIN OF LT_BUKRS OCCURS 0,
BUKRS LIKE T001-BUKRS,
END OF LT_BUKRS.
DATA: BEGIN OF LT_BUKTAB OCCURS 0,
BUKRS LIKE T001-BUKRS,
WAERS LIKE T001-WAERS,
KKBER LIKE T014-KKBER,
END OF LT_BUKTAB.
DATA: LD_LINES LIKE SY-TABIX.
*...performance optimization: for more than one company codes check....*
*...if balances exist and avoid selection of open items, if they don't.*
*...exist..............................................................*
REFRESH LT_BUKRS.
REFRESH LT_BUKTAB.
DESCRIBE TABLE BUKTAB LINES LD_LINES.
IF LD_LINES GT 1.
SELECT DISTINCT BUKRS APPENDING CORRESPONDING FIELDS
OF TABLE LT_BUKRS
FROM KNC1 FOR ALL ENTRIES IN BUKTAB
WHERE BUKRS = BUKTAB-BUKRS AND
KUNNR = Sknkk-KUNNR.
SELECT DISTINCT BUKRS APPENDING CORRESPONDING FIELDS
OF TABLE LT_BUKRS
FROM KNC3 FOR ALL ENTRIES IN BUKTAB
WHERE BUKRS = BUKTAB-BUKRS AND
KUNNR = Sknkk-KUNNR.
SORT LT_BUKRS.
DELETE ADJACENT DUPLICATES FROM LT_BUKRS.
LOOP AT LT_BUKRS.
LOOP AT BUKTAB WHERE BUKRS = LT_BUKRS-BUKRS.
MOVE-CORRESPONDING BUKTAB TO LT_BUKTAB.
APPEND LT_BUKTAB.
ENDLOOP.
ENDLOOP.
ELSE.
READ TABLE BUKTAB INDEX 1.
MOVE-CORRESPONDING BUKTAB TO LT_BUKTAB.
APPEND LT_BUKTAB.
ENDIF.
*...process company codes for customer given by interface..........*
LOOP AT LT_BUKTAB WHERE KKBER = s_cinfo-KKBER.
CALL FUNCTION 'CUSTOMER_DUE_DATE_ANALYSIS'
EXPORTING BUKRS = LT_BUKTAB-BUKRS
KKBER = ' '
KKBER = s_cinfo-KKBER
KUNNR = Sknkk-KUNNR
RASID = RASID
IMPORTING SFAE1 = RF035-SFAE1
SFAE2 = RF035-SFAE2
SFAE3 = RF035-SFAE3
SFAE4 = RF035-SFAE4
SFAE5 = RF035-SFAE5
SFAEL = RF035-SFAEL
EXCEPTIONS NO_OPEN_ITEMS = 4.
IF SY-SUBRC = 0.
*-- RF035 -
SKNKK-SFAE1 = SKNKK-SFAE1 + RF035-SFAE1.
SKNKK-SFAE2 = SKNKK-SFAE2 + RF035-SFAE2.
SKNKK-SFAE3 = SKNKK-SFAE3 + RF035-SFAE3.
SKNKK-SFAE4 = SKNKK-SFAE4 + RF035-SFAE4.
SKNKK-SFAE5 = SKNKK-SFAE5 + RF035-SFAE5.
SKNKK-SFAE5 = SKNKK-SFAE5 + RF035-SFAE5.
SKNKK-SFAEL = SKNKK-SFAEL + RF035-SFAEL.
ENDIF.
ENDLOOP.
ENDFORM. " GET_AGING_BUCKETS
*& Form header
This Subroutine gets data for displaying title *
There are no interface parameters to be passed to this subroutine. *
FORM header .
wa_final-string = text-000. APPEND wa_final TO i_final.
wa_final-string = text-001. APPEND wa_final TO i_final.
wa_final-string = text-002. APPEND wa_final TO i_final.
wa_final-string = text-003. APPEND wa_final TO i_final.
wa_final-string = text-004. APPEND wa_final TO i_final.
wa_final-string = text-005. APPEND wa_final TO i_final.
wa_final-string = text-006. APPEND wa_final TO i_final.
wa_final-string = text-007. APPEND wa_final TO i_final.
wa_final-string = text-008. APPEND wa_final TO i_final.
wa_final-string = text-009. APPEND wa_final TO i_final.
wa_final-string = text-010. APPEND wa_final TO i_final.
wa_final-string = text-011. APPEND wa_final TO i_final.
wa_final-string = text-012. APPEND wa_final TO i_final.
wa_final-string = text-013. APPEND wa_final TO i_final.
wa_final-string = text-014. APPEND wa_final TO i_final.
wa_final-string = text-015. APPEND wa_final TO i_final.
wa_final-string = text-016. APPEND wa_final TO i_final.
wa_final-string = text-017. APPEND wa_final TO i_final.
wa_final-string = text-018. APPEND wa_final TO i_final.
wa_final-string = text-019. APPEND wa_final TO i_final.
wa_final-string = text-020. APPEND wa_final TO i_final.
wa_final-string = text-021. APPEND wa_final TO i_final.
wa_final-string = text-022. APPEND wa_final TO i_final.
wa_final-string = text-023. APPEND wa_final TO i_final.
wa_final-string = text-024. APPEND wa_final TO i_final.
ENDFORM. " header
*& Form DOWNLOADCREDITDATA
text
-->P_P_PATH text
FORM DOWNLOADCREDITDATA USING P_PATH.
DATA:
lw_file2 TYPE string . " File Path
lw_file2 = p_PATH.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = BIN_FILESIZE
filename = lw_file2
filetype = 'DBF'
APPEND = ' '
write_field_separator = ' '
HEADER = '00'
TRUNC_TRAILING_BLANKS = 'X'
WRITE_LF = 'X'
COL_SELECT = 'X'
COL_SELECT_MASK = ' '
DAT_MODE = 'X'
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
TRUNC_TRAILING_BLANKS_EOL = 'X'
WK1_N_FORMAT = '0'
WK1_N_SIZE = ' '
WK1_T_FORMAT = ' '
WK1_T_SIZE = ' '
IMPORTING
FILELENGTH = FILELENGTH
TABLES
data_tab = I_CINFO
fieldnames = i_final
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
IF sy-subrc <> 0.
Messege
ENDIF. " IF sy-subrc EQ 0
ENDFORM. " DOWNLOADCREDITDATA
*& Form DOWNLOAD_CREDIT_DATA
text
--> p1 text
<-- p2 text
FORM DOWNLOAD_CREDIT_DATA .
PERFORM HEADER.
PERFORM DOWNLOADCREDITDATA USING P_PATH.
ENDFORM. " DOWNLOAD_CREDIT_DATA
*& Form GET_PGRESS_INDICATOR
text
-->P_L_TEXT text
-->P_L_PCT text
FORM GET_PGRESS_INDICATOR USING L_TEXT
L_PCT.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE = l_pct
TEXT = l_TEXT.
ENDFORM. " GET_PGRESS_INDICATORIf you are just Downloading to a Flat file then why dont you have logic in place for the program to dump the data read into the file to that point depending on any criteria like accounts or customer then clear the internal table and run it in the back ground.
try to use cursor to read the records from the table which will make it a bit more efficient than plain select stement. -
Performance issue in Report (getting time out error)
Hi experts,
I am doing Performance for a Report (getting time out error)
Please see the code below and .
while looping internal table IVBAP after 25 minutes its showing time out error at this poit ->
SELECT MAX( ERDAT ) .
please send alternate code for this .
Advance thanks
from
Nagendra
Get Sales Order Details
CLEAR IVBAP.
REFRESH IVBAP.
SELECT VBELN POSNR MATNR NETWR KWMENG WERKS FROM VBAP
INTO CORRESPONDING FIELDS OF TABLE IVBAP
FOR ALL ENTRIES IN IVBAK
WHERE VBELN = IVBAK-VBELN
AND MATNR IN Z_MATNR
AND WERKS IN Z_WERKS
AND ABGRU = ' '.
Check for Obsolete Materials - Get Product Hierarhy/Mat'l Description
SORT IVBAP BY MATNR WERKS.
CLEAR: WK_MATNR, WK_WERKS, WK_PRDHA, WK_MAKTX,
WK_BLOCK, WK_MMSTA, WK_MSTAE.
LOOP AT IVBAP.
CLEAR WK_INVDATE. "I6677.sn
SELECT MAX( ERDAT ) FROM VBRP INTO WK_INVDATE WHERE
AUBEL EQ IVBAP-VBELN AND
AUPOS EQ IVBAP-POSNR.
IF SY-SUBRC = 0.
MOVE WK_INVDATE TO IVBAP-INVDT.
MODIFY IVBAP.
ENDIF. "I6677.e n
SELECT SINGLE * FROM MBEW WHERE "I6759.sn
MATNR EQ IVBAP-MATNR AND
BWKEY EQ IVBAP-WERKS AND
BWTAR EQ SPACE.
IF SY-SUBRC = 0.
MOVE MBEW-STPRS TO IVBAP-STPRS.
IVBAP-TOT = MBEW-STPRS * IVBAP-KWMENG.
MODIFY IVBAP.
ENDIF. "I6759.en
IF IVBAP-MATNR NE WK_MATNR OR IVBAP-WERKS NE WK_WERKS.
CLEAR: WK_BLOCK, WK_MMSTA, WK_MSTAE, WK_PRDHA, WK_MAKTX.
MOVE IVBAP-MATNR TO WK_MATNR.
MOVE IVBAP-WERKS TO WK_WERKS.
SELECT SINGLE MMSTA FROM MARC INTO MARC-MMSTA
WHERE MATNR = WK_MATNR
AND WERKS = WK_WERKS.
IF NOT MARC-MMSTA IS INITIAL.
MOVE '*' TO WK_MMSTA.
ENDIF.
SELECT SINGLE LVORM PRDHA MSTAE MSTAV FROM MARA
INTO (MARA-LVORM, MARA-PRDHA, MARA-MSTAE, MARA-MSTAV)
WHERE MATNR = WK_MATNR.
IF ( NOT MARA-MSTAE IS INITIAL ) OR
( NOT MARA-MSTAV IS INITIAL ) OR
( NOT MARA-LVORM IS INITIAL ).
MOVE '*' TO WK_MSTAE.
ENDIF.
MOVE MARA-PRDHA TO WK_PRDHA.
SELECT SINGLE MAKTX FROM MAKT INTO WK_MAKTX
WHERE MATNR = WK_MATNR
AND SPRAS = SY-LANGU.
ENDIF.
IF Z_BLOCK EQ 'B'.
IF WK_MMSTA EQ ' ' AND WK_MSTAE EQ ' '.
DELETE IVBAP.
CONTINUE.
ENDIF.
ELSEIF Z_BLOCK EQ 'U'.
IF WK_MMSTA EQ '' OR WK_MSTAE EQ ''.
DELETE IVBAP.
CONTINUE.
ENDIF.
ELSE.
IF WK_MMSTA EQ '' OR WK_MSTAE EQ ''.
MOVE '*' TO WK_BLOCK.
ENDIF.
ENDIF.
IF WK_PRDHA IN Z_PRDHA. "I4792
MOVE WK_BLOCK TO IVBAP-BLOCK.
MOVE WK_PRDHA TO IVBAP-PRDHA.
MOVE WK_MAKTX TO IVBAP-MAKTX.
MODIFY IVBAP.
ELSE. "I4792
DELETE IVBAP. "I4792
ENDIF. "I4792
IF NOT Z_ALNUM[] IS INITIAL. "I9076
SELECT SINGLE * FROM MAEX "I9076
WHERE MATNR = IVBAP-MATNR "I9076
AND ALNUM IN Z_ALNUM. "I9076
IF SY-SUBRC <> 0. "I9076
DELETE IVBAP. "I9076
ENDIF. "I9076
ENDIF. "I9076
ENDLOOP.Hi Nagendra!
Get Sales Order Details
CLEAR IVBAP.
REFRESH IVBAP.
check ivbak is not initial
SELECT VBELN POSNR MATNR NETWR KWMENG WERKS FROM VBAP
INTO CORRESPONDING FIELDS OF TABLE IVBAP
FOR ALL ENTRIES IN IVBAK
WHERE VBELN = IVBAK-VBELN
AND MATNR IN Z_MATNR
AND WERKS IN Z_WERKS
AND ABGRU = ' '.
Check for Obsolete Materials - Get Product Hierarhy/Mat'l Description
SORT IVBAP BY MATNR WERKS.
CLEAR: WK_MATNR, WK_WERKS, WK_PRDHA, WK_MAKTX,
WK_BLOCK, WK_MMSTA, WK_MSTAE.
avoid select widin loop. instead do selection outside loop.u can use read statement......and then loop if required.
LOOP AT IVBAP.
CLEAR WK_INVDATE. "I6677.sn
SELECT MAX( ERDAT ) FROM VBRP INTO WK_INVDATE WHERE
AUBEL EQ IVBAP-VBELN AND
AUPOS EQ IVBAP-POSNR.
IF SY-SUBRC = 0.
MOVE WK_INVDATE TO IVBAP-INVDT.
MODIFY IVBAP.
ENDIF. "I6677.e n
SELECT SINGLE * FROM MBEW WHERE "I6759.sn
MATNR EQ IVBAP-MATNR AND
BWKEY EQ IVBAP-WERKS AND
BWTAR EQ SPACE.
IF SY-SUBRC = 0.
MOVE MBEW-STPRS TO IVBAP-STPRS.
IVBAP-TOT = MBEW-STPRS * IVBAP-KWMENG.
MODIFY IVBAP.
ENDIF. "I6759.en
IF IVBAP-MATNR NE WK_MATNR OR IVBAP-WERKS NE WK_WERKS.
CLEAR: WK_BLOCK, WK_MMSTA, WK_MSTAE, WK_PRDHA, WK_MAKTX.
MOVE IVBAP-MATNR TO WK_MATNR.
MOVE IVBAP-WERKS TO WK_WERKS.
SELECT SINGLE MMSTA FROM MARC INTO MARC-MMSTA
WHERE MATNR = WK_MATNR
AND WERKS = WK_WERKS.
IF NOT MARC-MMSTA IS INITIAL.
MOVE '*' TO WK_MMSTA.
ENDIF.
SELECT SINGLE LVORM PRDHA MSTAE MSTAV FROM MARA
INTO (MARA-LVORM, MARA-PRDHA, MARA-MSTAE, MARA-MSTAV)
WHERE MATNR = WK_MATNR.
IF ( NOT MARA-MSTAE IS INITIAL ) OR
( NOT MARA-MSTAV IS INITIAL ) OR
( NOT MARA-LVORM IS INITIAL ).
MOVE '*' TO WK_MSTAE.
ENDIF.
MOVE MARA-PRDHA TO WK_PRDHA.
SELECT SINGLE MAKTX FROM MAKT INTO WK_MAKTX
WHERE MATNR = WK_MATNR
AND SPRAS = SY-LANGU.
ENDIF.
IF Z_BLOCK EQ 'B'.
IF WK_MMSTA EQ ' ' AND WK_MSTAE EQ ' '.
DELETE IVBAP.
CONTINUE.
ENDIF.
ELSEIF Z_BLOCK EQ 'U'.
IF WK_MMSTA EQ '' OR WK_MSTAE EQ ''.
DELETE IVBAP.
CONTINUE.
ENDIF.
ELSE.
IF WK_MMSTA EQ '' OR WK_MSTAE EQ ''.
MOVE '*' TO WK_BLOCK.
ENDIF.
ENDIF.
IF WK_PRDHA IN Z_PRDHA. "I4792
MOVE WK_BLOCK TO IVBAP-BLOCK.
MOVE WK_PRDHA TO IVBAP-PRDHA.
MOVE WK_MAKTX TO IVBAP-MAKTX.
MODIFY IVBAP.
ELSE. "I4792
DELETE IVBAP. "I4792
ENDIF. "I4792
IF NOT Z_ALNUM[] IS INITIAL. "I9076
SELECT SINGLE * FROM MAEX "I9076
WHERE MATNR = IVBAP-MATNR "I9076
AND ALNUM IN Z_ALNUM. "I9076
IF SY-SUBRC 0. "I9076
DELETE IVBAP. "I9076
ENDIF. "I9076
ENDIF. "I9076
endloop.
U have used many select queries widin loop-endloop which is a big hindrance as far as performance is concerned.Avoid such practice.
Thanks
Deepika
Maybe you are looking for
-
Input Field: Value Range in IP Web Layout
Hi Experts, I've created a Web Layout based on IP with a copy function (e.g. from actual 2008 to plan2009) over 12 calendar months. For choosing the months to be copied, I created a Variable (calmonths) and added an Input Field into my layout to ente
-
Automated report email notification using SCCM 2012
For SCCM mail notification using Office365 exchange. Is smtp rely required.. Please suggest and provide link
-
Dashboard in BEx 7.0 Excel Analyzer
I have to develop a dashboard with 7 queries embedded in a single worksheet. All queries have output in the form of tables (grid analysis). I know, how to do that. But, is following a possibility : 1. Keeping size of each table fixed, so I can have w
-
Subunit of time below a second in PE11?
Hi folks, I notice that PE11 has a unit of time below a second, which is divided into 30 parts. I had always assumed one would simply use decimals if they need subdivsions of a second, such as 4.5 seconds. So that a timepoint of 2 hours, 3 minutes an
-
Scope Question - ratios?
Hi all, A question about the scope when calculating ratios. If I have a report and introduce breaks to get sub-totals, when I total the columns, WebI puts sum(column_value) in the totals fields. If I then have a column which computes a percentage of