BAPI's for FB50,FB60,KB31N and KP46
Hi
Can any one suggest me BAPI function modules for FB50,FB60,KB31N and KP46
Transaction codes
Thanks in advance
For FB60 we used
AcctngInvoiceReceipt.BAPI_ACC_INVOICE_RECEIPT_POST
For FB50 we used
AcctngDocument.Post
These can be found under Accounting General, Accounting Interface in the BAPI explorer
We have not used the others.
Laurie
Similar Messages
-
BAPI FUNCTIONAL MODULES FOR T codes FB50,FB60,KB31n,KP46
Hi friends
Can u suggest me BAPI function modules for T codes FB50,FB60,KB31n,KP46
Thanks in advanceUse BAPI_INCOMINGINVOICE_PARK
Import parameters HEADERDATA is mandatory in BAPI_INCOMINGINVOICE_PARK .
Also tables ITEMDATA and RETURN are mandatory.
Check the following sample code
LOOP AT i_ekbe INTO wa_ekbe.
CLEAR: wa_invoice_header,
i_invoice_item,
i_return,
v_inv_doc_no,
v_fisc_year,
wa_return.
REFRESH: i_invoice_item,
i_return.
Appending Invoice header Work Area
wa_invoice_header-invoice_ind = c_x.
wa_invoice_header-doc_date = sy-datum.
wa_invoice_header-pstng_date = wa_ekbe-budat.
wa_invoice_header-comp_code = c_100.
wa_invoice_header-gross_amount =
wa_invoice_header-currency = c_usd.
wa_invoice_header-calc_tax_ind = c_x.
Appending Invoice item data
i_invoice_item-invoice_doc_item = '0001'.
i_invoice_item-po_number = wa_ekbe-ebeln.
i_invoice_item-po_item = wa_ekbe-ebelp.
i_invoice_item-tax_code = ' '.
i_invoice_item-item_amount = '20.00'.
i_invoice_item-quantity = '10.000'.
i_invoice_item-ref_doc = '5600000634'.
i_invoice_item-ref_doc_year = '2006'.
i_invoice_item-ref_doc_it = '10'.
i_invoice_item-po_unit = 'EA'.
i_invoice_item-COND_TYPE = 'VPRS'.
APPEND i_invoice_item.
Calling module BAPI_INCOMINGINVOICE_PARK
CALL FUNCTION 'BAPI_INCOMINGINVOICE_PARK'
EXPORTING
headerdata = wa_invoice_header
ADDRESSDATA =
IMPORTING
invoicedocnumber = v_inv_doc_no
fiscalyear = v_fisc_year
TABLES
itemdata = i_invoice_item
NFMETALLITMS =
ACCOUNTINGDATA =
GLACCOUNTDATA = i_gla
MATERIALDATA = i_mat
TAXDATA =
WITHTAXDATA =
VENDORITEMSPLITDATA =
return = i_return.
READ TABLE i_return INTO wa_return
WITH KEY type = c_e.
IF sy-subrc EQ 0.
ENDIF.
ENDLOOP.
Reward if useful. -
Screen Variants disabled for FB50,FB60,FB70
Hello All,
The screen variants for FB50 FB60 FB70 disabled. These vairants can be selected as Edit --> Screen variant --> Select screen variant.
When any user executes transaction he gets some field missing (table control setting set as basic settings) and when he try from the above option for the desired screen then also screen remains same. It doesn't change
Previously it was not the case. previously when user executes these trasnaction screen was coming correctly.
Many users facing this issue.
If anyboday faced similer kind of issue then request you to please share your inputs.
Thanks & regards,
PrashantHi Prashant,
Please refer to notes 546889 and 186961.
if user is calling transaction FB*0 the first time no screen variant
for items is selected. So in order to assign a user to a screen variant,
the user has to switch the tree on (SHIFT+F1).
In the folder 'Screen variants for items' the user has to choose your
'default' variant by a double click. After clicking on the button
'Refresh Tree' this screen variant is saved in the table TFBUF, which
contains the personalizations for ENJOY transaction. This table is
always read by starting transaction FB*0. Because of the user
personalization with table TFBUF the SET/GET-Parameters SCRVAR & STV are
not used in the FI-Enjoy transactions. It's the enjoy and personlization
system design that always the last selected screen variant of the user
is used by starting transaction FB*0 and not a default one.
But I can suggest you a modification, for setting your default screen
variant in FB*0 with the value of parameter SCRVAR until the user will
chosse another screen variant in the tree. Furthermore this default
variant is set if user is executing 'Reset screen variant' under
EDIT -> Screen variant. You can find the program changes of this
modification below:
Because it is only possible to set standard for transaction variants and
not for screen variants and due to user personalization goal of the
enjoy transaction It cannot change this system behaviour during
maintenance.
Here is the program code for this modification:
1.
FORM posting_transaction_init.
If variant transaction is active, get screen variant "Note 421236
CALL FUNCTION 'RS_HDSYS_GET_SC_VARIANT' "Note 331997
EXPORTING "Note 331997
progname = 'SAPLFSKB' "Note 331997
dynpro = '0100' "Note 331997
IMPORTING "Note 331997
scvariant = g_scvariant "Note 331997
TABLES "Note 331997
values_scvariant = tab_values_scvariant "Note 331997
guixt_scripts = tab_guixt_scripts. "Note 331997
ENDIF. "Note 421236
*Modification Begin of insert
IF acc_kontext-scvariant IS INITIAL and g_scvariant is initial.
GET PARAMETER ID 'SCRVAR' FIELD G_SCVARIANT.
endif.
*Modification End of insert
IF NOT g_scvariant IS INITIAL "Note430830
2.
FORM create_tree_treev_style_enj.
data entry variants
Only if screen variant not provided by transaction variant
*Modification begin of deletion
IF p_scvariant IS INITIAL. "Note 331997
*Modification end of deletion
PERFORM create_tree_ev TABLES p_node_table. " Erfassungsvarianten
PERFORM create_item_ev TABLES p_item_table.
*Modification begin of deletion
ENDIF. "Note 331997
*Modification end of deletion
assignment models
PERFORM create_tree_km TABLES p_node_table. "Kontierungsmuster
3.
MODULE tree OUTPUT.
read screen variants
Only if no screen variant provided by transaction var. "Note 331997
*Modification Begin of deletion
IF g_scvariant IS INITIAL. "Note 331997
*Modification end of deletion
PERFORM get_screen_variants.
*Modification Begin of deletion
ENDIF. "Note 331997
*Modification end of deletion
read parked documents if required.
I recommend you to check with your local consultants if this modification is suitable to your requirements.
Kind Regards,
Fernando Evangelista -
Function module which uses both BAPI's for sales order create and change
Please name the function module which uses both BAPI's for sales order create and change.
BAPI_SALESORDER_CREATEFORMDAT2
BAPI_SALESORDERCHANGEYup.
you must write a piece of code for this.
with if else condition.first check if SO is exsist than use second FM to change it else create new SO from first FM.
logic somethig like this.
Amit. -
BAPI error for mvmt types 201 and 202
Hi all,
I'm using a bapi BAPI_GOODSMVT_CREATE for the movement type 201 and 202 with the gm_code = '03' for the transaction mb11- Goods movement. But it returns an error u201D Account 400000 requires an assignment to a CO object u201D...I'm unable to resolve this one....I have attached the code below. Please help me in fixing this issue...
if sy-subrc = 0.
loop at it_mchb into wa_mchb.
if wa_mchb-clabs gt 0.
clear wa_header.
wa_header-pstng_date = sy-datum. " fill header data
wa_header-doc_date = sy-datum.
wa_code-gm_code = '03'. "fill code data
clear wa_item.
wa_item-material = wa_mchb-matnr. " fillitem data
wa_item-plant = wa_mchb-werks.
wa_item-stge_loc = wa_mchb-lgort.
wa_item-batch = wa_mchb-charg.
wa_item-entry_qnt = wa_mchb-clabs.
wa_item-move_type = '201'.
wa_item-entry_uom = wa_mchb-meins.
append wa_item to it_item.
elseif wa_mchb-clabs lt 0.
clear wa_header.
wa_header-pstng_date = sy-datum. " fill header data
wa_header-doc_date = sy-datum.
wa_code-gm_code = '03'. "fill code data
clear wa_item.
wa_item-material = wa_mchb-matnr. " fillitem data
wa_item-plant = wa_mchb-werks.
wa_item-stge_loc = wa_mchb-lgort.
wa_item-batch = wa_mchb-charg.
wa_item-entry_qnt = wa_mchb-clabs.
wa_item-move_type = '202'.
wa_item-entry_uom = wa_mchb-meins.
append wa_item to it_item.
endif.
endloop.
clear lv_lin.
describe table it_item lines lv_lin.
if lv_lin = 0.
write : / 'No records found'.
endif.
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = wa_header
goodsmvt_code = wa_code
importing
materialdocument = lv_matdoc
tables
goodsmvt_item = it_item
return = it_return.
if it_return is initial. " if record created successfully
call function 'BAPI_TRANSACTION_COMMIT'. " commit work
write : / lv_matdoc, 'IS CREATED SUCCESSFULLY' color 5.
loop at it_item into wa_item.
write : / 'Mat :', wa_item-material,'bat :', wa_item-batch.
endloop.
else. " if record is not created successfylly
loop at it_return into wa_return.
write : / wa_return-message color 6.
endloop.
uline.
endif.
else.
write : / 'No Records found' color 7.
endif. " gt_s035 is not initial
Edited by: Arunmozhi_06 on May 30, 2011 12:48 PMHi,
Did you passing the leading 0's in the cost center field?
and check the below coding..
* Structures for BAPI
data: gm_header type bapi2017_gm_head_01.
data: gm_code type bapi2017_gm_code.
data: gm_headret type bapi2017_gm_head_ret.
data: gm_item type table of
bapi2017_gm_item_create with header line.
data: gm_return type bapiret2 occurs 0.
data: gm_retmtd type bapi2017_gm_head_ret-mat_doc.
clear: gm_return, gm_retmtd. refresh gm_return.
perform show_status using 'Scrapping(551) Material'.
* Setup BAPI header data.
gm_header-pstng_date = sy-datum.
gm_header-doc_date = sy-datum.
gm_code-gm_code = '06'. " MB11
* Write 551 movement to table
clear gm_item.
move '551' to gm_item-move_type .
move xresb-matnr to gm_item-material.
move p_bdmng to gm_item-entry_qnt.
move xresb-meins to gm_item-entry_uom.
move xresb-werks to gm_item-plant.
move xresb-lgort to gm_item-stge_loc.
move p_grund to gm_item-move_reas.
* Determine cost center per plant
case xresb-werks.
when '0004'.
move '0000041430' to gm_item-costcenter."pass leading zero's in the cost center field
when '0006'.
move '0000041630' to gm_item-costcenter.
when '0007'.
move '0000041731' to gm_item-costcenter.
when '0008'.
move '0000041830' to gm_item-costcenter.
endcase.
append gm_item.
* Call goods movement BAPI
call function 'BAPI_GOODSMVT_CREATE'
EXPORTING
goodsmvt_header = gm_header
goodsmvt_code = gm_code
IMPORTING
goodsmvt_headret = gm_headret
materialdocument = gm_retmtd
TABLES
goodsmvt_item = gm_item
return = gm_return.
Maybe there is some config missing for your cost center, or maybe something missing in your code. check above.
Regards,
Dhina,..
Edited by: Dhina DMD on May 31, 2011 8:02 AM -
Userexit or BADI for FB50/Fb60 transactions
Hi Gurus,
Can someone give me a Userexit or BADI that will trigger before posting an invoice thru FB50 or Fb60 transactions?
Thanks,
-Anthony.These ara exits i found for ut Tcode FB50.
F050S001 FIDCMT, FIDCC1, FIDCC2: Edit user-defined IDoc segment
F050S002 FIDCC1: Change IDoc/do not send
F050S003 FIDCC2: Change IDoc/do not send
F050S004 FIDCMT, FIDCC1, FIDCC2: Change outbound IDoc/do not send
F050S005 FIDCMT, FIDCC1, FIDCC2 Inbound IDoc: Change FI document
F050S006 FI Outgoing IDoc: Reset Clearing in FI Document
F050S007 FIDCCH Outbound: Influence on IDoc for Document Change
F180A001 Balance Sheet Adjustment
FARC0002 Additional Checks for Archiving MM Vendor Master Data
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).
i cant keep the break-point in these exits ,
u keep the break-point in all FM's and run the tcode it will trigger ,then u can find the where it is triggering ,then delete all the grk-points.
Reward Points if useful. -
Need Bapi Names for Post Goods Reciept and Post Goods issue to STO in MIGO
Hi All..
I need to post goods receipt using input data in MIGO. Is there any BAPI that i can use.
Also once STO (Stock Transport order) is created, i also need to Post goods issue to STO in MIGO transaction. I do need a bapi for this too...
Appreciate your help and will reward any helpful answers.
Thanks..Hi,
ata : gm_header type bapi2017_gm_head_01.
data : gm_code type bapi2017_gm_code.
data : gm_headret type bapi2017_gm_head_ret.
data : gm_item type table of
bapi2017_gm_item_create with header line.
data : gm_return type bapiret2 occurs 0 with header line.
data : gm_retmtd type bapi2017_gm_head_ret-mat_doc.
clear : gm_return, gm_retmtd. refresh gm_return.
gm_code-gm_code = '03'.
gm_header-header_txt = firstscreen-bktxt.
gm_header-pstng_date = sy-datum.
gm_header-doc_date = sy-datum.
gm_header-ver_gr_gi_slip = ' '. "print
gm_code-gm_code = '03'.
move lineitem1-bwartwa to gm_item-move_type .
move lineitem1-matnr to gm_item-material.
move lineitem1-erfmg to gm_item-entry_qnt.
move 'EA' to gm_item-entry_uom.
move lineitem1-werks to gm_item-plant.
move lineitem1-lgort to gm_item-stge_loc.
move lineitem1-kostl to gm_item-costcenter.
while gm_item-costcenter+9(1) = ' '.
shift gm_item-costcenter right.
endwhile.
overlay gm_item-costcenter with '0000000000'.
append gm_item.
call function 'BAPI_GOODSMVT_CREATE'
exporting
goodsmvt_header = gm_header
goodsmvt_code = gm_code
importing
goodsmvt_headret = gm_headret
materialdocument = gm_retmtd
tables
goodsmvt_item = gm_item
return = gm_return.
Thanks
venki -
BAPI's for creating of Project and WBS elements in SAP system.
Hi Guys,
I was able to use a Wrapper FM for creating the
We have a FM which combines 5 different BAPIs
FM/Wrapper: "Z_LEED_PROJ_WBSELEMT_CREATE"
1) BAPI_PS_INITIALIZATION
2) BAPI_BUS2001_CREATE
3) BAPI_BUS2054_CREATE_MULTI
4) BAPI_PS_PRECOMMIT
5) BAPI_TRANSACTION_COMMIT
Requirement: To automate the process of creation of Project and WBSE(Tasks) and create an entries in the PS tables based on the user inputs from the user interface in Visual Composer.
Basically user should be able to create the Projects and WBSE.
Issue: We were able to create the Project with the FM (BAPI_BUS2001_CREATE) but having the issue with the creation of WBSE(Tasks), the user will be entering the inputs for Project Definition, Project Profile and WBSE which are to be created in the UI.
The problem is we are not able to create the WBS elements using BAPI BAPI_BUS2054_CREATE_MULTI .i will send u the code below .Can anybody correct
CLEAR it_return.
CALL FUNCTION 'BAPI_BUS2054_CREATE_MULTI'
EXPORTING
I_PROJECT_DEFINITION = i_project_definition-project_definition
TABLES
IT_WBS_ELEMENT = it_wbs_element
ET_RETURN = it_return.
APPEND LINES OF it_return[] TO et_return[].
Thanks,
Gopi.Hi Ramiro,
This is the entire FM code which is below.
""Local Interface:
*" IMPORTING
*" VALUE(I_PROJECT_DEFINITION) LIKE BAPI_BUS2001_NEW STRUCTURE
*" BAPI_BUS2001_NEW
*" TABLES
*" IT_WBS_ELEMENT STRUCTURE BAPI_BUS2054_NEW
*" ET_RETURN STRUCTURE BAPIRET2 OPTIONAL
*" EXTENSIONIN STRUCTURE BAPIPAREX OPTIONAL
*" EXTENSIONOUT STRUCTURE BAPIPAREX OPTIONAL
DATA: it_return LIKE STANDARD TABLE OF BAPIRET2 WITH HEADER LINE,
v_error TYPE boolean VALUE IS INITIAL.
CLEAR: et_return, it_return.
CALL FUNCTION 'BAPI_PS_INITIALIZATION'.
Do checks for creating project definition
CALL FUNCTION 'BAPI_BUS2001_CREATE'
EXPORTING
I_PROJECT_DEFINITION = i_project_definition
TABLES
ET_RETURN = it_return.
APPEND LINES OF it_return[] TO et_return[].
LOOP AT it_return.
IF it_return-type CA 'EAX'.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
v_error = 'X'.
EXIT.
ENDIF.
ENDLOOP.
IF v_error = 'X'.
EXIT.
ENDIF.
Do checks for creating WBS elements
CLEAR it_return.
CALL FUNCTION 'BAPI_BUS2054_CREATE_MULTI'
EXPORTING
I_PROJECT_DEFINITION = i_project_definition-project_definition
TABLES
IT_WBS_ELEMENT = it_wbs_element
ET_RETURN = it_return.
APPEND LINES OF it_return[] TO et_return[].
LOOP AT it_return.
IF it_return-type CA 'EAX'.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
v_error = 'X'.
EXIT.
ENDIF.
ENDLOOP.
IF v_error = 'X'.
EXIT.
ENDIF.
CALL FUNCTION 'BAPI_PS_PRECOMMIT'
TABLES
ET_RETURN = it_return.
APPEND LINES OF it_return[] TO et_return[].
LOOP AT it_return.
IF it_return-type CA 'EAX'.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
v_error = 'X'.
EXIT.
ENDIF.
ENDLOOP.
IF v_error = 'X'.
EXIT.
ENDIF.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = 'X'.
ENDFUNCTION.
can u please look at the code and let me know the changes?
Thanks,
Gopi. -
Userexit for FB50/Fb60 transaction
Hi Gurus,
Can someone give me a Userexit or BADI that will trigger before posting an invoice thru FB50 or Fb60 transactions?
Thanks,
-Anthony.FB50 all avaliable user exits:
F050S001
F050S002
F050S003
F050S004
F050S005
F050S006
F050S007
F180A001
FARC0002
FEDI0001
RFAVIS01
RFEPOS00
RFKORIEX
SAPLF051
Transaction Code - FB60 Enter Incoming Invoices
F050S001 FIDCMT, FIDCC1, FIDCC2: Edit user-defined IDoc segment
F050S002 FIDCC1: Change IDoc/do not send
F050S003 FIDCC2: Change IDoc/do not send
F050S004 FIDCMT, FIDCC1, FIDCC2: Change outbound IDoc/do not send
F050S005 FIDCMT, FIDCC1, FIDCC2 Inbound IDoc: Change FI document
F050S006 FI Outgoing IDoc: Reset Clearing in FI Document
F050S007 FIDCCH Outbound: Influence on IDoc for Document Change
F180A001 Balance Sheet Adjustment
FARC0002 Additional Checks for Archiving MM Vendor Master Data
FEDI0001 Function Exits for EDI in FI
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) -
FM/BAPI for Post Goods Recipt and Reservations
Hi All,
Is there any BAPI/FM for posting Goods receipt and Reservations . Please send some sample example to post goods receipt using Inbound Delivery & Reservations
Thanks
BobbyBobby,
I think you can use the FM BAPI_ACC_GOODS_MOVEMENT_POST for this purpose. You try to write a sample program and see how it works.
Sojan -
Question on interface for FB50
I am new to the ABAP world and a little confused on the interfacing of FB50. we currently have a ABAP process that reads a text file and submits the G/L data using FB01 and RFBIBL00. We would like to start using FB50 and I am reading that this is a enjoySAP transaction that does support batch input. I am also reading about interfaces to FB50 that use the bapi BAPI_ACC_DOCUMENT_POST and/or BAPI_ACC_GL_POSTING_POST. Can I write a ABAP to read the text file and use one of the BAPI's to load data to the FB50 transaction? We would like to separate our loading processes so that we can use FB50, FB60, FB70 and move away from FB01 to load all of our data.
Submitting as background job:
<u>From SAP-Help</u>
Scheduling a submitable program as a background task with the number number in a background request name. After scheduling, the background task is completed by function module JOB_CLOSE and released immediately.
DATA: number TYPE tbtcjob-jobcount,
name TYPE tbtcjob-jobname VALUE 'JOB_TEST',
print_parameters TYPE pri_params.
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = name
IMPORTING
jobcount = number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
SUBMIT submitable TO SAP-SPOOL
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB name NUMBER number
AND RETURN.
IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = number
jobname = name
strtimmed = 'X'
EXCEPTIONS
cant_start_immediate = 1
invalid_startdate = 2
jobname_missing = 3
job_close_failed = 4
job_nosteps = 5
job_notex = 6
lock_failed = 7
OTHERS = 8.
IF sy-subrc <> 0.
ENDIF.
ENDIF.
ENDIF. -
Hi,
Please help to find the User Exit or BTE for FB50 after saving and posting to FB03 to capture the accouting document created.
I need to know the acconting document created in FB03.
Thanks,
S PatelHi,
I think you can use the User-exit SAPLF040.
Regards,
Raj -
BAPI functions for FB60 and F-02
Hi,
Can any one please tell me the BAPI functions for FB60 and F-02 tcodes.
I had searched in forum,but din't solved my purpose.
Thanks.
Sri
Moderator message - Search harder. Maybe Google will help - post locked
Edited by: Rob Burbank on May 8, 2010 6:25 PMThis has been solved for FB50. The original variant for FB50 had never beer created in our QAS system! So I was able to get the screen variant menu selections to reappear by running SHD0, editing, and then saving the transaction variant 'STANDARD 1' (not sure if that is SAP's name for the default variant).
Hope others find this information useful.
J. Haynes
Denver, CO -
Hi friends,
I want to upload data to transaction FB60. I have found a BAPI 'BAPI_ACC_DOCUMENT_POST' for the same but I am not sure about it.
Can anybody help me or if anybody has used the BAPI for uploading data to Txn FB60.
Thanks in Advance,
PunitHi,
check this code..
REPORT Z_FI_GL_POSTING.
include <icon>.
*/ =================================================================== *
CONSTANTS: on VALUE 'X',
off VALUE ' ',
tabx TYPE X VALUE '09',
c_e1bpache08 TYPE edilsegtyp VALUE 'E1BPACHE08',
c_e1bpacgl08 TYPE edilsegtyp VALUE 'E1BPACGL08',
c_e1bpaccr08 TYPE edilsegtyp VALUE 'E1BPACCR08'.
TYPES: BEGIN OF t_tab_index,
from TYPE i,
to TYPE i,
END OF t_tab_index.
data : tab type c.
DATA:
e1bpache08 LIKE e1bpache08,
e1bpacgl08 LIKE e1bpacgl08,
e1bpaccr08 LIKE e1bpaccr08.
DATA: g_subrc TYPE subrc.
DATA: g_file TYPE string.
DATA: g_segname TYPE edilsegtyp.
DATA: g_sdata TYPE edi_sdata.
DATA: g_first_doc.
DATA: i_dataf TYPE char2000 OCCURS 900 WITH HEADER LINE,
i_dataf_doc TYPE char2000 OCCURS 50 WITH HEADER LINE.
DATA: g_tab_index TYPE t_tab_index OCCURS 100 WITH HEADER LINE.
DATA: i_accountgl TYPE bapiacgl08 OCCURS 100 WITH HEADER LINE,
i_curramnt TYPE bapiaccr08 OCCURS 100 WITH HEADER LINE,
i_return TYPE bapiret2 OCCURS 10 WITH HEADER LINE,
g_docheader TYPE bapiache08.
*/ ======================== SELECTION ================================ *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-010.
PARAMETERS: excelf TYPE file_name LOWER CASE
DEFAULT 'C:my_excel_file.txt'.
SELECTION-SCREEN END OF BLOCK b1.
*/ =========================== CORE ================================== *
START-OF-SELECTION.
*/ Call text File with GUI_UPLOAD
g_file = excelf.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = g_file
* FILETYPE = 'ASC'
* HAS_FIELD_SEPARATOR = ' '
* HEADER_LENGTH = 0
* READ_BY_LINE = 'X'
* IMPORTING
* FILELENGTH =
* HEADER =
TABLES
data_tab = i_dataf
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17
IF sy-subrc <> 0.
write: / Text-032.
stop.
ENDIF.
*/ Initialisation
write tabx to tab. " required as of ABAP 610 split cannot
*/ have mixed char and byte types
CLEAR g_tab_index.
REFRESH g_tab_index.
*/ how to process several doc : detecting docs in i_dataf
g_first_doc = on.
LOOP AT i_dataf.
CLEAR: g_segname, g_sdata.
SPLIT i_dataf AT tab INTO g_segname g_sdata.
CHECK: g_segname = c_e1bpache08,
sy-tabix > 1.
*/ 1st document
IF g_first_doc = on.
g_tab_index-from = 1.
g_tab_index-to = sy-tabix - 1.
APPEND g_tab_index.
*/ Next Documents
ELSE.
g_tab_index-from = g_tab_index-to + 1.
g_tab_index-to = sy-tabix - 1.
APPEND g_tab_index.
ENDIF.
g_first_doc = off.
ENDLOOP.
*/ Last doc.
g_tab_index-from = g_tab_index-to + 1.
g_tab_index-to = sy-tfill.
APPEND g_tab_index.
*/ Process documents.
loop at g_tab_index.
clear i_dataf_doc.
refresh i_dataf_doc.
append lines of i_dataf from g_tab_index-from
to g_tab_index-to
to i_dataf_doc.
perform process_document.
endloop.
END-OF-SELECTION.
*/ =========================== ROUTINES ============================== *
* FORM process_document *
FORM process_document.
*/ Clearing Memory
CLEAR: g_docheader, i_accountgl, i_curramnt, i_return, g_subrc.
REFRESH: i_accountgl, i_curramnt, i_return.
*/ Checking i_dataf_doc
*/ Mapping dataf => Bapi structures & internal tables
CLEAR g_subrc.
CATCH SYSTEM-EXCEPTIONS conversion_errors = 1.
LOOP AT i_dataf_doc.
CLEAR g_sdata.
SPLIT i_dataf_doc AT tab INTO g_segname g_sdata.
CASE g_segname.
*/ HEADER
WHEN c_e1bpache08.
PERFORM do_split_ache08.
MOVE-CORRESPONDING e1bpache08 TO g_docheader.
IF e1bpache08-doc_date IS INITIAL.
CLEAR g_docheader-doc_date.
ENDIF.
IF e1bpache08-pstng_date IS INITIAL.
CLEAR g_docheader-pstng_date.
ENDIF.
IF e1bpache08-trans_date IS INITIAL.
CLEAR g_docheader-trans_date.
ENDIF.
*/ Account GL
WHEN c_e1bpacgl08.
PERFORM do_split_acgl08.
MOVE-CORRESPONDING e1bpacgl08 TO i_accountgl.
IF e1bpacgl08-pstng_date IS INITIAL.
CLEAR i_accountgl-pstng_date.
ENDIF.
APPEND i_accountgl.
*/ Account Currency & Amounts
WHEN c_e1bpaccr08.
PERFORM do_split_accr08.
MOVE-CORRESPONDING e1bpaccr08 TO i_curramnt.
APPEND i_curramnt.
*/ kick the line if segment name not filled
WHEN space.
*/ Other names => Bad file structure !
WHEN OTHERS.
g_subrc = 2.
ENDCASE.
ENDLOOP. " i_dataf_doc
ENDCATCH.
IF sy-subrc = 1 OR
NOT g_subrc IS INITIAL.
perform message_output using on.
exit.
ENDIF.
*/ Calling the BAPI
CALL FUNCTION 'BAPI_ACC_GL_POSTING_POST'
EXPORTING
documentheader = g_docheader
TABLES
accountgl = i_accountgl
currencyamount = i_curramnt
return = i_return
* EXTENSION1 =
LOOP AT i_return WHERE type CA 'AE'.
g_subrc = 1.
EXIT.
ENDLOOP.
IF NOT g_subrc IS INITIAL.
perform message_output using on.
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
* EXPORTING
* WAIT =
* IMPORTING
* RETURN =
perform message_output using off.
ENDIF.
ENDFORM.
*& Form do_split_ACHE08
* text
* --> p1 text
* <-- p2 text
FORM do_split_ache08.
CLEAR e1bpache08.
SPLIT g_sdata AT tab INTO
e1bpache08-obj_type
e1bpache08-obj_key
e1bpache08-obj_sys
e1bpache08-username
e1bpache08-header_txt
e1bpache08-obj_key_r
e1bpache08-comp_code
e1bpache08-ac_doc_no
e1bpache08-fisc_year
e1bpache08-doc_date
e1bpache08-pstng_date
e1bpache08-trans_date
e1bpache08-fis_period
e1bpache08-doc_type
e1bpache08-ref_doc_no
e1bpache08-compo_acc
e1bpache08-reason_rev
ENDFORM. " do_split_ACHE08
*& Form do_split_ACGL08
* text
* --> p1 text
* <-- p2 text
FORM do_split_acgl08.
CLEAR e1bpacgl08.
SPLIT g_sdata AT tab INTO
e1bpacgl08-itemno_acc
e1bpacgl08-gl_account
e1bpacgl08-comp_code
e1bpacgl08-pstng_date
e1bpacgl08-doc_type
e1bpacgl08-ac_doc_no
e1bpacgl08-fisc_year
e1bpacgl08-fis_period
e1bpacgl08-stat_con
e1bpacgl08-ref_key_1
e1bpacgl08-ref_key_2
e1bpacgl08-ref_key_3
e1bpacgl08-customer
e1bpacgl08-vendor_no
e1bpacgl08-alloc_nmbr
e1bpacgl08-item_text
e1bpacgl08-bus_area
e1bpacgl08-costcenter
e1bpacgl08-acttype
e1bpacgl08-orderid
e1bpacgl08-orig_group
e1bpacgl08-cost_obj
e1bpacgl08-profit_ctr
e1bpacgl08-part_prctr
e1bpacgl08-wbs_element
e1bpacgl08-network
e1bpacgl08-routing_no
e1bpacgl08-order_itno
ENDFORM. " do_split_ACGL08
*& Form do_split_ACCR08
* text
* --> p1 text
* <-- p2 text
FORM do_split_accr08.
data: l_filler(100).
CLEAR e1bpaccr08.
SPLIT g_sdata AT tab INTO
e1bpaccr08-itemno_acc
e1bpaccr08-curr_type
e1bpaccr08-currency
e1bpaccr08-currency_iso
e1bpaccr08-amt_doccur
e1bpaccr08-exch_rate
e1bpaccr08-exch_rate_v
l_filler
ENDFORM. " do_split_ACCR08
*& Form message_output
* text
* --> p1 text
* <-- p2 text
FORM message_output using if_error.
data: l_message(200),
l_return type i.
format color 1.
skip.
write: / text-020, g_tab_index-from,
text-021, g_tab_index-to.
skip.
if if_error = on.
write: / icon_red_light as icon, text-030 color 6.
else.
write: / icon_green_light as icon, text-031 color 5.
endif.
describe table i_return lines l_return.
if l_return is initial.
write: / text-032.
endif.
loop at i_return.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = i_return-id
LANG = sy-langu
NO = i_return-number
V1 = i_return-MESSAGE_V1
V2 = i_return-MESSAGE_V2
V3 = i_return-MESSAGE_V3
V4 = i_return-MESSAGE_V4
IMPORTING
MSG = l_message
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
check sy-subrc = 0.
write: / l_message.
endloop.
ENDFORM. " message_output
regards
vijay -
Hi All,
I need bapi which can create document for transaction FB60 and later we can do the commit explicitly. we need to upload
*HEADER *
BESG-LIFNR, BKPF-BLDAT, BKPF-BUDAT, INVFO-WRBTR,
BKPF-BUKRS, BKPF-WAERS, BKPF-XBLNR, BSEG-MWSKZ,
BKPF-BKTXT, INVFO-ZFBDT, INVFO-ZTERM
LINE ITEM
BSEG-HKONT, BSEG-SGTXT, BSEG-WRBTR, BSEG-MWSKZ, BSEG-TXJCD, BSEG-KOSTL, BSEG-KSTRG,
BSEG-MATNR, BSEG-MENGE, BSEG-MEINS
i know one bapi BAPI_ACC_INVOICE_RECEIPT_POST but i am not able to pass the value of vendor as a header data on this bapi. please suggest.
Thanks,
MadhuI have one BAPI API_ACC_INVOICE_RECEIPT_POST, i think i hcan use this BAPI for my requirement but while posting the data i am getting errors :
1. Required field AMT_BASE was not transferred in parameter CURRENCYAMOUNT
2. Required field ACCT_KEY was not transferred in parameter ACCOUNTTAX
In the excel sheet these two fields data is not given, then how can i pass the values in these two fileds.
Please reply,
Thanks
Maybe you are looking for
-
MC.9 - spool is not getting generated
Hi Experts, When i execute MC.9 transaction in foreground i am able to view the report output. but when i execute it in background spool is not getting generated. Please provide me any solution for this issue. Thanks Pallavi
-
Error -50 when trying to display artwork on ipod 5th gen
I had this problem recently where the artwork went all wierd and wrong album covers were showing, so I thought that I'd remove all artwork using itunes (version 7.0.2.16) update the ipod, remove ipod, reset it, reconnect it and then update again with
-
Replacement Hard Drive for Satellite 4090 XCDT
I have a Satellite 4090 XCDT which needs a new hard drive, I am trying to find out if the laptop/BIOS can support a 20 GB hard drive (Toshiba Mk-2018GAS), can anyone help me? Also upto what size will it support?
-
LocalConnection loosing my mind
I am trying to pass two values from a Flash CS3 file into flex using the following code in flash. The flash file in flex is loaded like this below <mx:SWFLoader autoLoad="true" id="logn" source="main.swf" horizontalCenter="8" verticalCenter="185" hei
-
Can Google be hacked by Skype extn in Chrome?
Hi, I've been trying to get a response on various forums across the web without success. If this is a stupid question then I don't mind being told so. About a week ago my Gmail reported unusual activity from an IP address not normally associated with