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

BAPI for T.Code F-02

Former Member
0 Likes
3,656

Hi Dear Friends,

Thanks in Advance.

Is there any BAPI for the Transaction F-02.

Regards;

Sridhar.J

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,262

Hi

FORM fill_header.

CLEAR gs_documentheader.

  • Fill the data for docheader for BAPI

gs_documentheader-pstng_date = sy-datum.

gs_documentheader-doc_type = p_dtype.

gs_documentheader-comp_code = gs_data-bukrs.

gs_documentheader-doc_date = sy-datlo.

gs_documentheader-username = sy-uname.

gs_documentheader-ref_doc_no = 'reference'.

gs_documentheader-fis_period = gv_monat.

gs_documentheader-fisc_year = gv_year.

gs_documentheader-bus_act = c_rmwi.

ENDFORM. "fill_header

for each line item

gs_accountgl-itemno_acc = gv_posnr.

gs_accountgl-costcenter = gs_data-kostl.

gs_accountgl-profit_ctr = gs_data-prctr .

gs_accountgl-gl_account = p_mat.

gs_accountgl-pstng_date = sy-datum.

APPEND gs_accountgl TO gt_accountgl.

CLEAR gs_accountgl.

gs_currencyamount-itemno_acc = gv_posnr.

gs_currencyamount-currency = gs_data-pswsl.

gs_currencyamount-amt_doccur = l_amt.

APPEND gs_currencyamount TO gt_currencyamount.

CLEAR gs_currencyamount.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = gs_documentheader

TABLES

accountgl = gt_accountgl

currencyamount = gt_currencyamount

return = gt_return.

u need not specify posting key , instead give the amount in negative.

hope it is useful.

reg

Ramya

Edited by: Ramya S on Jan 6, 2009 12:16 PM

12 REPLIES 12
Read only

Former Member
0 Likes
2,262

Hi

BAPI_ACC_DOCUMENT_POST.

reg

Ramya

Read only

Former Member
0 Likes
2,262

Hi.

Business Add-in

050S008 FIDCC1, FIDCC2 Inbound IDoc: Update Comparison Ledger

BAS_CIN_LTAX1F02 Tax interface

BAS_CIN_MF05AFA0 EWT - Downpayment Clearing - Tax transfer for CIN

ISPLIT Online Split: Cash Discount, Exchange Rate Differences

I_AUTHORITY_ITEM Extended Authorization Check for Document Display (FB03)

I_DOC_DISP_LI Diversion to Document Items (FB03)

I_FB08_SUBST_BUDAT FB08: Check Posting Date for Reversal of FI Doc. with FB08

I_GET_INV_PYMT_AMT BAdI for determining the payment amount for an invoice

I_HEADER_SUB_1300 Screen Enhancement for Document Header SAPMF05A

I_PAYREF_BADI_010 BAdI: Payment Reference Number

I_RES_ITEM_CURRENCY Document of Residual Item with Invoice Currency

I_TRANS_DATE_DERIVE Derive BKPF-WWERT from Other Document Header Data

NVOIC_FI_INBOUND BADIs for Inbound IDoc INVOIC FI (Vendor Invoice)

FESR000_BADI_001 BAdI for Own Processing of POR Item

VFZ Replacement for Function Modules of Function Group FVFZ

C_QUANTITY_GET Transfer of Quantities to Accounting - Customer Exit

DJUST_NET_DAYS Change to Net Due Date

ADI_ENJ_ALT_ADR Go to alternative vendor/customer data

ADI_F040_SCREEN_600 Screen Enhancement on F040 0600 Document Header

ADI_FDCB_SUBBAS01 Screen Enhancement 1 on FDCB Basic Data Screen (010, 510)

ADI_FDCB_SUBBAS02 Screen Enhancement 2 on FDCB Basic Data Screen (010, 510)

ADI_FDCB_SUBBAS03 Screen Enhancement 3 on FDCB Basic Data Screen (010, 510)

ADI_FDCB_SUBBAS04 Screen Enhancement 4 on FDCB Basic Data Screen (010, 510)

