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: 

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

Former Member
0 Kudos
210

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos
97

Hi Venkat

Do you have i_vbak defined as a tables parameter in your function module interfacing parameters?

This is the reason why it is not able to identify .

Thanks

Shivika

2 REPLIES 2

Former Member
0 Kudos
98

Hi Venkat

Do you have i_vbak defined as a tables parameter in your function module interfacing parameters?

This is the reason why it is not able to identify .

Thanks

Shivika

Former Member
0 Kudos
97

Hi,

Define the table I_VBAK in DATA declaration.

Regards,

Raju.