‎2009 Feb 06 7:29 AM
Hi all genious,
Actually i have got a strange kind of problem, actually there is a custom program which picks value from Mard table and display the one fied with repect to the material numbers and the same value we can see via the MMBE transaction also. actually sometimess the the field value comes as zero even though the value exists in MMBE transaction, Different times the different material gives the field value as zero.and most of the times the output is perfectly fine.
Actually there is select endselect statement has been written on the MARD table. i guess sometimes it is not able to read the database table. What shall i do?? i am planning to put do and enddo statement outside the select endselect stament. so that even if sometimes the database access fails the next time it will be fine. I am not able to find any other problem in the program.
It will be a great help.
Regards,
Nikesh Kumar
‎2009 Feb 06 7:31 AM
hi,
Could you paste your select query here so that it can be evaluated.
and
PS. Never ever put your select-endselect between a do and enddo..it creates a severe performance degradation of your code.
Hope this is helpfull..
thanks
Sharath
‎2009 Feb 06 7:35 AM
Actually it is a client data so i cannot paste it, m really sorry, m scared a bit. actually that zero in that field is not uniform so m not sure if it is problem with coding, m not able to debug also the code dumps if we debug between select end select satement.
‎2009 Feb 06 7:39 AM
zl_old_matnr = 'z'.
CLEAR : zl_labst_hd, zl_labst_sd, zl_speme_hd, zl_speme_sd.
SELECT matnr lgort labst speme FROM mard
INTO (zl_matnr,zl_lgort,zl_labst,zl_speme)
WHERE werks = p_werks
AND ( lgort = p_lg_hd OR lgort = p_lg_sd ).
IF zl_old_matnr NE zl_matnr AND sy-dbcnt NE 1.
READ TABLE tab_header_record WITH KEY matnr = zl_old_matnr
BINARY SEARCH.
IF sy-subrc = 0.
On complète TAB_HEADER_RECORD avec les infos de stock
tab_header_record-labst_hd = zl_labst_hd.
tab_header_record-speme_hd = zl_speme_hd.
tab_header_record-labst_sd = zl_labst_sd.
tab_header_record-speme_sd = zl_speme_sd.
MODIFY tab_header_record INDEX sy-tabix.
ELSE.
Si l'article n'a pas été envoyé dans le fichier
DATA : zl_stock LIKE mard-labst.
zl_stock = zl_labst_hd + zl_speme_hd
+ zl_labst_sd + zl_speme_sd.
IF NOT ( zl_stock IS INITIAL ).
On remplit la table avec articles stock<>0 dans SAP et non envoyés
ADD 1 TO w_compteur_ligne.
CLEAR tab_edit.
tab_edit-matnr = zl_old_matnr.
SELECT SINGLE maktx FROM makt INTO tab_edit-maktx
WHERE matnr = zl_old_matnr
AND spras = k_spras.
tab_edit-qty_pds = 0.
tab_edit-qty_sap = zl_stock.
tab_edit-qty_ecart = zl_stock.
tab_edit-observation = 'Absent de INVRPT !'.
DATA : zl_labst2 LIKE mard-labst.
zl_labst2 = zl_labst_hd + zl_labst_sd.
IF zl_labst2 IS INITIAL.
tab_edit-type_stock = 'xyz'.
ELSE.
tab_edit-type_stock = 'abc'.
ENDIF.
APPEND tab_edit.
ENDIF.
ENDIF.
CLEAR : zl_labst_hd, zl_labst_sd, zl_speme_hd, zl_speme_sd.
ENDIF.
zl_old_matnr = zl_matnr.
IF zl_lgort = p_lg_hd.
ADD zl_labst TO zl_labst_hd.
ADD zl_speme TO zl_speme_hd.
ELSE.
ADD zl_labst TO zl_labst_sd.
ADD zl_speme TO zl_speme_sd.
ENDIF.
ENDSELECT.
‎2009 Feb 06 8:04 AM
Hi,
Can't see problem in the code. Have you already the pin point scenario when the problem occured? I think you need to debug you code so that you can isolate the the cause.
Regards,
Mon Magallanes
‎2009 Feb 06 8:11 AM
Hi nikesh,
could you please let me know at which statement you are getting the dump is it on the select statement or inside select statement there is a read statement... or somewhere else.
Regards,
Siddarth
‎2009 Feb 06 8:39 AM
One more thing is that field value comes zero only for first 5 fields usually that different materials at different time. Most of the times there is now problem at all
‎2009 Feb 06 10:48 AM
I am sorry I could not get you.... could you please be more specific.
‎2009 Feb 06 7:35 AM
Hi,
Kindly paste your code so we can help out.
Thanks,
Mon Magallanes
‎2009 Feb 06 7:41 AM
Hi,
Try to use the below Conversion routines for MATNR field before SELECT and ENDSELECT statement
CONVERSION_EXIT_MATN1_INPUT
CONVERSION_EXIT_MATN1_OUTPUT
Regards
Bala Krishna
‎2009 Feb 06 7:44 AM
Hi ,
Its fine if you dont want to paste the code,
Firstly write a select query as follows,
select <field1>
<field2>... etc...
from mard
into corresponding fields of <field_string>
where <condition>... if any.
then try to execute your code... if it works fine then please check the fields written in select query and the fields in the internal table are not in the same order may be they are jumbled or your internal table might have an extra field in between them...
Please do let us know whether into corresponding fields of <field_string> is working or not.
Regards,
Siddarth.