Skip to Content
0
Former Member
Sep 23, 2008 at 02:42 AM

How to change the Function Module to get AUART from VBAK table ??

273 Views

Hi all,

We have a Function Module for the Custom Extractor to get the data from VBRK & VBFA tables. I want to add the code to enhance it to get AUART from VBAK table also. The new code is at the end and it gives 'the field I_VBAK is unknown' . Sorry, complete code is not provided here. How can I fix this error, PLEASE ?

**********************************************************

Declaration of internal table and work areas

DATA:l_r_vbeln TYPE STANDARD TABLE OF t_vbeln_range,

l_r_vkorg TYPE STANDARD TABLE OF t_vkorg_range,

l_r_vbeln_vf TYPE STANDARD TABLE OF t_vbeln_vf_range,

l_r_bukrs TYPE STANDARD TABLE OF t_bukrs_range,

l_r_fkdat TYPE STANDARD TABLE OF t_fkdat_range,

l_wa_fkdat TYPE t_fkdat_range,

l_wa_bukrs TYPE t_bukrs_range,

l_wa_vbeln_vf TYPE t_vbeln_vf_range,

l_wa_vkorg TYPE t_vkorg_range,

l_wa_vbeln TYPE t_vbeln_range,

l_whereclause TYPE string.

.

.

CONCATENATE 'vbeln IN l_r_vbeln_vf' "Billing

'AND fkdat IN l_r_fkdat' "Billing date

'AND bukrs IN l_r_bukrs' "Company code

'AND vkorg IN l_r_vkorg' "Sales organization

'AND ( ( erdat = v_date1 AND erzet >= v_time1 ) OR erdat GE v_date2 ).' INTO l_whereclause

SEPARATED BY space..

.

Get billing document header and item details

REFRESH i_billing.

SELECT vbeln

fkart

waerk

vkorg

vtweg

fkdat

bukrs

FROM vbrk

PACKAGE SIZE l_c_pack

APPENDING TABLE i_billing

WHERE (l_whereclause).

IF sy-subrc EQ 0.

SORT i_billing.

ENDIF.

Get Document Flow

REFRESH i_vbfa.

SELECT vbelv

posnv

vbeln

posnn

vbtyp_n

vbtyp_v

fplnr

fpltr

FROM vbfa

APPENDING TABLE i_vbfa

FOR ALL ENTRIES IN i_billing

WHERE vbelv IN l_r_vbeln

AND vbeln EQ i_billing-vbeln

AND vbtyp_n EQ 'M'

AND vbtyp_v EQ 'G'.

IF sy-subrc EQ 0.

SORT i_vbfa.

ENDIF.

  • New Changes Starts

  • Get Sales Document Type from Sales Header

REFRESH i_vbak.

SELECT auart

FROM vbak

APPENDING TABLE i_vbak

FOR ALL ENTRIES IN i_billing

WHERE vbeln EQ i_vbfa-vbelv.

IF sy-subrc EQ 0.

SORT i_vbak.

ENDIF.

  • New Changes Ends *****************

Thanks in advance.

Regards,

Venkat