Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

problem fetching the data from from VBFA table

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

nishantbansal91
Active Contributor
0 Kudos

Dear Ghazi,

Don't remove leading zero.

Please commented that code.

Thanks

Nishant.

6 REPLIES 6

nishantbansal91
Active Contributor
0 Kudos

Dear Ghazi,

Don't remove leading zero.

Please commented that code.

Thanks

Nishant.

0 Kudos

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.

0 Kudos

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

0 Kudos

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.?

0 Kudos

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.

0 Kudos

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