Skip to Content
0
Former Member
Sep 22, 2008 at 11:46 PM

How to change the Function Module to get the data from another table ??

111 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. What should I change to fix the error in the newly added code ??

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

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

.

.

  • Get billing document header and item details

REFRESH i_billing.

SELECT vbeln

fkart

waerk

vkorg

vtweg

fkdat

bukrs

netwr

erdat

kunag

spart

xblnr

vkont

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