BDC for Transaction Code F-02
Hi Everyone,
Facing a problem in cross-company code G/L Accounts posting. When I enter the data in the transaction directly (not recording) with multiple items containing different company codes and save the transaction, The system leads me into another screen where a pop-up box displays the posted documents. This pop up box has a continue button which takes me back to the initial screen of F-02.
The problem here is when I do the recording using the transaction SHDB and save at the end the recording stops and BDCDATA is displayed. In this case the Pop up box is not displayed. But when I used this program for data transfer the system stops at the point where the pop up box screen is displayed. Can anyone provide me any pointers to overcome this.
Thank you.
Regards,
Chan
HI
In recording once u save, the recording comings out the transaction.
If u want the pop-up to display before save. Then in recording also
after entering all data and before Save press enter or do check.Try
this way after that save the transaction.
Regards,
Raghu.
Similar Messages
-
Dear Friends,
Do anybody has the code for BDC for Transaction Code F-02.
If anybody has plz send me.
Thanks & Reg,
Nishanttry this:
REPORT zfir_f02
NO STANDARD PAGE HEADING LINE-SIZE 255.
INCLUDE bdcrecx1.
TYPES : BEGIN OF tp_flatfile,
bldat(10),
doctyp(2),
comp(4),
postdate(10),
period(2),
currency(5),
reference(16),
htext(25),
postkey(2),
account(17),
amount(16),
profit(10),
assign(18),
text(50),
busarea(4),
cost(10),
bline(10),
base(16),
postkey2(2),
account2(17),
amount2(16),
profit2(10),
assign2(18),
text2(50),
busarea2(4),
END OF tp_flatfile.
DATA : t_flatfile TYPE TABLE OF tp_flatfile WITH HEADER LINE.
DATA : g_file TYPE string.
CLASS cl_abap_char_utilities DEFINITION LOAD.
CONSTANTS:con_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME.
PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK blk1.
*C-- Selection Screen VALUE-REQUEST FOR File path
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = syst-cprog
dynpro_number = syst-dynnr
IMPORTING
file_name = p_file.
g_file = p_file.
*START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = g_file
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = t_flatfile
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.
loop at t_flatfile.
write:/ t_flatfile-doctyp,t_flatfile-amount.
endloop.
START-OF-SELECTION.
PERFORM open_group.
LOOP AT t_flatfile.
PERFORM bdc_dynpro USING 'SAPMF05A' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BKPF-BLDAT'
t_flatfile-bldat.
PERFORM bdc_field USING 'BKPF-BLART'
t_flatfile-doctyp.
PERFORM bdc_field USING 'BKPF-BUKRS'
t_flatfile-comp.
PERFORM bdc_field USING 'BKPF-BUDAT'
t_flatfile-postdate.
PERFORM bdc_field USING 'BKPF-MONAT'
t_flatfile-period.
PERFORM bdc_field USING 'BKPF-WAERS'
t_flatfile-currency.
PERFORM bdc_field USING 'BKPF-XBLNR'
t_flatfile-reference.
PERFORM bdc_field USING 'BKPF-BKTXT'
t_flatfile-htext.
PERFORM bdc_field USING 'FS006-DOCID'
PERFORM bdc_field USING 'RF05A-NEWBS'
t_flatfile-postkey.
PERFORM bdc_field USING 'RF05A-NEWKO'
t_flatfile-account.
CASE t_flatfile-postkey.
WHEN '40' OR '50'.
PERFORM bdc_dynpro USING 'SAPMF05A' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR'
'BSEG-SGTXT'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BSEG-WRBTR'
t_flatfile-amount.
PERFORM bdc_field USING 'BSEG-ZUONR'
t_flatfile-assign.
PERFORM bdc_field USING 'BSEG-SGTXT'
t_flatfile-text.
IF t_flatfile-postkey = '40' and t_flatfile-account > '300000'.
PERFORM bdc_field USING 'DKACB-FMORE'
'X'.
ENDIF.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-KOSTL'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'COBL-GSBER'
t_flatfile-busarea.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'COBL-KOSTL'
t_flatfile-cost.
PERFORM bdc_field USING 'COBL-PRCTR'
t_flatfile-profit.
PERFORM bdc_dynpro USING 'SAPMF05A' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RF05A-NEWBS'
t_flatfile-postkey2.
PERFORM bdc_field USING 'RF05A-NEWKO'
t_flatfile-account2.
PERFORM debit_credit.
WHEN '21' OR '31' OR '24' OR '34'.
**perform bdc_field using 'RF05A-NEWBS'
'31'.
**perform bdc_field using 'RF05A-NEWKO'
'25000'.
PERFORM bdc_field USING 'DKACB-FMORE'
'X'.
PERFORM bdc_dynpro USING 'SAPMF05A' '0302'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-GSBER'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'COBL-GSBER'
t_flatfile-busarea.
PERFORM bdc_field USING 'COBL-KOSTL'
t_flatfile-cost.
PERFORM bdc_dynpro USING 'SAPMF05A' '0302'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BSEG-WRBTR'
t_flatfile-amount.
PERFORM bdc_field USING 'BSEG-GSBER'
t_flatfile-busarea.
PERFORM bdc_field USING 'BSEG-ZFBDT'
t_flatfile-bline.
PERFORM bdc_field USING 'BSEG-SKFBT'
t_flatfile-base.
PERFORM bdc_field USING 'BSEG-ZUONR'
t_flatfile-assign.
PERFORM bdc_field USING 'BSEG-SGTXT'
t_flatfile-text.
PERFORM bdc_field USING 'RF05A-NEWBS'
t_flatfile-postkey2.
PERFORM bdc_field USING 'RF05A-NEWKO'
t_flatfile-account2.
PERFORM bdc_dynpro USING 'SAPLFWTD' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR'
'WITH_ITEM-WT_WITHCD(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=GO'.
PERFORM debit_credit.
PERFORM bdc_dynpro USING 'SAPMF05A' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BSEG-WRBTR'
t_flatfile-amount2.
PERFORM bdc_field USING 'BSEG-ZUONR'
t_flatfile-assign2.
PERFORM bdc_field USING 'BSEG-SGTXT'
t_flatfile-text2.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-GSBER'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'COBL-GSBER'
t_flatfile-busarea2.
PERFORM bdc_field USING 'COBL-KOSTL'
t_flatfile-cost.
PERFORM bdc_field USING 'COBL-PRCTR'
t_flatfile-profit2.
PERFORM bdc_dynpro USING 'SAPMF05A' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-GSBER'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
WHEN '01' OR '11' OR '04' OR '14' OR '07' OR '17'.
*perform bdc_field using 'RF05A-NEWBS'
'11'.
*perform bdc_field using 'RF05A-NEWKO'
'1'.
PERFORM bdc_dynpro USING 'SAPMF05A' '0301'.
PERFORM bdc_field USING 'BDC_CURSOR'
'BSEG-SGTXT'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BSEG-WRBTR'
t_flatfile-amount.
PERFORM bdc_field USING 'BSEG-MWSKZ'
PERFORM bdc_field USING 'BSEG-GSBER'
t_flatfile-busarea.
IF NOT t_flatfile-bline IS INITIAL.
PERFORM bdc_field USING 'BSEG-ZFBDT'
t_flatfile-bline.
ENDIF.
IF NOT t_flatfile-base IS INITIAL.
PERFORM bdc_field USING 'BSEG-SKFBT'
t_flatfile-base.
ENDIF.
PERFORM bdc_field USING 'BSEG-ZUONR'
t_flatfile-assign.
PERFORM bdc_field USING 'BSEG-SGTXT'
t_flatfile-text.
PERFORM bdc_field USING 'RF05A-NEWBS'
t_flatfile-postkey2.
PERFORM bdc_field USING 'RF05A-NEWKO'
t_flatfile-account2.
PERFORM debit_credit.
ENDCASE.
*perform bdc_dynpro using 'SAPMF05A' '0301'.
*perform bdc_field using 'BDC_CURSOR'
'BSEG-WRBTR'.
*perform bdc_field using 'BDC_OKCODE'
'=AB'.
*perform bdc_field using 'BSEG-WRBTR'
'3,000.00'.
*perform bdc_field using 'BSEG-MWSKZ'
*perform bdc_field using 'BSEG-GSBER'
'VUSO'.
*perform bdc_field using 'BSEG-ZFBDT'
'19.07.2005'.
*perform bdc_field using 'BSEG-SKFBT'
'3,000.00'.
*perform bdc_field using 'BSEG-ZUONR'
'ASSIGN'.
*perform bdc_field using 'BSEG-SGTXT'
'TEXT'.
PERFORM bdc_dynpro USING 'SAPMF05A' '0700'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWBS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
*perform bdc_field using 'BKPF-XBLNR'
'REF'.
*perform bdc_field using 'BKPF-BKTXT'
'text'.
PERFORM bdc_transaction USING 'F-02'.
ENDLOOP.
PERFORM close_group.
*& Form debit_credit
text
FORM debit_credit.
**SRINI
IF t_flatfile-postkey = '40' OR t_flatfile-postkey = '50'.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-GSBER'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
ENDIF.
***SRINI
PERFORM bdc_dynpro USING 'SAPMF05A' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BSEG-WRBTR'
t_flatfile-amount2.
PERFORM bdc_field USING 'BSEG-ZUONR'
t_flatfile-assign2.
PERFORM bdc_field USING 'BSEG-SGTXT'
t_flatfile-text2.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-KOSTL'.
'COBL-GSBER'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'COBL-GSBER'
t_flatfile-busarea2.
PERFORM bdc_field USING 'COBL-KOSTL'
t_flatfile-cost.
PERFORM bdc_field USING 'COBL-PRCTR'
t_flatfile-profit2.
PERFORM bdc_dynpro USING 'SAPMF05A' '0300'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RF05A-NEWKO'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BU'.
PERFORM bdc_dynpro USING 'SAPLKACB' '0002'.
PERFORM bdc_field USING 'BDC_CURSOR'
'COBL-GSBER'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
ENDFORM. "debit_credit
regards,
Bikash -
Creating bdc for transaction f-02 ?
Hi People,
I am going a bdc for transaction f-02 ..... my template involves 7 posting keys ( 40 50 31 01 29 09 70 ) ... depending up
on the posting key the next screen will change .......... can you people tel me how to do this and what are all the logic
involved in this program ?
thanks u all in advance.
SivaHi,
Please use the following format for your upload file template
DocDate1 ComCd1 Currency1 pstky1
DocDate1 ComCd1 Currency1 pstky2
DocDate1 ComCd1 Currency1 pstky3
DocDate2 ComCd2 Currency2 pstky1
DocDate2 ComCd2 Currency2 pstky2
Then use the following logic.
At New Currency1
add the header data
DocDate1 ComCd1 Currency1
Thus this code will run only once for every new Header
and remain in the screen till posting key are entered.
Regards,
Lokesh
Edited by: Lokesh Tibbani on Sep 5, 2008 12:17 PM -
Hi,
Any idea how to write BDC for transaction F-02?
The problem is how do we upload one item after another within the same loop?
Regards,
NabaYou may solve easily your problem writing the data in the LOOP like
LOOP AT IT_BSEG
" if first line, fill BDCDATA for header and the first line call
" if not first line, fill BDCDATA for the bottom of the previous line
" fill ok code for next line
" fill BDCDATA for the current line
ENDLOOP.
" fill ok code for save and call transaction
But it should be easier to use FM like [POSTING_INTERFACE_START|https://www.sdn.sap.com/irj/scn/advancedsearch?query=posting_interface_start&cat=sdn_all]; [POSTING_INTERFACE_DOCUMENT|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=posting_interface_document&adv=false&sortby=cm_rnd_rankvalue] and [POSTING_INTERFACE_END|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=posting_interface_end&adv=false&sortby=cm_rnd_rankvalue], those function modules will build the BDC flow.
Another, and better solution is to use [BAPI_ACC_DOCUMENT_POST|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=bapi_acc_document_post&adv=false&sortby=cm_rnd_rankvalue].
Regards -
Writing a Batch Input or Call Transaction program for transaction code MMAM
Hi All,
I'm writing a Batch Input or Call Transaction program for transaction code MMAM (Changing Material Type). The program was able to run but somehow I was not able to capture the log of the output after running MMAM. The log was not part of the SY-MESSAGE so adding in MESSTAB into call transaction doesn't help while BDC session logs shows only the transaction was processed.
Anyone has encounter such problems before?
Regards,
Ramu.Hi
Overview of Batch Input Session
The first batch input method is to create a batch input session. It is the processing of this batch input session that updates the database, not the execution of the batch input program. i am giving you example for Change Vendor you practice for ur tcode
For our example, we will use the Change Vendor transaction (FK02) to add a street address to an already existing vendor.
Step #1
Use SystemStatus menu path to determine online program name (SAPMF02K), screen number (0110)
Step #2
Use F1 key and Technical Info pushbutton in each screen field to be filled to determine the field name.
Step #3
Determine how to proceed in the transaction
(save the record by clicking on the Save pushbutton or pressing the F11 key).
The process flow of CALL TRANSACTION
A program that uses CALL TRANSACTION USING to process legacy data should execute thefollowing steps:
Prepare a BDCDATA structure for the transaction that you wish to run.
Prepare a internal table to store error messages Tab_Mess like structure of BDCMSGCOLL.
With a CALL TRANSACTION USING statement, call the transaction and prepare the BDCDATA structure. For example:
CALL TRANSACTION MM01' USING BDCDATA MODE 'A' UPDATE 'S'. MESSAGES INTO TAB_MESS.
IF SY-SUBRC <> 0.
<Error_handling>.
ENDIF.
Overview of Batch Input Session
The first batch input method is to create a batch input session. It is the processing of this batch input session that updates the database, not the execution of the batch input program -
Hi All, I developed a BDC for transaction IE02
Hi All, I developed a BDC for transaction IE02, when i am uploading data into this bdc 'validity period' is automatically taking the present system date, as in program i have not given any validations for this validity from Can anyone guide me on this as so why the data in validity from is taking present system date and how do i avoid it.
Thanks..!!!
Regards,
SwarnaHi Swarna,
AS you mention IE02 Validity From is not editable.
If you capturing this field in BDC then you can put hard-code date value sy-datum in this field , no need to chnage in excel or manual update every time.
and If you are not capturing this field in BDC then please try to use BAPI for uploading data.
like.
BAPI_EQUI_CHANGE or
BAPI_EQMT_MODIFY.
Regards,
Prasenjit -
Creating of Notes for Transaction Code RECN(Using Classes and Methods)
Hi Experts,
I want to Create Notes for Transaction Code RECN, This should not done manually but should be done programatically.
I had used the Class CL_GOS_SRV_NOTE_CREATE to create the notes.....but here comes the doubt for me.....note will be created by using this class and how this can be created for the Tcode RECN........
I am using the Real Estate Module.....Plz help me....awaiting for ur helpful answers....
Thanks in Advance.....!
BrahmaHi kanagaraja,
Thanks...!
The BADI which u have given is not existing in my system...i had gone through the se18 and se19 tcodes....
Awaiting for ur response......!
Thanks,
Brahma... -
Hi Experts,
I am trying to develop BDC for transaction J1IFQ .
When I do recording at the end I press SAVE it give me message that record is reconcilie and then I press logout.
But when I use same recording in my program it dosn't save data. I am not able to find out what is the problem, please guide me.
Thanking you.Hi Narayani
It seems you need to inspect the new flow of the transaction and your BDC program more carefully. You might have skiped somethings to change.
*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a> -
Program does BDC for transaction F-52 or f-53
Hi GuruI am functional person and working with a developer in a program . The program does BDC for transaction F-52 or f-53 . I am uploading a file ,so that the program picks it and o either F-52 or F-53 based on condition. When i try to upload the program with mulitple record ,i am getting the message difference is too large to clear . If i execute the same program without doing any changes again i can see few more records getting posted . when i do next time remaining records are posted . Insted of getting posted in one ,I have to execute the program more than once .can any one help me out why this is happening
i think you should ask your programmer to use transaction SM35 to process the BDC in foreground mode (first changing the mode to A). I would think you will see what's going wrong then. There are a few transactions that look different in foreground mode than in background and you will see where the difference is if you use this method to process
-
LSMW for Transaction Code FB41
Hi,
Can any one let me know LSMW - direct input method or BAPI (Bussiness Object) to update data using transaction code FB41.
I have used direct input method RFBIBL00, but this standard direct input method is not supported for transaction code FB41.
Thanks and Regards,
Shravan G.BAPIs for FB41:
BAPI_ACC_DOCUMENT_POST
BAPI_ACC_INVOICE_RECEIPT_POST,
BAPI_ACC_GL_POSTING_POST,
BAPI_ACC_DOCUMENT_POST.
Regards,
Nagraj -
Hi,
I am trying to write BDC for transaction WB02 , wherein each site(Plant) in our company is to be made a customer of each other, so as to fecilitate inter-site movement of goods. the transaction works fine normally, but at the time of recording it comes to screen '315' and gets stuck and dont move ahead or either go back, it just gets stuck there, and has to be terminated.. i tried to replicate the transaction thru' BDC but it is getting stuck at the same screen.. can anybody tell me why this is happening and the possible solution for it..
thanks.
sharonHi,
What u can do is Read your Messages table with message types E(Error) and A(Abort). IF NOT sy-subrc IS INITIAlL means your transaction is successfull. So u can give your custom message saying IDOC sent successfully.
READ TABLE IT_BDCMSGCOLL WITh KEY TYPE = 'E'.
IF NOT sy-subrc IS INITIAL.
READ TABLE IT_BDCMSGCOLL WITH KEY TYPE = 'A'
IF NOT sy-subrc IS INITIAL.
MESSAGE i000 WITH 'IDOC sent successfully'.
ELSE.
MESSAGE i000 WITH 'Problem in sending IDOC'.
ENDIF.
ELSE.
MESSAGE i000 WITH 'Problem in sending IDOC'.
ENDIF.
Thanks,
Vinod. -
Hi,
I need to develop BDC for transaction FAGLSKF. I tried recording the transaction and found that the line items are not getting recorded since the transaction uses an editable ALV and not a table control. I have seen some post regarding this but everyone is saying to use some FM's but all these FM's are not yet released by SAP & even if i use it I still have to seperately take care of validations. Please let me know if anyone has faced this issue and found an alternative.
Thanks,
AntonyHi ,
Check this BAPI Function module BAPI_ACC_STAT_KEY_FIG_POST.
Regards,
Ashok. -
For transaction code MD61, I want to upload data using BAPI
Hi,
for transaction code MD61, I want to upload data using BAPI.
Which BAPi I ll call ?
Can anyone suggest me how to do it with any simple example program ?Refer the thread for details about coding-
BAPI_REQUIREMENTS_CREATE
Reards,
Amit -
BAPI for Transaction Codes FMV1 and FMZ1
hi,
is there any bapi for transaction codes FMV1 and FMZ1?!
please advice!
thanks JEHI,
For FMZ1
use this
FMFR_CREATE_FROM_DATA
FMFR_CHANGE_FROM_DATA
FMFR_CHANGE_COMPLETION_FLAG
Regards
Hiren K.Chitalia -
BDC for Transaction IA01 including recording from excel (sample Code)
Dear Experts,
Can anyone give me a sample BDC code for transaction IA01 from excel
Thanks in advance
Regards
SayandeepHi,
Try This Code
report Y_P_GB01
no standard page heading line-size 255.
R O H M A N D H A A S C O M P A N Y *
======================================================================
Development ID : mqhpkl *
Creation Date : 24-11-2008 *
Developer Name : Paramesh Kalluri *
Program Title : Upload the Special Ledger data from Excel to SAP *
Description : *
Constants *
CONSTANTS: c_begcol TYPE i VALUE 1,
c_begrow TYPE i VALUE 1,
c_endcol TYPE i VALUE 10,
c_endrow TYPE i VALUE 10.
Types Declaration *
TYPES : begin of d_itab,
data element: BUKRS
BUKRS_001(004),
data element: DOCTY
DOCTY_002(002),
data element: RVERS
RVERS_003(003),
data element: BUDAT
DATE_004(010),
data element: RTCUR
RTCUR_005(005),
data element: GCURR_A
GCURR_006(005),
data element:
GD_USE_TARGET_LEDGER_007(001),
data element:
TARGET_LEDGER_008(002),
data element: UTAB_D
UTAB_009(030),
data element: VTCUR12
TSL_010(019),
end of d_itab.
Data Declarations *
DATA: it_bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE,
it_bdcmsgcoll LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE,
XL_itab type alsmex_tabline occurs 0 with header line,
msg_disp TYPE string.
data : it_itab type standard table of d_itab,
wa_itab type d_itab.
Selection Screen *
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS: p_file LIKE rlgrap-filename.
SELECTION-SCREEN: END OF BLOCK b1.
At Selection Screen for File *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
perform f4_filename.
Start-of-selection *
start-of-selection.
*Uploading the data from excel to internal table
perform excel_upload.
*Uploading to SAP
perform chek_data.
if sy-subrc ne 0.
perform format_message.
endif.
end-of-selection.
*& Form F4_FILENAME
Find the file
--> p1 text
<-- p2 text
FORM F4_FILENAME .
CALL FUNCTION 'F4_FILENAME'
IMPORTING
FILE_NAME = p_file.
ENDFORM. " F4_FILENAME
*& Form CHEK_DATA
text
--> p1 text
<-- p2 text
FORM CHEK_DATA .
loop at it_itab into wa_itab.
perform bdc_dynpro using 'SAPMGBUK' '0102'.
perform bdc_field using 'BDC_CURSOR'
'GLU1-BUKRS'.
perform bdc_field using 'BDC_OKCODE'
'=ERF'.
perform bdc_field using 'GLU1-BUKRS'
wa_itab-bukrs_001.
perform bdc_field using 'GLU1-DOCTY'
wa_itab-docty_002.
perform bdc_field using 'GLU1-RVERS'
wa_itab-RVERS_003.
perform bdc_field using 'RGBUK-DATE'
wa_itab-DATE_004.
perform bdc_field using 'GLU1-RTCUR'
wa_itab-RTCUR_005.
perform bdc_field using 'RGBUK-GCURR'
wa_itab-GCURR_006.
perform bdc_field using 'GD_USE_TARGET_LEDGER'
wa_itab-GD_USE_TARGET_LEDGER_007.
perform bdc_field using 'TARGET_LEDGER'
wa_itab-TARGET_LEDGER_008.
perform bdc_field using 'T883S-UTAB'
wa_itab-UTAB_009.
perform bdc_dynpro using 'SAPMGBUK' '0110'.
perform bdc_field using 'BDC_CURSOR'
'GLU1-TSL'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'GLU1-TSL'
wa_itab-TSL_010.
perform bdc_dynpro using 'SAPMGBUK' '0110'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'GLU1-TSL'.
perform bdc_dynpro using 'SAPLSPO1' '0200'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_dynpro using 'SAPMGBUK' '0102'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'GLU1-BUKRS'.
CALL TRANSACTION 'GB01' USING IT_BDCDATA MODE 'A' UPDATE 'A' MESSAGES
INTO IT_BDCMSGCOLL.
CLEAR WA_ITAB.
refresh it_bdcdata.
ENDLOOP.
ENDFORM. " CHEK_DATA
*& Form EXCEL_UPLOAD
text
--> p1 text
<-- p2 text
FORM EXCEL_UPLOAD .
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_file
I_BEGIN_COL = c_begcol
I_BEGIN_ROW = c_begrow
I_END_COL = c_endcol
I_END_ROW = c_endrow
TABLES
INTERN = xl_itab.
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
loop at xl_itab.
case xl_itab-col.
when '1'.
wa_itab-bukrs_001 = xl_itab-value.
when '2'.
wa_itab-docty_002 = xl_itab-value.
when '3'.
wa_itab-RVERS_003 = xl_itab-value.
when '4'.
wa_itab-DATE_004 = xl_itab-value.
when '5'.
wa_itab-RTCUR_005 = xl_itab-value.
when '6'.
wa_itab-GCURR_006 = xl_itab-value.
when '7'.
wa_itab-GD_USE_TARGET_LEDGER_007 = xl_itab-value.
when '8'.
wa_itab-TARGET_LEDGER_008 = xl_itab-value.
when '9'.
wa_itab-UTAB_009 = xl_itab-value.
when '10'.
wa_itab-TSL_010 = xl_itab-value.
*at end of row.
append wa_itab to it_itab.
*endat.
endcase.
at end of row.
append wa_itab to it_itab.
endat.
endloop.
ENDFORM. " EXCEL_UPLOAD
*& Form BDC_DYNPRO
text
-->P_0169 text
-->P_0170 text
FORM BDC_DYNPRO USING A B.
clear it_bdcdata.
it_bdcdata-PROGRAM = A.
it_bdcdata-DYNPRO = B.
it_bdcdata-DYNBEGIN = 'X'.
APPEND it_bdcdata.
ENDFORM. " BDC_DYNPRO
*& Form BDC_FIELD
text
-->P_0174 text
-->P_0175 text
FORM BDC_FIELD USING C D.
clear
it_bdcdata.
it_bdcdata-FNAM = C.
it_bdcdata-FVAL = D.
APPEND it_bdcdata.
ENDFORM. " BDC_FIELD
*& Form FORMAT_MESSAGE
text
--> p1 text
<-- p2 text
FORM FORMAT_MESSAGE .
LOOP AT IT_BDCMSGCOLL.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = IT_BDCMSGCOLL-MSGID
LANG = '-D'
NO = it_bdcmsgcoll-msgnr
V1 = IT_BDCMSGCOLL-MSGV1
V2 = IT_BDCMSGCOLL-MSGV2
V3 = IT_BDCMSGCOLL-MSGV3
V4 = IT_BDCMSGCOLL-MSGV4
IMPORTING
MSG = MSG_DISP
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE:/ MSG_DISP.
ENDLOOP.
ENDFORM. " FORMAT_MESSAGE
******************End of the Program**********
All the best
Maybe you are looking for
-
Any way to use filter to exclude tables in navagation pane?
Is there any way to use filter to exclude a set of tables from the table list in the navagation pane? I have a number of tables (15+) starting with the same prefix eg. AB123 that I would like eliminate from the list. They sort right to the top and I
-
Emails, web history, and documents not filed in chronological order
I have brought this issue to this forum on the advice of others. My computer is not "filing" items in chronological order. This applies to emails (sent and received), web histories, created and modified info for MS Word documents, etc. Occasionally,
-
DB statistics - Use of 'Construct Database Statistics ' in process chain
Hello, I would like to know the differences (or is it complementar ?) between: - using Business content Statistics cubes + Tools / BW statistics for infoproviders - variant 'Construct Database Statistics' that can be used in process chains Have the 2
-
Is Firefox 3.6.10 technology unable to handle the new youtube?
Youtube made some sort of change(s) 1 day ago. Ever since then numerous links freeze up and firefox loads a "500 internal server error" page. The old youtube user interface was enforced once again. No change after disabling all my extensions. These s
-
I am having trouble opening iphoto. it just says "iphoto cannot be open because of problem" ...I've reinstaled it and nothing. I have also tried repairing it using the disk utility and it still dont work. This is what it says: Process: iPhoto