ADI_FDCB_SUBBAS05 Screen Enhancement 5 on FDCB Basic Data Screen (010, 510)

ADI_PRKNG_NO_UPDATE BAdI for Deactivating Update of Parked Documents

Enhancement/ Business Add-in Description

Enhancement

FARC0002 Additional Checks for Archiving MM Vendor Master Data

F180A001 Balance Sheet Adjustment

F050S007 FIDCCH Outbound: Influence on IDoc for Document Change

F050S006 FI Outgoing IDoc: Reset Clearing in FI Document

F050S005 FIDCMT, FIDCC1, FIDCC2 Inbound IDoc: Change FI document

F050S004 FIDCMT, FIDCC1, FIDCC2: Change outbound IDoc/do not send

F050S003 FIDCC2: Change IDoc/do not send

RFAVIS01 Customer Exit for Changing Payment Advice Segment Text

RFEPOS00 Line item display: Checking of selection conditions

RFKORIEX Automatic correspondence

SAPLF051 Workflow for FI (pre-capture, release for payment)

F050S001 FIDCMT, FIDCC1, FIDCC2: Edit user-defined IDoc segment

F050S002 FIDCC1: Change IDoc/do not send

Regards.

Jay

Read only

0 Likes
2,262

Hello Jay..

I dont want BADI's, Enhancement & User Exits..

I want BAPI.

I think you had not properly read the issue.

Regards:

Sridhar.J

Read only

Former Member
0 Likes
2,262

Hi

is the BAPI useful.

reg

Ramya

Read only

0 Likes
2,262

Hi Ramya..

The BAPI which you provided me...ok but i want to post Item Details also.

I want to Post..

Posting Key (Debit Account)

G/L Account

Debit Amount

Cost Center

Long Text

Posting Key ( Credit Account )

G/L Account

Credit Amount

Cost Center

Long Text.

Actually from F-02 T.Code we are going to 3 different Screens.

Regards:

Sridhar.J

Read only

Former Member
0 Likes
2,262

hi

try out these bapi's

BAPI_ACC_GL_POSTING_CHECK

BAPI_ACC_GL_POSTING_POST

BAPI_ACC_DOCUMENT_POST

you can use standard bdc also RFBIBL00.

hope this helps

regards

Aakash Banga

Edited by: aakash banga on Jan 6, 2009 11:45 AM

Read only

0 Likes
2,262

Hi,

Using BAPI you can not use postings.For this you have to do enhancements.Simply go for BDC.

Best Regards,

Surendar Reddy.

Read only

Former Member
0 Likes
2,262

hi ,use

BAPI_ACC_GL_POSTING_POST

DATA: doc_header LIKE BAPIACHE09,

criteria LIKE BAPIACKEC9 OCCURS 0 WITH HEADER LINE,

doc_item LIKE BAPIACGL09 OCCURS 0 WITH HEADER LINE,

doc_ar LIKE BAPIACAR09 OCCURS 0 WITH HEADER LINE,

doc_values LIKE BAPIACCR09 OCCURS 0 WITH HEADER LINE,

return LIKE bapiret2 OCCURS 0 WITH HEADER LINE,

extension1 like BAPIACEXTC occurs 0 with header line,

obj_type LIKE bapiache08-obj_type,

obj_key LIKE bapiache02-obj_key,

obj_sys LIKE bapiache02-obj_sys,

docnum LIKE bkpf-belnr.

*

Fill Document Header

doc_header-bus_act = 'RFBU'.

doc_header-username = sy-uname.

doc_header-header_txt = 'TEST .

doc_header-comp_code = 'IN01'.

doc_header-doc_date = '200000000'.

doc_header-pstng_date = sy-datlo.

doc_header-doc_type = 'SA'.

Fill Line 1 of Document Item

doc_item-itemno_acc = '1'.

doc_item-gl_account = '0000680106'.

doc_item-COSTCENTER = 'H909'.

doc_item-pstng_date = sy-datum.

doc_item-item_text = 'TEST POSTING DEBIT ITEM'.

APPEND doc_item.

CLEAR doc_item.

