2015 May 04 7:07 AM
Hi
i have the following code segment in ABAP.
SELECT MKPF~XBLNR MKPF~BUDAT MSEG~MATNR MSEG~MENGE MSEG~SHKZG MSEG~BWART INTO
corresponding fields of TABLE LIT_MDOC
from ( MSEG
inner join MKPF
on MKPF~MBLNR = MSEG~MBLNR
and MKPF~MJAHR = MSEG~MJAHR
)
where
MSEG~KUNNR in s_kunnr
AND MSEG~WERKS = p_werks
and MKPF~budat in s_ersda
AND MSEG~sobkz = 'W'
and MSEG~BWART eq '631'.
Loop at lit_mdoc into ls_mdoc.
SHIFT ls_mdoc-xblnr LEFT DELETING LEADING '0'.
ls_mdoc-vbelv = ls_mdoc-xblnr.
modify lit_mdoc from ls_mdoc TRANSPORTING xblnr vbelv.
clear ls_mdoc.
endloop.
SELECT vbelv vbeln
INTO CORRESPONDING FIELDS OF TABLE lit_invdet FROM vbfa
FOR ALL ENTRIES IN lit_mdoc
where VBELV = lit_mdoc-vbelv.
IF sy-subrc = 0.
Here sy-subrc returns 4 . No data is being fetched from vbfa . why i am unable to undertstand. i have removed the leading zeros from xblnr above and placed it value into a filed named vbelv.it is same as vbfa-vbelv .
Please help i am struck in it. your help will be highly appreciated.
Please find below the content of Lit_modc.
2015 May 04 7:12 AM
Dear Ghazi,
Don't remove leading zero.
Please commented that code.
Thanks
Nishant.
2015 May 04 7:12 AM
Dear Ghazi,
Don't remove leading zero.
Please commented that code.
Thanks
Nishant.
2015 May 04 7:17 AM
Dear Nishant
Actually XBLNR contains leading zero and vbelv in vbfa does not contain leading zero. if i dont remove them it wont fetch the data becuase of mismatch. That's why i have removed them.
Please suggest.
2015 May 04 7:23 AM
Dear Ghazi,
If you can check the Domain level Conversion routine SAP use ALPHA routine in the table. Output of the VBFA always be shown without zero due to conversion routine but internally system saved data with ZERO. please check .
Please check VBELN data element.
Thanks
Nishant
2015 May 04 7:41 AM
Thanks a lot Nishant.. you were right it is working now after commneting that line.
But now i am not getting the correct Billing doc no that is supposed to be in VBELN field.
shall i have to use some other conditions in where clause.?
2015 May 04 7:46 AM
Dear Ghazi,
It always be advisable to pass the data leading with zero if the data element contains ALPHA conversion routine. That's my observation.
Thanks
Nishant.
2015 May 04 8:01 AM
Thanks Nishant for your great help. I understood it now .
It has been resolved . i have removed the leading zeros now.
I have got your concept regarding ALPHA conversion routine.
Once again thanks for your valuable suggestions.
Ghazi