on 09-23-2008 3:42 AM
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
Your code is as shown below:
REFRESH i_vbak.
SELECT auart
FROM vbak
APPENDING TABLE i_vbak
FOR ALL ENTRIES IN i_billing
WHERE vbeln EQ i_vbfa-vbelv.
*
Your code should be changed as:
SELECT auart
FROM vbak
APPENDING TABLE i_vbak
FOR ALL ENTRIES IN i_billing
WHERE vbeln EQ i_billing-vbeln.
You need to give as I_BILLING-VBELN and not I_VBFA-vbelv.
Also, you cant give the Billing document as the condition to fetch AUART from VBAK, since VBAK is the Sales Document Header.
Please use different logic to fetch the value.
Let me know, if you need further help
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.