Application Development and Automation 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: 
Read only

F-02 BAPI Multiple Items

Former Member
5,557

Hi All The GURUS,

I have made a program for F-02 so that multiple documents can be posted by using the BAPI named BAPI_ACC_DOCUMENT_POST.Everything is working fine and I have seen the document posted successfully with the Transaction FB03.But in that I cannot see the 3 fiels namely EBELN, EBELP and WBS Element. But when I post a single document through F-02 I can see all the 3 fields.

Kindly guide me how can I get these 3 fields filled by my program.

Thanks & Regards,

Bharti Jain

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
4,536

I have seen the table TPS01 and I could not find the FM name Z_INTERFACE_RWBAPI01 in it.

But I can see RWBAPI01-- SAMPLE_INTERFACE_RWBAPI01-- OPEN_FI_PERFORM_RWBAPI01_P -- A--Accounting BAPI Plug-In: User Exit in the resp[ective fields.

I want to go with BTE first and if I didnt get the solution with BTE then I will move to BADi.

The FM name is Z_INTERFACE_RWBAPI01 and the code sample is FUNCTION Z_INTERFACE_RWBAPI01.

*"----


""Local Interface:

*" TABLES

*" IT_ACCIT STRUCTURE ACCIT

*" IT_ACCCR STRUCTURE ACCCR

*" RETURN STRUCTURE BAPIRET2

*" EXTENSION STRUCTURE BAPIACEXTC

*" IT_ACCWT STRUCTURE ACCIT_WT

*" CHANGING

*" VALUE(DOCUMENT_HEADER) LIKE ACCHD STRUCTURE ACCHD

*"----


DATA : WA_EXTENSION TYPE BAPIACEXTC.

CLEAR: WA_EXTENSION.

LOOP AT EXTENSION INTO WA_EXTENSION.

READ TABLE IT_ACCIT WITH KEY EBELN = WA_EXTENSION-FIELD1(10)

EBELP = WA_EXTENSION-FIELD2(5)

PS_PSP_PNR = WA_EXTENSION-FIELD3(8).

IF SY-SUBRC EQ 0.

IT_ACCIT-EBELN = WA_EXTENSION-FIELD1.

IT_ACCIT-EBELP = WA_EXTENSION-FIELD2.

IT_ACCIT-PS_PSP_PNR = WA_EXTENSION-FIELD3.

MODIFY IT_ACCIT INDEX SY-TABIX.

ENDIF.

ENDLOOP.

ENDFUNCTION.

The steps of BTE I have already mention .Is it not configured prooperly

32 REPLIES 32
Read only

Former Member
0 Likes
4,536

Are you passing these values while calling the BAPI ? (ACCOUNTGL-PO_NUMBER, ACCOUNTGL-PO_ITEM, ACCOUNTGL-WBS_ELEMENT)

Read only

Former Member
0 Likes
4,536

data: W_GLDATA TYPE BAPIACGL09 ,

pass your values to the following..

W_GLDATA-WBS_ELEMENT "(WBS Element)

W_GLDATA-PO_NUMBER "Purchasing Document number

W_GLDATA-PO_ITEM "iItem Number of Purchasing Document

Read only

Former Member
0 Likes
4,536

Hi All The GURUS,

First of all thanks for such a prompt response.

I have done all these as suggested by you but I want it in the vendor entry not with the bank entry. It is not coming yet.

Thanks & Regards,

Bharti Jain

Read only

0 Likes
4,536

These fields are not available in Vendor line item structure of BAPI (ACCOUNTPAYABLE). You may have to use the structure EXTENSION1 to populate these values with the help of BTE RWBAPI01. Search SCN to get more details about implementation of this BTE.

Read only

Former Member
0 Likes
4,536

First Of All Thanks,

Please explain how to use the structure EXTENSION1 in this case.

When using F-02 it is working fine and we can see the three fields.

Regards,

Bharti Jain

Read only

0 Likes
4,536

Hi,

check this exit EXIT_SAPLACC4_001. In the program you populate the Extension1 table and in this exit you populate T_ACCIT with the values from Extension table.

Regards,

Krishna

Read only

0 Likes
4,536

Check this Wiki Post which explains the use of BTE RWBAPI01 for updating the fields in Line item data passed from BAPI.

[Business Transaction Event - RWBAPI01 - For Accounting Document Interface|http://wiki.sdn.sap.com/wiki/display/ABAP/BusinessTransactionEvent-RWBAPI01-ForAccountingDocument+Interface.]

Read only

Former Member
0 Likes
4,536

Sorry for misunderstanding.

You are saying that first I should call the function module EXIT_SAPLACC4_001 by populating the tables T_ACCIT, EXTENSION,RETURN and T_ACCWT and then call the FM BAPI_ACC_DOCUMENT_POST by passing EXTENSION1 same as EXTENSION or something else is the case.

I am not getting clear.

Regards,

Bharti Jain

Read only

Former Member
0 Likes
4,536

Hi All The GURUS,

Thanks for guiding me.

You are saying that I should first use the function module EXIT_SAPLACC4_001 and prepare EXTENSION table of it and then call the function module BAPI_ACC_DOCUMENT_POST or what else should I do.

Guide me with a sample code for the same and the steps to use it.

Thanks & Regards,

Bharti Jain

Read only

0 Likes
4,536

Hi,

First in your report program populate the EXTENSION1 table. Then implement the exit EXIT_SAPLACC4_001. This exit will be called from the BAPI. In this EXIT you can access the values that you have populated in EXTENSION1 table from the tables parameter EXTENSION. Now populate the table T_ACCIT with the data from EXTENSION.

Regards,

Krishna

Read only

Former Member
0 Likes
4,536

Hi ALL GURUS,

Thanks for prompt replies.

I have populated the EXTENSION1 in my report as follows:-

MOVE W_ITAB-EBELN TO WA_EXTENSION1-FIELD1.

MOVE W_ITAB-EBELP TO WA_EXTENSION1-FIELD2.

MOVE W_ITAB-POSKI TO WA_EXTENSION1-FIELD3.

APPEND WA_EXTENSION1 TO EXTENSION1.

CLEAR: WA_EXTENSION1.

Also I have created the function module named Z_INTERFACE_RWBAPI01 and written code-

DATA : WA_EXTENSION TYPE BAPIACEXTC.

CLEAR: WA_EXTENSION.

LOOP AT EXTENSION INTO WA_EXTENSION.

READ TABLE IT_ACCIT WITH KEY EBELN = WA_EXTENSION-FIELD1(10)

EBELP = WA_EXTENSION-FIELD2(5)

PS_PSP_PNR = WA_EXTENSION-FIELD3(8).

IF SY-SUBRC EQ 0.

IT_ACCIT-EBELN = WA_EXTENSION-FIELD1.

IT_ACCIT-EBELP = WA_EXTENSION-FIELD2.

IT_ACCIT-PS_PSP_PNR = WA_EXTENSION-FIELD3.

MODIFY IT_ACCIT INDEX SY-TABIX.

ENDIF.

ENDLOOP.

Then with the TCODE FIBF I have added Customer Product as ZFIVOU and then Created a Link between BTE and Product

Then In my program where the BAPI is called I have passed the EXTENSION1 in TABLES

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

DOCUMENTHEADER = DOCHEADER

IMPORTING

OBJ_TYPE = OBJ_TYPE

OBJ_KEY = OBJ_KEY

OBJ_SYS = OBJ_SYS

TABLES

ACCOUNTGL = ACCOUNTGL

  • ACCOUNTRECEIVABLE = CUSTOMER

ACCOUNTPAYABLE = ACCOUNTPAY

CURRENCYAMOUNT = CURRAMOUNT

ACCOUNTWT = ACCOUNTWT

EXTENSION1 = EXTENSION1

RETURN = RETURN1.

Now also I am unable to fulfil the requirement. Please provide the detailed steps

Thanks & Regards,

Read only

0 Likes
4,536

- Have you debugged while executing BAPI ?

- Is the debug control reaches to the custom Function module attached to the BTE ?

- How the read statement "READ TABLE IT_ACCIT WITH KEY EBELN = WA_EXTENSION-FIELD1(10)" will work when field IT_ACCIT-EBELN itself is blank ?

- Check the sy-subrc after the read statement to check whether the Updation is happening properly.

- See the Wiki post mentioned in the earlier post

Read only

Former Member
0 Likes
4,536

Hi All

Thanks Vinod Sir,

I have debugged the BAPI completely but how can i know that custom Function module is attached to the BTE .

In IT_ACCIT the 3 fields are empty.What next step should I follow?

Thanks & Regards,

Bharti Jain

Read only

0 Likes
4,536

Put an external break-point on the z-function module attached to BTE. Execute the BAPI and check whether the execution control navigates to the function module.

Read only

Former Member
0 Likes
4,536

Thanks Sir,

I have put the break points before the BAPI is called and after the BAPI is over and also in the code of FM below shown but the BAPI has not reached to this point

DATA : WA_EXTENSION TYPE BAPIACEXTC.

CLEAR: WA_EXTENSION.

*******************************************BREAK POINT SET HERE ****************************************

LOOP AT EXTENSION INTO WA_EXTENSION.

READ TABLE IT_ACCIT WITH KEY EBELN = WA_EXTENSION-FIELD1(10)

EBELP = WA_EXTENSION-FIELD2(5)

PS_PSP_PNR = WA_EXTENSION-FIELD3(8).

IF SY-SUBRC EQ 0.

IT_ACCIT-EBELN = WA_EXTENSION-FIELD1.

IT_ACCIT-EBELP = WA_EXTENSION-FIELD2.

IT_ACCIT-PS_PSP_PNR = WA_EXTENSION-FIELD3.

MODIFY IT_ACCIT INDEX SY-TABIX.

ENDIF.

ENDLOOP.

And the BAPI is called as

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

DOCUMENTHEADER = DOCHEADER

IMPORTING

OBJ_TYPE = OBJ_TYPE

OBJ_KEY = OBJ_KEY

OBJ_SYS = OBJ_SYS

TABLES

ACCOUNTGL = ACCOUNTGL

  • ACCOUNTRECEIVABLE = CUSTOMER

ACCOUNTPAYABLE = ACCOUNTPAY

CURRENCYAMOUNT = CURRAMOUNT

ACCOUNTWT = ACCOUNTWT

EXTENSION1 = EXTENSION1

RETURN = RETURN1.

Am I passing the parameters correctly . Is it required to again create IT_ACCIT in the FM before the READ TABLE statement outside the loop. What is the thing which I am missing or have I not properly implemented the BTE .

The steps in brief are as follows:-

1. TCODE FIBF (Already in program EXTENSION1 is being populated with the required 3 fields.)

2. Setting->Products-> ... of a customer Then entered new Entry. PRODUCT(ZFIVOU),TEXT(Voucher Posting) and TICK in checkbox.Then SAVE

3.Settings->Process Modules-> ... of a customer .Then the entries RWBAPI01,Z_INTERFACE_RWBAPI01, ZFIVOU in the respective fields. Then Save.

Have I committed some mistake

Thanks & REgards,

Bharti Jain

Read only

0 Likes
4,536

Settings for BTE seems to be correct. To check the processesing, create a breakpoint on bapi statement

perform call_customer_function
            tables extension1.

in line number 59 of bapi BAPI_ACC_DOCUMENT_POST and start with debugging. If your settings are correct, execution from flow into include "LACC9F10" -> Function module "OPEN_FI_PERFORM_RWBAPI01_P" -> the function module attached to BTE.

Read only

Former Member
0 Likes
4,536

Thanks Vinod Sir,

I have put the break point in the BAPI at

PERFORM call_customer_function

TABLES extension1. It has gone there and inside it , it has also gone into 'OPEN_FI_PERFORM_RWBAPI01_P'.

What else should I check .

Thanks in advance,

Regards,

Bharti Jain

Read only

nabheetscn
SAP Champion
SAP Champion
0 Likes
4,536

You can implement the BADI INVOICE_UPDATE. In BAPI pass the extension fields and in this BADI assign it T_ACCIT structure. We have done the same previously.

Thanks

Nabheet

Read only

Former Member
0 Likes
4,536

Thanks For the prompt reply.

I don't know about BADI implementation as I haven't worked on it. If u have earlier solved the same scenario please guide me the sample code and the steps to do that or else help me in the BTE where I have missed something.

Thanks & regards,

Bharti Jain

Read only

0 Likes
4,536

Have you further debugged the function module "OPEN_FI_PERFORM_RWBAPI01_P" ? First statment is a call to function module PC_FUNCTION_FIND, which determines the function module which is attached to BTE (using Tcode FIBF).

Read only

0 Likes
4,536

Is your BTE getting triggered if yes then please post the code and the coding paramters.

Please find below the sample code which we have done for updating custom fields you can use it as a reference.

BADI is ACC_DOCUMENT

Method is Change

SORT c_extension2 BY structure.

LOOP AT c_extension2 INTO lwa_extension.

READ TABLE c_accit WITH KEY posnr = lwa_extension-valuepart1+0(10)

INTO lwa_accit.

IF sy-subrc IS INITIAL.

lwa_accit-zztest1 = lwa_extension-valuepart1+10(15).

lwa_accit-zztest2 = lwa_extension-valuepart1+25(15).

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = lwa_accit-zztest1

IMPORTING

output = lwa_accit-zztest1

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'

EXPORTING

input = lwa_accit-zztest2

IMPORTING

output = lwa_accit-zztest2.

MODIFY c_accit FROM lwa_accit INDEX sy-tabix.

ENDIF.

ENDLOOP.

In above code i am passing the custom field value you can modify the vendor line item itemby modifying first line.

Thanks

Nabheet

Read only

Former Member
0 Likes
4,536

As suggested by you I have debugged the FM PC_FUNCTION_FIND and found fmtab table having entry as /SAPPCE/DPC_PROCESS_EXTENSION .

Is it correct?

Then inside loop it has gone through the statement IF fmtab-rfcds IS INITIAL. and called the statement

CALL FUNCTION fmtab-funct and after its complete execution it has returned to line

MODIFY it_acchd FROM gs_acchd INDEX 1. In IT_ACCHD the TCODE is BAPI.

Thanks & Regards,

Bharti Jain

Read only

0 Likes
4,536

Check whether BTE RWBAPI01 is active in your system (Check the table entry TPS01).

Read only

Former Member
0 Likes
4,536

As deisred by Nabheet ,

The BTE has been properly implementedand I have attached some code samples in the post. Some another code sample id required or am I not getting what u are saying.

Thanks for the code sample. Now provide me the steps to make modifications so that I can get the three fields EBELN(PO Number),

EBELP(Line Item) and WBS_Element.

Thanks once again,

Regards,

Bharti Jain

Read only

0 Likes
4,536

Hi Bharti

Two things

1. you wantto go for BTE or BADI.

2. If BTE then please post the function module import export table parameters... Secondly during debugging does it return the custom function module name which you have attached in FIBF if not then configuration is not correct.

Thanks

Nabheet

Read only

Former Member
0 Likes
4,537

I have seen the table TPS01 and I could not find the FM name Z_INTERFACE_RWBAPI01 in it.

But I can see RWBAPI01-- SAMPLE_INTERFACE_RWBAPI01-- OPEN_FI_PERFORM_RWBAPI01_P -- A--Accounting BAPI Plug-In: User Exit in the resp[ective fields.

I want to go with BTE first and if I didnt get the solution with BTE then I will move to BADi.

The FM name is Z_INTERFACE_RWBAPI01 and the code sample is FUNCTION Z_INTERFACE_RWBAPI01.

*"----


""Local Interface:

*" TABLES

*" IT_ACCIT STRUCTURE ACCIT

*" IT_ACCCR STRUCTURE ACCCR

*" RETURN STRUCTURE BAPIRET2

*" EXTENSION STRUCTURE BAPIACEXTC

*" IT_ACCWT STRUCTURE ACCIT_WT

*" CHANGING

*" VALUE(DOCUMENT_HEADER) LIKE ACCHD STRUCTURE ACCHD

*"----


DATA : WA_EXTENSION TYPE BAPIACEXTC.

CLEAR: WA_EXTENSION.

LOOP AT EXTENSION INTO WA_EXTENSION.

READ TABLE IT_ACCIT WITH KEY EBELN = WA_EXTENSION-FIELD1(10)

EBELP = WA_EXTENSION-FIELD2(5)

PS_PSP_PNR = WA_EXTENSION-FIELD3(8).

IF SY-SUBRC EQ 0.

IT_ACCIT-EBELN = WA_EXTENSION-FIELD1.

IT_ACCIT-EBELP = WA_EXTENSION-FIELD2.

IT_ACCIT-PS_PSP_PNR = WA_EXTENSION-FIELD3.

MODIFY IT_ACCIT INDEX SY-TABIX.

ENDIF.

ENDLOOP.

ENDFUNCTION.

The steps of BTE I have already mention .Is it not configured prooperly

Read only

0 Likes
4,536

Code looks okie to me. Please check the configuration. While posting if youput a break point in your BTE then it should stop there. If it is not happening that means configuration is not correct or its not the desired one. Secondly you have created a product under what customer or something else. try in various options.

Thanks

Nabheet

Read only

0 Likes
4,536

As nabheet mentioned, something wrong with the settings (FIBF) of BTE. Check your entries in TPS34. See the determination of Z function module assinged to BTE from the FM "PC_FUNCTIONS_READ" (Line No :46). Also see include "LITSRF01" line number 660 - 689 regarding selection of data from TPS34.

Read only

Former Member
0 Likes
4,536

Hi All The GURUS,

As suggested by you I have debugged it to line 661 and found that there is no entry in the internal table. Then I looked in the table TPS34. Let me describe one thing also. In development server we have two clients say 310 & 320. In 310 we create and in 320 we can execute. For this case when I looked the table entry in 310 I found RWBAPI01,FI-AA, Z_INTERFACE_RWBAPI0,ZFIVOU in the respective fields but in 320 I cannot see the same . Then I also looked the same for FIBF ie in 310 & 320 and found that in 310I can see the entries but in 320 I cannot.

Is the reason for the same is client dependency?

Earlier also I worked on SAPScript and as it is client dependent so I had used the TCODE SCC1 to make it available in 320.

Should I repeat the same process of SCC1 or I have to do something else to configure it properly?

Thanks In Advance,

Regards,

Bharti Jain

Edited by: Bharti Jain on Dec 11, 2010 6:48 AM

Read only

Former Member
0 Likes
4,536

As asked by Nabheet ,

I have entered Products by the following steps--

Settings->Products->...of a Customer

Regards,

Bharti Jain

Read only

Former Member
0 Likes
4,536

Hi ALL The GURUS,

I have now got the entry in Table TPS34 by using SCC1. After the Perform PERFORM FUNCTIONS_DETERMINE was over I got the entry in the Table APCUSTAB as Process(RWBAPI01) Funct(Z_INTERFACE_RWBAPI01) PRDKT(ZFIVOU) which was transferred to T_FMCUS[] at line 66 of function PC_FUNCTIONS_READ. Now at line 135 of PC_FUNCTION_FIND in table T_FMRFC the entries were /SAPPCE/DPC_PROCESS_EXTENSION & Z_INTERFACE_RWBAPI01 . Now it had come to line 24 after executing PC_FUNCTION_FIND and in fmtab there are 2 entries same as T_FMRFC. Now in loop it had called the function CALL FUNCTION fmtab-funct and it had reached to the Z_INTERFACE_RWBAPI01. The code is

DATA : WA_EXTENSION TYPE BAPIACEXTC,

WA_ACCIT TYPE ACCIT.

CLEAR: WA_EXTENSION.

LOOP AT EXTENSION INTO WA_EXTENSION.

READ TABLE IT_ACCIT WITH KEY EBELN = WA_EXTENSION-FIELD1(10)

EBELP = WA_EXTENSION-FIELD2(5)

PS_PSP_PNR = WA_EXTENSION-FIELD3(8).

IF SY-SUBRC NE 0.

WA_ACCIT-EBELN = WA_EXTENSION-FIELD1.

WA_ACCIT-EBELP = WA_EXTENSION-FIELD2.

WA_ACCIT-PS_PSP_PNR = WA_EXTENSION-FIELD3.

MODIFY IT_ACCIT FROM WA_ACCIT..

ENDIF.

ENDLOOP.

which is wrong. Because I have to modify IT_ACCIT which has 2 rows and EXTENSION has 1 row. In this code it comes at 2nd loop pass because in fmtab first entry is /SAPPCE/DPC_PROCESS_EXTENSION and 2nd is Z_INTERFACE_RWBAPI01. Also IT_ACCIT has 1st row of vendor & 2nd of bank.

I think I have reached upto 97% of success because of all your help.Will revert back as soon as I get success.

Thanks & Regards,

Bharti Jain

Read only

Former Member
0 Likes
4,536

Hi ALL THE GURUS,

Finally I got the success and got the three fields which I want ie EBELN,EBELP, and WBS Element.

As i am a newbie in this field I was not able to perform it easily.

Thanks To You All for your cooperation and help.I will award the forum points and close this thread.

Thanks Once Again,

Regards,

Bharti Jain