Fill Line 2 of Document Item

doc_ar-itemno_acc = '2'.

doc_ar-customer = '0000000001'.

doc_ar-item_text = ' CREDIT ITEM'.

APPEND doc_ar.

CLEAR doc_ar.

Fill Line 1 of Document Value.

doc_values-itemno_acc = '1'.

doc_values-currency_iso = 'INR'.

doc_values-amt_doccur = '-200.00'.

doc_values-currency = 'INR'.

APPEND doc_values.

CLEAR doc_values.

Fill Line 2 of Document Value

doc_values-itemno_acc = '2'.

doc_values-currency_iso = 'INR'.

doc_values-amt_doccur = 200.

APPEND doc_values.

CLEAR doc_values.

Add tax code in extension1 table.

All tables filled - now call BAPI.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_CHECK'

EXPORTING

documentheader = doc_header

IMPORTING

OBJ_TYPE = doc_header-obj_type

OBJ_KEY = doc_header-obj_key

OBJ_SYS = doc_header-obj_sys

TABLES

accountgl = doc_item

ACCOUNTRECEIVABLE = doc_ar

currencyamount = doc_values

return = return.

EXTENSION1 = EXTENSION1.

*

LOOP AT return WHERE type = 'E'.

EXIT.

ENDLOOP.

*

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = doc_header

IMPORTING

OBJ_TYPE = doc_header-obj_type

OBJ_KEY = doc_header-obj_key

OBJ_SYS = doc_header-obj_sys

TABLES

accountgl = doc_item

ACCOUNTRECEIVABLE = doc_ar

currencyamount = doc_values

return = return.

LOOP AT return WHERE type = 'E'.

EXIT.

ENDLOOP.

IF sy-subrc EQ 0.

WRITE: / 'error!'.

ELSE.

CLEAR return.

REFRESH return.

CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'

EXPORTING

WAIT =

IMPORTING

return = return.

WRITE: / 'BAPI worked!!'.

WRITE: / doc_header-obj_key, ' posted'.

ENDIF.

thanks

Read only

0 Likes
2,262

Hi Rimpa Abhishek.

Will you please tell me how can i give posting key for the BAPI which you suggested.

Regards:

Sridhar.J

Read only

0 Likes
2,262

Hi,

You cannot specify the posting key. It is determined automatically by SAP based on the g/l account and debit/credit amounts.

Read only

Former Member
0 Likes
2,263

Hi

FORM fill_header.

CLEAR gs_documentheader.

  • Fill the data for docheader for BAPI

gs_documentheader-pstng_date = sy-datum.

gs_documentheader-doc_type = p_dtype.

gs_documentheader-comp_code = gs_data-bukrs.

gs_documentheader-doc_date = sy-datlo.

gs_documentheader-username = sy-uname.

gs_documentheader-ref_doc_no = 'reference'.

gs_documentheader-fis_period = gv_monat.

gs_documentheader-fisc_year = gv_year.

gs_documentheader-bus_act = c_rmwi.

ENDFORM. "fill_header

for each line item

gs_accountgl-itemno_acc = gv_posnr.

gs_accountgl-costcenter = gs_data-kostl.

gs_accountgl-profit_ctr = gs_data-prctr .

gs_accountgl-gl_account = p_mat.

gs_accountgl-pstng_date = sy-datum.

APPEND gs_accountgl TO gt_accountgl.

CLEAR gs_accountgl.

gs_currencyamount-itemno_acc = gv_posnr.

gs_currencyamount-currency = gs_data-pswsl.

gs_currencyamount-amt_doccur = l_amt.

APPEND gs_currencyamount TO gt_currencyamount.

CLEAR gs_currencyamount.

CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'

EXPORTING

documentheader = gs_documentheader

TABLES

accountgl = gt_accountgl

currencyamount = gt_currencyamount

return = gt_return.

u need not specify posting key , instead give the amount in negative.

hope it is useful.

reg

Ramya

Edited by: Ramya S on Jan 6, 2009 12:16 PM

Read only

Former Member
0 Likes
2,262

Hi

try this link out------

regards

prashant.