Upload Program to Clear GL Accounts ( F-03)
Hello Gurus,
I would like to know is there any Upload Program available in SAP FICO to clear GL Accounts.I am looking for an Uplaod Program as an alternative for f-03.
Can you also clarfiy in case if there is no such upload program,Can We design a Custamized one with the help of Abapers right?
Please Clarify ASAP.
Thanks,
B
Do you know there exists a standard T code F.13 for this kind of actvities? Try using this Tcode. You need identify a common feild in bothDr/Cr side of the Gl accounts which should carry a common value to clear automatically.
sarma
Similar Messages
-
Help on Shopping Cart Upload Program
Hi All,
I am trying develop a program for uploading Shopping Carts from EXCEL Spread Sheet.
I have gone through the following thread. But still I am facing the problems:
/message/3082168#3082168 [original link is broken]
Procedure 1: I developed program with 'BBP_PD_SC_CREATE_EXTERNAL', I got the following erros
Shopping Cart Upload Program
00001 E 008
No account assignment exists. Enter an account assignment
000000
00001 E 047
Please specify Account Assignment by selecting "Known" radio button for
000000 Please specify Account Assignment by selecting "Known" radio button for
00001 E 247
Plant for follow-on document missing
000000
Procedure 2: I used BBP_PD_SC_CREATE. I am getting the following Errors:
Shopping Cart Upload Program
A
Interface data contains errors
A
Interface data contains errors
A
Interface data contains errors
A
No data found
A
No data found
A
The document does not exist. Check entries
A
Incorrect interface data for set PDDEP in method C
A
Incorrect interface data for set PDDYN in method C
A
Incorrect interface data for set PDFRT in method C
A
Incorrect interface data for set PDHCF in method C
A
Incorrect interface data for set PDORG in method C
A
Incorrect interface data for set PDTAX in method C
A
Incorrect interface data for set PDTOL in method C
A
Incorrect interface data for set PDWGT in method C
E
Enter at least one item or one limit
Procedure 1 Sample Program:
DATA: i_basket TYPE TABLE OF bbp_basket_ext_device,
i_basket_back TYPE TABLE OF bbp_basket_back,
i_basket_errors TYPE TABLE OF bbp_oci_errors.
DATA: w_basket TYPE bbp_basket_ext_device,
w_basket_back TYPE bbp_basket_back,
w_basket_errors TYPE bbp_oci_errors.
PARAMETERS: p_user TYPE sy-uname DEFAULT 'REQUESTER'.
CLEAR w_basket.
w_basket-basket_name = 'Test Shopping Cart'.
w_basket-line = '00001'.
w_basket-description = 'Mat Desc New'.
w_basket-quantity = 1.
w_basket-unit = 'EA'.
w_basket-price = 10.
w_basket-priceunit = 1.
w_basket-currency = 'USD'.
w_basket-vendor = '0000301300'.
w_basket-category_id = 'L03621101'.
APPEND w_basket TO i_basket.
CALL FUNCTION 'BBP_PD_SC_CREATE_EXTERNAL'
EXPORTING
user_name = p_user
TABLES
basket = i_basket
basket_back = i_basket_back
basket_errors = i_basket_errors
EXCEPTIONS
not_saved = 1
OTHERS = 2.
IF sy-subrc EQ 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
LOOP AT i_basket_back INTO w_basket_back.
WRITE:/ w_basket_back-basket, w_basket_back-basket_number.
ENDLOOP.
LOOP AT i_basket_errors INTO w_basket_errors.
WRITE:/ w_basket_errors-line,
w_basket_errors-type,
w_basket_errors-code,
w_basket_errors-message,
w_basket_errors-log_no,
w_basket_errors-log_msg_no,
w_basket_errors-message_v1,
w_basket_errors-message_v2,
w_basket_errors-message_v3,
w_basket_errors-message_v4.
ENDLOOP.
Procedure 2 Sample Program:
DATA: v_header_guid TYPE crmd_orderadm_h-guid,
v_item_guid TYPE crmd_orderadm_h-guid,
v_account_guid TYPE crmd_orderadm_h-guid,
v_partner_guid TYPE crmd_orderadm_h-guid,
v_orgdata_guid TYPE crmd_orderadm_h-guid.
DATA: i_messages TYPE TABLE OF bbp_pds_messages,
i_item TYPE TABLE OF bbp_pds_sc_item_d,
i_account TYPE TABLE OF bbp_pds_acc,
i_partner TYPE TABLE OF bbp_pds_partner,
i_orgdata TYPE TABLE OF bbp_pds_org.
DATA: w_header TYPE bbp_pds_sc_header_ic,
w_e_header TYPE bbp_pds_sc_header_d,
w_messages TYPE bbp_pds_messages,
w_item TYPE bbp_pds_sc_item_d,
w_account TYPE bbp_pds_acc,
w_partner TYPE bbp_pds_partner,
w_orgdata TYPE bbp_pds_org.
CLEAR i_messages.
v_header_guid = 1.
v_item_guid = 2.
v_account_guid = 3.
v_partner_guid = 4.
v_orgdata_guid = 5.
*header-guid = 1.
*item-parent = 1.
*item-guid = 2.
*accounting-guid = 3.
*accounting-p_guid = item-guid.
*partner-partner_guid = 4.
*partner-p_guid = item-guid.
*organization-guid = 5.
*organization-p_guid = item-guid.
*I_HEADER
CLEAR w_header.
w_header-guid = v_header_guid.
w_header-object_id = 'BUS2121'.
w_header-description = 'Test SC Upload'.
w_header-currency = 'GBP'.
w_header-process_type = 'SHC'.
w_header-posting_date = sy-datum.
*I_ITEM
* DELIV_DATE, PRODUCT_TYPE, LOGSYS_FI, BE_CO_CODE.
CLEAR w_item.
w_item-guid = v_item_guid.
w_item-parent = v_header_guid.
w_item-number_int = '0000000001'.
w_item-number_ext = '0000000000'.
w_item-product = '45ACB1298F870099000000000A8E0327'.
w_item-description = 'Lay Main <=180'.
w_item-category = 'FC888C591C4CFC4081AE49F48750CBAB'.
w_item-category_id = 'L03621101'.
w_item-ext_quote_item = '0000000000'.
w_item-quantity = 1.
w_item-unit = 'EA'.
w_item-ordered_prod = '/EC_1A001'.
w_item-price = 2.
w_item-price_unit = 1.
w_item-gross_price = 2.
w_item-currency = 'USD'.
w_item-del_datcat = 1.
w_item-deliv_date = sy-datum.
w_item-product_type = '01'.
w_item-logsys_fi = 'DEVCLNT100'.
w_item-be_log_system = 'SRDCLNT100'.
*w_item-be_stge_loc = 'MAIN'.
w_item-be_plant = '1020'.
*w_item-be_move_type = '281'.
w_item-be_pur_group = '50002754'.
w_item-be_pur_org = '50000040'.
w_item-be_co_code = '1020'.
w_item-be_doc_type = 'ECPO'.
APPEND w_item TO i_item.
*I_ACCOUNT
CLEAR w_account.
w_account-guid = v_account_guid.
w_account-p_guid = v_item_guid.
w_account-distr_perc = 100.
w_account-acc_no = '0001'.
w_account-acc_cat = 'OR'.
*w_account-SRC_GUID 00000000000000000000000000000000
w_account-g_l_acct = '0000621101'.
*w_account-BUS_AREA VTRS
w_account-cost_ctr = ' 0000012061'.
w_account-sdoc_item = '000000'.
w_account-sched_line = '0000'.
w_account-co_area = 'EXEL'.
*w_account-profit_ctr = 'NM01'.
*w_account-PROF_SEGM 0000000000
*w_account-CMMT_ITEM 500411060
*w_account-FUNDS_CTR 6589
APPEND w_account TO i_account.
*I_PARTNER
CLEAR w_partner.
w_partner-partner_guid = v_partner_guid.
w_partner-p_guid = v_item_guid.
w_partner-partner_fct = '00000016'.
w_partner-partner_no = '48ED292BF5193C52E1000000AC1D061F'.
w_partner-addr_type = '3'.
w_partner-addr_origin = 'A'.
w_partner-addr_no = '0000011078'.
w_partner-partner_id = '0000000941'.
APPEND w_partner TO i_partner.
CLEAR v_partner_guid.
CLEAR w_partner.
w_partner-partner_guid = v_partner_guid.
w_partner-p_guid = v_item_guid.
w_partner-partner_fct = '00000020'.
w_partner-partner_no = '4896D1636F351467E1000000AC1D061F'.
w_partner-addr_type = '3'.
w_partner-addr_origin = 'A'.
w_partner-addr_no = '0000011078'.
w_partner-partner_id = '0000000941'.
APPEND w_partner TO i_partner.
CLEAR v_partner_guid.
CLEAR w_partner.
w_partner-partner_guid = v_partner_guid.
w_partner-p_guid = v_item_guid.
w_partner-partner_fct = '00000027'.
w_partner-partner_no = 'B106B75848BC9B4584C8A1C1EB89EC94'.
w_partner-addr_type = '1'.
w_partner-addr_origin = 'B'.
w_partner-addr_no = '0000015958'.
w_partner-partner_id = '0000000915'.
APPEND w_partner TO i_partner.
*I_ORGDATA
CLEAR w_orgdata.
w_orgdata-guid = v_orgdata_guid.
w_orgdata-p_guid = v_item_guid.
w_orgdata-proc_org_resp_id = '50002754'.
w_orgdata-proc_group_id = '50002754'.
w_orgdata-proc_org_id = '50000040'.
APPEND w_orgdata TO i_orgdata.
CALL FUNCTION 'BBP_PD_SC_CREATE'
EXPORTING
i_ref_guid = v_header_guid
i_park = 'X'
i_save = 'X'
i_header = w_header
IMPORTING
e_header = w_e_header
TABLES
i_item = i_item
i_account = i_account
i_partner = i_partner
i_orgdata = i_orgdata
e_messages = i_messages.
LOOP AT i_messages INTO w_messages .
WRITE:/ w_messages-msgty,
* w_messages-msgid,
* w_messages-msgno,
w_messages-message
* w_messages-msgv1,
* w_messages-msgv2,
* w_messages-msgv3,
* w_messages-msgv4
ENDLOOP
Thanks a lot in advance to help me out this.
Please send if you have code to complete this to sudarsan.srm at gmail (gmail id - sudarsan.srm)
Best Regards,
SudarsanHi All,
I forgot to mention SRM Version. I am working on SRM 4.0.
Thanks,
Best Regards,
Sudarsan -
Upload Program(sap-abap)
Hi Friends,
I am using existing program to upload data(MM01 - BASIC VIEW ).But one of the field(MARA-BISMT) for old material number is neither uploading to transaction nor database.I have to uoload for other views(Purchasing, Accounting and so on) also which are depended on this old material number field.
Secondly, Functional guy suggest me to add some of the fileds into it which are not available in upload structure.
Could you guide me how to fix this issue in below code and upload data safely ?
* Description : Migration Program for Material Master Basic View
* Using xls-structure in Migration Overview: MM-Basic View
* NAME SR DATE VER. XLS DESCRIPTION OF VERSION
* 8804 04.05.2008 1.0 1.0 Original program
* 8804 27.05.2004 1.1 1.0 Changed check for pack size
* multi pack size, EAN no,
* does not write to initial
* bdc_fields FORMT and FERTH
* 8804 09.06.2006 1.2 1.0 added flag for intercompany
* materials on converting table, also changed FM
* ZMM_ADD_OLD_MATNR_TO_CONV_TABL
REPORT z_basic.
* Structure for batch input
CONSTANTS: c_structure TYPE tabname VALUE 'ZMM_BASIC_VIEW'.
TABLES: makt, t006a, t024l, t002, zpmg, zsf1, zsf2, zsf3, zsf4, zsf5,
zdrc, zdkb, zcce, zpsz, zcns, zusz, zatc, zmsz, t006, tntp, t179
* Internal Tables
DATA: i_data TYPE STANDARD TABLE OF zmm_basic_view.
DATA: i_spras TYPE STANDARD TABLE OF makt-spras.
* selection screen
SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
PARAMETERS: p_file(128) DEFAULT 'U:\My Documents\mm_basic.txt'.
SELECTION-SCREEN SKIP.
PARAMETERS: p_mode LIKE ctu_params-dismode DEFAULT 'N'.
PARAMETERS: p_test NO-DISPLAY DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK block1.
INCLUDE Z_BASIC_A.
*INCLUDE zmigration.
* START-OF-SELECTION
START-OF-SELECTION.
PERFORM upload_file.
PERFORM check_entries.
PERFORM add_icons.
IF p_test NE 'X'.
PERFORM update.
update_run = 'X'.
ENDIF.
PERFORM show_result.
*& Form UPDATE
* text
* --> p1 text
* <-- p2 text
FORM update.
CALL FUNCTION 'ZMM_BASIC'
EXPORTING
mode = p_mode
TABLES
i_data = i_data
i_mess = i_mess.
* update conversion table for materials where SAP-number already
* exists and material description also already exist for language in
* field SPRAS_2. This will only happen for inter company materials.
LOOP AT i_data INTO wa_data WHERE zman_update EQ 'X'.
CALL FUNCTION 'ZMM_ADD_OLD_MATNR_TO_CONV_TABL'
EXPORTING
zzomp = wa_data-old_matnr
werks = '54' " dummy plant
matnr = wa_data-matnr
bismt = wa_data-old_matnr
inter_company = 'X'.
wa_data-msgtx = 'Conversion table for material updated'.
wa_data-msgtyp = 'I'.
WRITE icon_led_yellow AS ICON TO wa_data-icon.
MODIFY i_data FROM wa_data TRANSPORTING icon msgtyp msgtx.
ENDLOOP.
ENDFORM. " UPDATE
*& Form SHOW_RESULT
* text
* --> p1 text
* <-- p2 text
FORM show_result.
PERFORM generate_fieldcatalog.
PERFORM hide_blank_fields.
PERFORM unhide_message_columns.
PERFORM move_message_columns.
* PERFORM add_sorting_to_grid. " sort by first column in file
IF called_screen_100 EQ space.
called_screen_100 = 'X'.
CALL SCREEN 100.
ENDIF.
ENDFORM. " SHOW_RESULT
*& Form check_entries
* text
* --> p1 text
* <-- p2 text
FORM check_entries.
DATA: wa_find_new_material TYPE zfind_new_material_number.
LOOP AT i_data INTO wa_data.
* if file has been downloaded, it may already contain messages
CLEAR: wa_data-icon,
wa_data-msgtyp,
wa_data-msgtx.
TRANSLATE wa_data-spras_2 TO UPPER CASE.
TRANSLATE wa_data-meins TO UPPER CASE.
TRANSLATE wa_data-gewei TO UPPER CASE.
TRANSLATE wa_data-voleh TO UPPER CASE.
TRANSLATE wa_data-zzcce TO UPPER CASE.
* If the material already exists, only texts should be maintained
IF NOT wa_data-matnr IS INITIAL.
* Required fields filled?
CASE space.
WHEN wa_data-spras_2.
wa_data-msgtx = 'Field language key (SPRAS_2) is required'.
WHEN wa_data-maktx_2.
wa_data-msgtx = 'Field mat. description (MAKTX_2) is required'.
ENDCASE.
* Set old_matnr to SAP number if it is not filled
IF wa_data-old_matnr IS INITIAL.
wa_data-old_matnr = wa_data-matnr.
ENDIF.
IF wa_data-msgtx EQ space.
* Language key allowed
SELECT SINGLE * FROM t002
WHERE spras = wa_data-spras_2.
IF sy-subrc NE 0.
wa_data-msgtx = 'Language key does not exist (spras_2)'.
ENDIF.
ENDIF.
IF wa_data-msgtx IS INITIAL.
SHIFT wa_data-matnr RIGHT DELETING TRAILING space.
OVERLAY wa_data-matnr WITH '000000000000000000'.
SELECT SINGLE * FROM makt
WHERE matnr EQ wa_data-matnr
AND spras EQ wa_data-spras_2.
IF sy-subrc EQ 0.
CONCATENATE 'Mat. description already exists for language'
wa_data-spras_2
INTO wa_data-msgtx SEPARATED BY space.
MOVE 'X' TO wa_data-zman_update.
ENDIF.
ENDIF.
* Change material - Find line to insert the new description.
IF wa_data-msgtx IS INITIAL.
SELECT spras
INTO TABLE i_spras
FROM makt
WHERE matnr = wa_data-matnr.
DESCRIBE TABLE i_spras LINES l_lines.
IF l_lines > 3.
* All screen fields for descriptions are filled - Must be updated
* manually -
* ( or add code to insert into MAKT in an other way... )
wa_data-msgtx =
'Description must be added manually - only 4 lines available on screen'.
wa_data-zman_update = 'X'.
* added to converting table after update run
ENDIF.
ENDIF.
ELSE.
* Check if required fields are filled
CASE space.
WHEN wa_data-spras_2.
wa_data-msgtx = 'Field language key (SPRAS_2) is required'.
WHEN wa_data-maktx_1.
wa_data-msgtx = 'Field mat. description (MAKTX_1) is required'.
WHEN wa_data-maktx_2.
wa_data-msgtx = 'Field mat. description (MAKTX_2) is required'.
WHEN wa_data-mbrsh.
wa_data-msgtx = 'Field Industry sector (mbrsh) is required'.
WHEN wa_data-mtart.
wa_data-msgtx = 'Field Material type (mtart) is required'.
WHEN wa_data-meins.
wa_data-msgtx = 'Field Base unit of measure (meins) is required'.
WHEN wa_data-prdha.
wa_data-msgtx = 'Field Product hierarchy (prdha) is required'.
WHEN wa_data-labor.
wa_data-msgtx = 'Field Laboratory design (labor) is required'.
ENDCASE.
* Values allowed?
IF wa_data-msgtx EQ space.
* Base unit of measure
SELECT SINGLE * FROM t006a
WHERE spras = sy-langu
AND mseh3 = wa_data-meins.
IF sy-subrc NE 0.
wa_data-msgtx = 'Base unit of measure does not exist (mseh3)'.
ENDIF.
ENDIF.
IF wa_data-msgtx EQ space.
* Lab./Office
SELECT SINGLE * FROM t024l
WHERE labor = wa_data-labor.
IF sy-subrc NE 0.
wa_data-msgtx = 'Lab./Office does not exist (labor)'.
ENDIF.
ENDIF.
IF wa_data-msgtx EQ space.
* Language key
SELECT SINGLE * FROM t002
WHERE spras = wa_data-spras_2.
IF sy-subrc NE 0.
wa_data-msgtx = 'Language key does not exist (spras_2)'.
ENDIF.
ENDIF.
IF wa_data-msgtx EQ space.
* Product hierarchy
SELECT SINGLE * FROM t179
WHERE prodh = wa_data-prdha.
IF sy-subrc NE 0.
wa_data-msgtx = 'Product hierarchy does not exist (PRDHA)'.
ENDIF.
ENDIF.
IF wa_data-msgtx EQ space AND NOT wa_data-zzpmg IS INITIAL.
* ProdMatGrp (ABC ind)
SELECT SINGLE * FROM zpmg
WHERE zzpmg = wa_data-zzpmg.
IF sy-subrc NE 0.
wa_data-msgtx =
'ProdMatGrp (ABC ind) does not exist (zzpmg)'.
ENDIF.
ENDIF.
IF wa_data-msgtx EQ space AND NOT wa_data-zzsf1 IS INITIAL.
* Sort field 1
SELECT SINGLE * FROM zsf1
WHERE zzsf1 = wa_data-zzsf1.
IF sy-subrc NE 0.
wa_data-msgtx =
'Sort field 1 does not exist (ZZSF1)'.
ENDIF.
ENDIF.
IF wa_data-msgtx EQ space AND NOT wa_data-zzsf2 IS INITIAL.
* Sort field 2
SELECT SINGLE * FROM zsf2
WHERE zzsf2 = wa_data-zzsf2.
IF sy-subrc NE 0.
wa_data-msgtx =
'Sort field 2 does not exist (ZZSF2)'.
ENDIF.
ENDIF.
IF wa_data-msgtx EQ space AND NOT wa_data-zzsf3 IS INITIAL.
* Sort field 3
SELECT SINGLE * FROM zsf3
WHERE zzsf3 = wa_data-zzsf3.
IF sy-subrc NE 0.
wa_data-msgtx =
'Sort field 3 does not exist (ZZSF3)'.
ENDIF.
ENDIF.
IF wa_data-msgtx EQ space AND NOT wa_data-zzsf4 IS INITIAL.
* Sort field 4
SELECT SINGLE * FROM zsf4
WHERE zzsf4 = wa_data-zzsf4.
IF sy-subrc NE 0.
wa_data-msgtx =
'Sort field 4 does not exist (ZZSF4)'.
ENDIF.
ENDIF.
IF wa_data-msgtx EQ space AND NOT wa_data-zzsf5 IS INITIAL.
* Sort field 5
SELECT SINGLE * FROM zsf5
WHERE zzsf5 = wa_data-zzsf5.
IF sy-subrc NE 0.
wa_data-msgtx =
'Sort field 5 does not exist (ZZSF5)'.
ENDIF.
ENDIF.
* Drug Code
IF wa_data-msgtx EQ space AND NOT wa_data-zzdrc IS INITIAL.
SELECT SINGLE * FROM zdrc
WHERE zzdrc = wa_data-zzdrc.
IF sy-subrc NE 0.
wa_data-msgtx =
'Drug Code does not exist (zzdrc)'.
ENDIF.
ENDIF.
* Narco Base
IF wa_data-msgtx EQ space AND NOT wa_data-zzdkb IS INITIAL.
SELECT SINGLE * FROM zdkb
WHERE zzdkb = wa_data-zzdkb.
IF sy-subrc NE 0.
wa_data-msgtx =
'Narco Base does not exist (zzdkb)'.
ENDIF.
ENDIF.
* Country code, Emscope standard
IF wa_data-msgtx EQ space AND NOT wa_data-zzcce IS INITIAL.
SELECT SINGLE * FROM zcce
WHERE zzcce = wa_data-zzcce.
IF sy-subrc NE 0.
wa_data-msgtx =
'Country code, Emscope standard does not exist (zzcce)'.
ENDIF.
ENDIF.
* Package size
IF wa_data-msgtx EQ space AND NOT wa_data-zzpsz IS INITIAL.
CONDENSE wa_data-zzpsz.
SELECT SINGLE * FROM zpsz
WHERE zzpsz = wa_data-zzpsz.
IF sy-subrc NE 0.
wa_data-msgtx = 'Package size does not exist (zzpsz)'.
ENDIF.
ENDIF.
* Concentration
IF wa_data-msgtx EQ space AND NOT wa_data-zzcns IS INITIAL.
SELECT SINGLE * FROM zcns
WHERE zzcns = wa_data-zzcns.
IF sy-subrc NE 0.
wa_data-msgtx =
'Concentration does not exist (ZZCNS)'.
ENDIF.
ENDIF.
* Unit Size
IF wa_data-msgtx EQ space AND NOT wa_data-zzusz IS INITIAL.
SELECT SINGLE * FROM zusz
WHERE zzusz = wa_data-zzusz.
IF sy-subrc NE 0.
wa_data-msgtx =
'Unit Size does not exist (ZZUSZ)'.
ENDIF.
ENDIF.
* ATC-no.
IF wa_data-msgtx EQ space AND NOT wa_data-zzatc IS INITIAL.
SELECT SINGLE * FROM zatc
WHERE zzatc = wa_data-zzatc.
IF sy-subrc NE 0.
wa_data-msgtx =
'ATC-no. does not exist (ZZATC)'.
ENDIF.
ENDIF.
* Multi pack size
IF wa_data-msgtx EQ space AND NOT wa_data-zzmsz IS INITIAL.
CONDENSE wa_data-zzmsz.
SELECT SINGLE * FROM zmsz
WHERE zzmsz = wa_data-zzmsz.
IF sy-subrc NE 0.
wa_data-msgtx =
'Multi pack size does not exist (ZZMSZ)'.
ENDIF.
ENDIF.
* Weight Unit
IF wa_data-msgtx EQ space AND NOT wa_data-gewei IS INITIAL.
SELECT SINGLE * FROM t006
WHERE msehi = wa_data-gewei.
IF sy-subrc NE 0.
wa_data-msgtx =
'Weight Unit does not exist (GEWEI)'.
ENDIF.
ENDIF.
* Volume Unit
IF wa_data-msgtx EQ space AND NOT wa_data-voleh IS INITIAL.
SELECT SINGLE * FROM t006
WHERE msehi = wa_data-voleh.
IF sy-subrc NE 0.
wa_data-msgtx =
'Volume Unit does not exist (VOLEH)'.
ENDIF.
ENDIF.
* EAN for Germany will be entered manually by Cato.
if wa_data-ean11 ne space and wa_data-msgtx eq space.
data: l_ean_length type i.
l_ean_length = strlen( wa_data-ean11 ).
if l_ean_length ne 13 or wa_data-matnr ne space.
wa_data-msgtx =
'Enter EAN numbers manually for Germany and common materials'.
elseif wa_data-numtp is initial.
wa_data-msgtx = 'EAN category must be given for EAN number'.
endif.
endif.
if wa_data-ean11 eq space and wa_data-numtp ne space.
* Makes no sense to have an EAN category when there is no EAN
clear: wa_data-numtp.
endif.
ENDIF. " IF NOT wa_data-matnr IS INITIAL.
* Has material already been migrated?
IF wa_data-msgtx EQ space and wa_data-msgtyp ne 'W'.
CLEAR: wa_find_new_material.
MOVE: wa_data-old_matnr TO wa_find_new_material-matnr_old,
'54' TO wa_find_new_material-werks.
CALL FUNCTION 'ZFIND_NEW_MATERIAL_NUMBER'
EXPORTING
get_from_marc = space
CHANGING
wa_data = wa_find_new_material.
IF NOT wa_find_new_material-matnr IS INITIAL.
CONCATENATE: 'Material already created:'
wa_find_new_material-matnr
INTO wa_data-msgtx
SEPARATED BY space.
wa_data-msgtyp = 'E'.
ENDIF.
ENDIF.
* Set all messages that are not Warning to Error
IF wa_data-msgtx NE space AND wa_data-msgtyp EQ space.
MOVE: 'E' TO wa_data-msgtyp.
ENDIF.
MODIFY i_data FROM wa_data.
ENDLOOP.
ENDFORM. " check_entries
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
DATA: local_commands.
PERFORM user_commands_local CHANGING local_commands.
IF local_commands EQ 'X'.
* local user command has been executed - clear ok_code
CLEAR ok_code.
ELSE.
PERFORM user_commands.
ENDIF.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form user_commands_local
* text
* <--P_LOCAL_COMMANDS text
FORM user_commands_local CHANGING p_local_commands.
* Add your own user commands here and overwrite default handling if
* necessary
DATA: local_ok TYPE ok.
local_commands = 'X'.
local_ok = ok_code.
CASE local_ok.
WHEN OTHERS.
CLEAR: local_commands.
ENDCASE.
ENDFORM. " user_commands_local
Pls treat it as urgent.
I ll reward for usefull response.
Thx in Adv.
BobbyHi,
I didn't recieve any response from you regarding issues in upload program.
Could you pls send some solution for this issue ?
Pls treat it as urgent.
Thx in Adv.
Bobby -
Invoice Upload Program in FB50
Hi Experts,
I need to develop an invoice upload program for transaction code FB50. The data will be from an Excel file.
As I'm new to program in accounting, is there anyone has sample code?
I'm not sure what function module to use to save the invoice.
Hope someone can help me. Many thanks in advance.Hi Sam,
It generally depends on what sort of postings you are doing.
You can refer to following code, it is for the posting of invoices.
Document Header
wa_document_header-comp_code = c_company_2001.
One time vendor
Concatenate the text and account number and pass it as a line item text
Check for the Payee name and use vendor number accordingly
Check if amount value is more than '0'
Vendor line item
GL Account line item
Get currency details for vendor line item
Get currency details for GL Account line item
Pass suitable posting key
Pass suitable posting key
When posting amount is less than zero
Vendor line item
Get currency details for vendor line item
Get currency details for GL Account line item
GL Account line item
Pass suitable posting key
Pass suitable posting key
Check if one time vendor data is available
Call the BAPI 'BAPI_ACC_DOCUMENT_POST' to create the invoices
Check if bapi return table is intial
Maintain a error log with all BAPI returned messages
Get only error\abort messages into error table
check if flag has been enabled
Check for the message type in the return table and
if it is success then commit the transaction.
Concatenate the message text and refund id into a variable
append success messge to the error table
Refresh the internal tables
Clear the work areas and variables
LOOP AT it_record INTO wa_record.
wa_document_header-username = sy-uname.
wa_document_header-comp_code = v_compcode.
wa_document_header-doc_date = wa_record-bkpf_bldat.
wa_document_header-pstng_date = sy-datum.
wa_document_header-doc_type = v_doctype.
wa_document_header-ref_doc_no = wa_record-bkpf_xblnr.
wa_customercpd-name = wa_record-bsec_name1.
wa_customercpd-name_2 = wa_record-bsec_name2.
wa_customercpd-postl_code = wa_record-bsec_pstlz.
wa_customercpd-city = wa_record-bsec_ort01.
wa_customercpd-country = v_country.
wa_customercpd-street = wa_record-bsec_stras.
wa_customercpd-tax_no_1 = wa_record-bsec_stcd1.
wa_customercpd-tax_no_2 = wa_record-bsec_stcd2.
wa_customercpd-region = wa_record-bsec_regio.
CONCATENATE text-008 wa_record-bseg_sgtxt INTO v_item_text " Refund for Acc no
SEPARATED BY space.
IF wa_record-bsec_name1 = c_name_heap.
v_vendor_no = v_vendor_heap.
ELSE.
v_vendor_no = v_vendor_onetime.
ENDIF.
IF wa_record-bseg_wrbtr GT 0.
wa_acc_payable-itemno_acc = c_itemno_1.
wa_acc_payable-vendor_no = v_vendor_no.
wa_acc_payable-item_text = v_item_text.
APPEND wa_acc_payable TO it_acc_payable.
CLEAR: wa_acc_payable.
wa_accountgl-itemno_acc = c_itemno_2.
wa_accountgl-gl_account = v_glaccount.
wa_accountgl-item_text = v_item_text.
APPEND wa_accountgl TO it_accountgl.
CLEAR: wa_accountgl.
wa_currency_amount-itemno_acc = c_itemno_1.
wa_currency_amount-currency = c_currency_usd .
wa_currency_amount-amt_doccur = - ( wa_record-bseg_wrbtr ).
APPEND wa_currency_amount TO it_currency_amount.
CLEAR: wa_currency_amount.
wa_currency_amount-itemno_acc = c_itemno_2.
wa_currency_amount-currency = c_currency_usd .
wa_currency_amount-amt_doccur = wa_record-bseg_wrbtr.
APPEND wa_currency_amount TO it_currency_amount.
CLEAR: wa_currency_amount.
wa_extension2-structure = c_structure.
wa_extension2-valuepart1 = c_itemno_1.
wa_extension2-valuepart2 = c_newbs_31. " Credit indicator( Vendor side )
APPEND wa_extension2 TO it_extension2.
CLEAR: wa_extension2.
wa_extension2-structure = c_structure.
wa_extension2-valuepart1 = c_itemno_2.
wa_extension2-valuepart2 = c_newbs_40. " Debit indicator( GL Account side )
APPEND wa_extension2 TO it_extension2.
CLEAR: wa_extension2.
ELSE.
wa_acc_payable-itemno_acc = c_itemno_1.
wa_acc_payable-vendor_no = v_vendor_no.
wa_acc_payable-item_text = v_item_text.
APPEND wa_acc_payable TO it_acc_payable.
CLEAR: wa_acc_payable.
wa_currency_amount-itemno_acc = c_itemno_1.
wa_currency_amount-currency = c_currency_usd .
wa_currency_amount-amt_doccur = wa_record-bseg_wrbtr.
APPEND wa_currency_amount TO it_currency_amount.
CLEAR: wa_currency_amount.
wa_currency_amount-itemno_acc = c_itemno_2.
wa_currency_amount-currency = c_currency_usd .
wa_currency_amount-amt_doccur = - ( wa_record-bseg_wrbtr ).
APPEND wa_currency_amount TO it_currency_amount.
CLEAR: wa_currency_amount.
wa_accountgl-itemno_acc = c_itemno_2.
wa_accountgl-gl_account = v_glaccount.
wa_accountgl-item_text = v_item_text.
APPEND wa_accountgl TO it_accountgl.
CLEAR: wa_accountgl.
wa_extension2-structure = c_structure.
wa_extension2-valuepart1 = c_itemno_1.
wa_extension2-valuepart2 = c_newbs_21. " Debit indicator( Vendor side )
APPEND wa_extension2 TO it_extension2.
CLEAR: wa_extension2.
wa_extension2-structure = c_structure.
wa_extension2-valuepart1 = c_itemno_2.
wa_extension2-valuepart2 = c_newbs_50. " Credit indicator( GL Account side )
APPEND wa_extension2 TO it_extension2.
CLEAR: wa_extension2.
ENDIF.
IF wa_customercpd IS NOT INITIAL.
CALL FUNCTION 'BAPI_ACC_DOCUMENT_POST'
EXPORTING
documentheader = wa_document_header
customercpd = wa_customercpd
TABLES
accountgl = it_accountgl
accountpayable = it_acc_payable
currencyamount = it_currency_amount
return = it_return
extension2 = it_extension2.
IF it_return IS NOT INITIAL.
LOOP AT it_return INTO wa_return WHERE type = c_msgtype_e OR
type = c_msgtype_a.
CONCATENATE wa_return-message text-013 wa_record-bkpf_xblnr INTO v_msg_text
SEPARATED BY space.
MOVE v_msg_text TO wa_return-message.
APPEND wa_return TO it_error.
CLEAR: wa_return,
v_msg_text.
f_error_ind = c_true.
ENDLOOP.
IF f_error_ind EQ c_true.
EXIT.
ELSE.
DESCRIBE TABLE it_return LINES v_tabix.
READ TABLE it_return INDEX v_tabix INTO wa_return.
IF sy-subrc = 0.
v_total_amount = ABS( wa_record-bseg_wrbtr ) + v_total_amount. " Total posting amount
CONCATENATE wa_return-message text-013 wa_record-bkpf_xblnr INTO v_msg_text
SEPARATED BY space.
MOVE v_msg_text TO wa_return-message.
APPEND wa_return TO it_success.
CLEAR: wa_return,
v_msg_text,
v_tabix.
ENDIF.
ENDIF.
ENDIF.
ELSE.
wa_return-type = c_msgtype_e.
wa_return-message = text-009. " One time vendor details are not found
APPEND wa_return TO it_error.
CLEAR: wa_return.
EXIT.
ENDIF.
REFRESH: it_return,
it_acc_payable,
it_currency_amount,
it_accountgl,
it_extension2.
CLEAR: wa_document_header,
wa_customercpd,
wa_record,
v_vendor_no,
v_item_text.
ENDLOOP.
Sam, before making the postings directly, try using 'BAPI_ACC_DOCUMENT_CHECK' so that
you will get to mo
I hope, it will be helpful to you.
If you want any more help, get back to me.
Regards,
Jallu -
Automating Cash Journal Posting using inbound proxy interface and upload program
Hi Experts,
I have a requirement where in cash journal posting needs to be carried out automatically by an inbound interface on a periodic basis and at the start during cut over an upload program needs to be used to upload beg balance data . For this purpose I have used BAPI_CASHJOURNALDOC_CREATE to save cash journal entries along with BAPI TRANSACTION COMMIT.
Once the Data is successfully saved I am using FM FCJ_GET_DATA_FOR_SCREEN to get prerequisite data for the FM FCJ_POST_ALL which is used by the Standard cash journal program internally to post the saved data. ( I got this by debugging the standard transaction and both FMs are not yet released )
The issues I am facing is that the the FM FCJ_POST_ALL does not always post the data it behaves in random fashion i.e some times it posts the entries where as sometimes it does not post the entries.
I have tried using commit work after the FM but that also does not result in consistent behavior of the program. One more issue is the i am not allowed to use commit work in a an inbound proxy so how do i proceed ?
I am attaching the code for further analysis:
DATA: LIT_TCJ_TRANS_NAMES TYPE TABLE OF TCJ_TRANS_NAMES,
LWA_TCJ_TRANS_NAMES TYPE TCJ_TRANS_NAMES,
LV_WAIT TYPE BAPITA-WAIT VALUE '1',
LV_RECORD_NO TYPE SY-TABIX.
DATA : LIT_POSTING TYPE STANDARD TABLE OF ISCJ_POSTINGS,
LIT_WTAX_ITEMS TYPE STANDARD TABLE OF TCJ_WTAX_ITEMS,
LIT_SPLIT_POSTINGS TYPE STANDARD TABLE OF ISCJ_POSTINGS,
LIT_CPD TYPE STANDARD TABLE OF TCJ_CPD.
DATA: LV_BEG_BALANCE TYPE CJAMOUNT,
LV_TOTAL_RECEIPTS TYPE CJAMOUNT,
LV_TOTAL_PAYMENTS TYPE CJAMOUNT,
LV_TOTAL_CHECKS TYPE CJAMOUNT,
LV_RUN_BALANCE TYPE CJAMOUNT,
LV_RUN_CASH_BALANCE TYPE CJAMOUNT,
LV_NUMB_OF_REC TYPE I,
LV_NUMB_OF_PAYM TYPE I,
LV_NUMB_OF_CHECKS TYPE I.
DESCRIBE TABLE GIT_CJ LINES GV_TOTAL_RECORDS.
SELECT MANDT COMP_CODE TRANSACT_NUMBER LANGU TRANSACT_NAME LONG_TEXT
FROM TCJ_TRANS_NAMES
INTO TABLE LIT_TCJ_TRANS_NAMES
WHERE LANGU = GC_EN.
IF SY-SUBRC <> 0.
MESSAGE 'No Business Transaction maintained for Company Code in this client'(016) TYPE GC_I.
LEAVE LIST-PROCESSING.
ENDIF.
DESCRIBE TABLE GIT_CJ LINES GV_TOTAL_RECORDS.
LOOP AT GIT_CJ INTO GWA_CJ.
LV_RECORD_NO = SY-TABIX.
CLEAR: GS_HEADER_BAPI,
GS_CJ_KEY,
GWA_ITEMS.
REFRESH: GIT_ITEMS,
GIT_RETURN.
GS_HEADER_BAPI-COMP_CODE = GWA_CJ-BUKRS.
GS_HEADER_BAPI-CAJO_NUMBER = GWA_CJ-CJNR.
GS_HEADER_BAPI-CURRENCY = GC_PHP.
CLEAR LWA_TCJ_TRANS_NAMES.
READ TABLE LIT_TCJ_TRANS_NAMES INTO LWA_TCJ_TRANS_NAMES WITH KEY COMP_CODE = GWA_CJ-BUKRS
LANGU = GC_EN
TRANSACT_NAME = GWA_CJ-BTNAM.
IF SY-SUBRC = 0.
GWA_ITEMS-TRANSACT_NUMBER = LWA_TCJ_TRANS_NAMES-TRANSACT_NUMBER.
GWA_ITEMS-P_RECEIPTS = GWA_CJ-CJRAT.
GWA_ITEMS-TAX_CODE = GWA_CJ-TXCOD.
GS_HEADER_BAPI-BP_NAME = GWA_CJ-BPNAM.
GWA_ITEMS-POSITION_TEXT = GWA_CJ-POTXT.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = GWA_CJ-LIFNR
IMPORTING
OUTPUT = GWA_ITEMS-VENDOR_NO.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = GWA_CJ-KUNNR
IMPORTING
OUTPUT = GWA_ITEMS-CUSTOMER.
PERFORM SUB_DATE_FROMAT_BAPI CHANGING GWA_CJ-BLDAT
GS_HEADER_BAPI-DOC_DATE.
PERFORM SUB_DATE_FROMAT_BAPI CHANGING GWA_CJ-BUDAT
GS_HEADER_BAPI-PSTNG_DATE.
GS_HEADER_BAPI-REF_DOC_NO = GWA_CJ-XBLNR.
GS_HEADER_BAPI-ALLOC_NMBR = GWA_CJ-ALLNO.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = GWA_CJ-KOSTL
IMPORTING
OUTPUT = GWA_ITEMS-COSTCENTER.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = GWA_CJ-PRCTR
IMPORTING
OUTPUT = GWA_ITEMS-PROFIT_CTR.
APPEND GWA_ITEMS TO GIT_ITEMS.
CALL FUNCTION 'BAPI_CASHJOURNALDOC_CREATE'
EXPORTING
HEADER = GS_HEADER_BAPI
IMPORTING
COMPANY_CODE = GS_CJ_KEY-COMP_CODE
CASH_JOURNAL_NUMBER = GS_CJ_KEY-CAJO_NUMBER
FISCAL_YEAR = GS_CJ_KEY-FISC_YEAR
CASH_JOURNAL_DOC_NO = GS_CJ_KEY-POSTING_NUMBER
TABLES
ITEMS = GIT_ITEMS
RETURN = GIT_RETURN.
IF GIT_RETURN IS NOT INITIAL.
READ TABLE GIT_RETURN INTO GWA_RETURN WITH KEY TYPE = GC_E.
IF SY-SUBRC <> 0.
CLEAR GWA_CJ_S.
MOVE-CORRESPONDING GS_CJ_KEY TO GWA_CJ_S.
CLEAR GWA_RETURN.
READ TABLE GIT_RETURN INTO GWA_RETURN WITH KEY TYPE = GC_S.
IF SY-SUBRC = 0.
MOVE GWA_RETURN-MESSAGE TO GWA_CJ_S-MSG.
CLEAR GWA_RETURN.
READ TABLE GIT_RETURN INTO GWA_RETURN WITH KEY TYPE = GC_I.
IF SY-SUBRC = 0.
CLEAR GWA_CJ_E.
CONCATENATE GWA_RETURN-MESSAGE GWA_CJ_S-MSG INTO GWA_CJ_E-MSG SEPARATED BY GC_PIPE_FORMAT.
MOVE-CORRESPONDING GS_HEADER_BAPI TO GWA_CJ_E.
GWA_CJ_E-POSTING_NUMBER = LV_RECORD_NO.
APPEND GWA_CJ_E TO GIT_CJ_E.
GV_ERROR_RECORDS = GV_ERROR_RECORDS + GC_1.
ELSE.
IF P_TEST NE GC_X.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = LV_WAIT.
REFRESH:LIT_POSTING ,
LIT_WTAX_ITEMS ,
LIT_SPLIT_POSTINGS ,
LIT_CPD .
CLEAR: LV_BEG_BALANCE ,
LV_TOTAL_RECEIPTS ,
LV_TOTAL_PAYMENTS ,
LV_TOTAL_CHECKS ,
LV_RUN_BALANCE ,
LV_RUN_CASH_BALANCE ,
LV_NUMB_OF_REC ,
LV_NUMB_OF_PAYM ,
LV_NUMB_OF_CHECKS .
CALL FUNCTION 'FCJ_GET_DATA_FOR_SCREEN'
EXPORTING
I_COMP_CODE = GS_CJ_KEY-COMP_CODE
I_CAJO_NUMBER = GS_CJ_KEY-CAJO_NUMBER
I_DISPLAY_PERIOD_LO = GS_HEADER_BAPI-PSTNG_DATE
I_DISPLAY_PERIOD_HI = GS_HEADER_BAPI-PSTNG_DATE
IMPORTING
E_BEGINNING_BALANCE = LV_BEG_BALANCE
E_RUNNING_BALANCE = LV_RUN_BALANCE
E_RUNNING_CASH_BALANCE = LV_RUN_CASH_BALANCE
E_TOTAL_RECEIPTS = LV_TOTAL_RECEIPTS
E_TOTAL_REC_NUMBER = LV_NUMB_OF_REC
E_TOTAL_PAYMENTS = LV_TOTAL_PAYMENTS
E_TOTAL_PAYM_NUMBER = LV_NUMB_OF_PAYM
E_TOTAL_CHECKS = LV_TOTAL_CHECKS
E_TOTAL_CHECKS_NUMBER = LV_NUMB_OF_CHECKS
TABLES
E_POSTINGS = LIT_POSTING
E_WTAX_ITEMS = LIT_WTAX_ITEMS
E_SPLIT_POSTINGS = LIT_SPLIT_POSTINGS
E_CPD = LIT_CPD.
CALL FUNCTION 'FCJ_POST_ALL'
EXPORTING
I_COMP_CODE = GS_CJ_KEY-COMP_CODE
I_CAJO_NUMBER = GS_CJ_KEY-CAJO_NUMBER
I_CURRENCY = GS_HEADER_BAPI-CURRENCY
I_TYP = 'R'
I_DISPLAY_PERIOD_LO = GS_HEADER_BAPI-PSTNG_DATE
I_DISPLAY_PERIOD_HI = GS_HEADER_BAPI-PSTNG_DATE
* IMPORTING
* E_ERROR_NUMBER =
TABLES
ITCJ_POSTINGS = LIT_POSTING
ITCJ_WTAX_ITEMS = LIT_WTAX_ITEMS
ITCJ_SPLIT_POSTINGS = LIT_SPLIT_POSTINGS
ITCJ_CPD = LIT_CPD
CHANGING
P_BEG_BALANCE = LV_BEG_BALANCE
P_TOTAL_RECEIPTS = LV_TOTAL_RECEIPTS
P_TOTAL_PAYMENTS = LV_TOTAL_PAYMENTS
P_TOTAL_CHECKS = LV_TOTAL_CHECKS
P_RUN_BALANCE = LV_RUN_BALANCE
P_RUN_CASH_BALANCE = LV_RUN_CASH_BALANCE
P_NUMB_OF_REC = LV_NUMB_OF_REC
P_NUMB_OF_PAYM = LV_NUMB_OF_PAYM
P_NUMB_OF_CHECKS = LV_NUMB_OF_CHECKS.
COMMIT WORK.
ENDIF.
APPEND GWA_CJ_S TO GIT_CJ_S.
GV_SUCCESS_RECORDS = GV_SUCCESS_RECORDS + GC_1.
CLEAR GWA_CJ_S.
ENDIF.
ENDIF.
ELSE.
CLEAR GWA_CJ_E.
MOVE-CORRESPONDING GS_HEADER_BAPI TO GWA_CJ_E.
MOVE GWA_RETURN-MESSAGE TO GWA_CJ_E-MSG.
GWA_CJ_E-POSTING_NUMBER = LV_RECORD_NO.
APPEND GWA_CJ_E TO GIT_CJ_E.
GV_ERROR_RECORDS = GV_ERROR_RECORDS + GC_1.
ENDIF.
ENDIF.
ELSE.
GWA_RETURN-MESSAGE = 'Transaction Name does not correspond to any Transaction Number'(017).
CLEAR GWA_CJ_E.
MOVE-CORRESPONDING GS_HEADER_BAPI TO GWA_CJ_E.
MOVE GWA_RETURN-MESSAGE TO GWA_CJ_E-MSG.
GWA_CJ_E-POSTING_NUMBER = LV_RECORD_NO.
APPEND GWA_CJ_E TO GIT_CJ_E.
GV_ERROR_RECORDS = GV_ERROR_RECORDS + GC_1.
ENDIF.
ENDLOOP.
ENDFORM. " SUB_BAPI_CALLHi Experts,
I have a requirement where in cash journal posting needs to be carried out automatically by an inbound interface on a periodic basis and at the start during cut over an upload program needs to be used to upload beg balance data . For this purpose I have used BAPI_CASHJOURNALDOC_CREATE to save cash journal entries along with BAPI TRANSACTION COMMIT.
Once the Data is successfully saved I am using FM FCJ_GET_DATA_FOR_SCREEN to get prerequisite data for the FM FCJ_POST_ALL which is used by the Standard cash journal program internally to post the saved data. ( I got this by debugging the standard transaction and both FMs are not yet released )
The issues I am facing is that the the FM FCJ_POST_ALL does not always post the data it behaves in random fashion i.e some times it posts the entries where as sometimes it does not post the entries.
I have tried using commit work after the FM but that also does not result in consistent behavior of the program. One more issue is the i am not allowed to use commit work in a an inbound proxy so how do i proceed ?
I am attaching the code for further analysis:
DATA: LIT_TCJ_TRANS_NAMES TYPE TABLE OF TCJ_TRANS_NAMES,
LWA_TCJ_TRANS_NAMES TYPE TCJ_TRANS_NAMES,
LV_WAIT TYPE BAPITA-WAIT VALUE '1',
LV_RECORD_NO TYPE SY-TABIX.
DATA : LIT_POSTING TYPE STANDARD TABLE OF ISCJ_POSTINGS,
LIT_WTAX_ITEMS TYPE STANDARD TABLE OF TCJ_WTAX_ITEMS,
LIT_SPLIT_POSTINGS TYPE STANDARD TABLE OF ISCJ_POSTINGS,
LIT_CPD TYPE STANDARD TABLE OF TCJ_CPD.
DATA: LV_BEG_BALANCE TYPE CJAMOUNT,
LV_TOTAL_RECEIPTS TYPE CJAMOUNT,
LV_TOTAL_PAYMENTS TYPE CJAMOUNT,
LV_TOTAL_CHECKS TYPE CJAMOUNT,
LV_RUN_BALANCE TYPE CJAMOUNT,
LV_RUN_CASH_BALANCE TYPE CJAMOUNT,
LV_NUMB_OF_REC TYPE I,
LV_NUMB_OF_PAYM TYPE I,
LV_NUMB_OF_CHECKS TYPE I.
DESCRIBE TABLE GIT_CJ LINES GV_TOTAL_RECORDS.
SELECT MANDT COMP_CODE TRANSACT_NUMBER LANGU TRANSACT_NAME LONG_TEXT
FROM TCJ_TRANS_NAMES
INTO TABLE LIT_TCJ_TRANS_NAMES
WHERE LANGU = GC_EN.
IF SY-SUBRC <> 0.
MESSAGE 'No Business Transaction maintained for Company Code in this client'(016) TYPE GC_I.
LEAVE LIST-PROCESSING.
ENDIF.
DESCRIBE TABLE GIT_CJ LINES GV_TOTAL_RECORDS.
LOOP AT GIT_CJ INTO GWA_CJ.
LV_RECORD_NO = SY-TABIX.
CLEAR: GS_HEADER_BAPI,
GS_CJ_KEY,
GWA_ITEMS.
REFRESH: GIT_ITEMS,
GIT_RETURN.
GS_HEADER_BAPI-COMP_CODE = GWA_CJ-BUKRS.
GS_HEADER_BAPI-CAJO_NUMBER = GWA_CJ-CJNR.
GS_HEADER_BAPI-CURRENCY = GC_PHP.
CLEAR LWA_TCJ_TRANS_NAMES.
READ TABLE LIT_TCJ_TRANS_NAMES INTO LWA_TCJ_TRANS_NAMES WITH KEY COMP_CODE = GWA_CJ-BUKRS
LANGU = GC_EN
TRANSACT_NAME = GWA_CJ-BTNAM.
IF SY-SUBRC = 0.
GWA_ITEMS-TRANSACT_NUMBER = LWA_TCJ_TRANS_NAMES-TRANSACT_NUMBER.
GWA_ITEMS-P_RECEIPTS = GWA_CJ-CJRAT.
GWA_ITEMS-TAX_CODE = GWA_CJ-TXCOD.
GS_HEADER_BAPI-BP_NAME = GWA_CJ-BPNAM.
GWA_ITEMS-POSITION_TEXT = GWA_CJ-POTXT.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = GWA_CJ-LIFNR
IMPORTING
OUTPUT = GWA_ITEMS-VENDOR_NO.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = GWA_CJ-KUNNR
IMPORTING
OUTPUT = GWA_ITEMS-CUSTOMER.
PERFORM SUB_DATE_FROMAT_BAPI CHANGING GWA_CJ-BLDAT
GS_HEADER_BAPI-DOC_DATE.
PERFORM SUB_DATE_FROMAT_BAPI CHANGING GWA_CJ-BUDAT
GS_HEADER_BAPI-PSTNG_DATE.
GS_HEADER_BAPI-REF_DOC_NO = GWA_CJ-XBLNR.
GS_HEADER_BAPI-ALLOC_NMBR = GWA_CJ-ALLNO.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = GWA_CJ-KOSTL
IMPORTING
OUTPUT = GWA_ITEMS-COSTCENTER.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = GWA_CJ-PRCTR
IMPORTING
OUTPUT = GWA_ITEMS-PROFIT_CTR.
APPEND GWA_ITEMS TO GIT_ITEMS.
CALL FUNCTION 'BAPI_CASHJOURNALDOC_CREATE'
EXPORTING
HEADER = GS_HEADER_BAPI
IMPORTING
COMPANY_CODE = GS_CJ_KEY-COMP_CODE
CASH_JOURNAL_NUMBER = GS_CJ_KEY-CAJO_NUMBER
FISCAL_YEAR = GS_CJ_KEY-FISC_YEAR
CASH_JOURNAL_DOC_NO = GS_CJ_KEY-POSTING_NUMBER
TABLES
ITEMS = GIT_ITEMS
RETURN = GIT_RETURN.
IF GIT_RETURN IS NOT INITIAL.
READ TABLE GIT_RETURN INTO GWA_RETURN WITH KEY TYPE = GC_E.
IF SY-SUBRC <> 0.
CLEAR GWA_CJ_S.
MOVE-CORRESPONDING GS_CJ_KEY TO GWA_CJ_S.
CLEAR GWA_RETURN.
READ TABLE GIT_RETURN INTO GWA_RETURN WITH KEY TYPE = GC_S.
IF SY-SUBRC = 0.
MOVE GWA_RETURN-MESSAGE TO GWA_CJ_S-MSG.
CLEAR GWA_RETURN.
READ TABLE GIT_RETURN INTO GWA_RETURN WITH KEY TYPE = GC_I.
IF SY-SUBRC = 0.
CLEAR GWA_CJ_E.
CONCATENATE GWA_RETURN-MESSAGE GWA_CJ_S-MSG INTO GWA_CJ_E-MSG SEPARATED BY GC_PIPE_FORMAT.
MOVE-CORRESPONDING GS_HEADER_BAPI TO GWA_CJ_E.
GWA_CJ_E-POSTING_NUMBER = LV_RECORD_NO.
APPEND GWA_CJ_E TO GIT_CJ_E.
GV_ERROR_RECORDS = GV_ERROR_RECORDS + GC_1.
ELSE.
IF P_TEST NE GC_X.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
WAIT = LV_WAIT.
REFRESH:LIT_POSTING ,
LIT_WTAX_ITEMS ,
LIT_SPLIT_POSTINGS ,
LIT_CPD .
CLEAR: LV_BEG_BALANCE ,
LV_TOTAL_RECEIPTS ,
LV_TOTAL_PAYMENTS ,
LV_TOTAL_CHECKS ,
LV_RUN_BALANCE ,
LV_RUN_CASH_BALANCE ,
LV_NUMB_OF_REC ,
LV_NUMB_OF_PAYM ,
LV_NUMB_OF_CHECKS .
CALL FUNCTION 'FCJ_GET_DATA_FOR_SCREEN'
EXPORTING
I_COMP_CODE = GS_CJ_KEY-COMP_CODE
I_CAJO_NUMBER = GS_CJ_KEY-CAJO_NUMBER
I_DISPLAY_PERIOD_LO = GS_HEADER_BAPI-PSTNG_DATE
I_DISPLAY_PERIOD_HI = GS_HEADER_BAPI-PSTNG_DATE
IMPORTING
E_BEGINNING_BALANCE = LV_BEG_BALANCE
E_RUNNING_BALANCE = LV_RUN_BALANCE
E_RUNNING_CASH_BALANCE = LV_RUN_CASH_BALANCE
E_TOTAL_RECEIPTS = LV_TOTAL_RECEIPTS
E_TOTAL_REC_NUMBER = LV_NUMB_OF_REC
E_TOTAL_PAYMENTS = LV_TOTAL_PAYMENTS
E_TOTAL_PAYM_NUMBER = LV_NUMB_OF_PAYM
E_TOTAL_CHECKS = LV_TOTAL_CHECKS
E_TOTAL_CHECKS_NUMBER = LV_NUMB_OF_CHECKS
TABLES
E_POSTINGS = LIT_POSTING
E_WTAX_ITEMS = LIT_WTAX_ITEMS
E_SPLIT_POSTINGS = LIT_SPLIT_POSTINGS
E_CPD = LIT_CPD.
CALL FUNCTION 'FCJ_POST_ALL'
EXPORTING
I_COMP_CODE = GS_CJ_KEY-COMP_CODE
I_CAJO_NUMBER = GS_CJ_KEY-CAJO_NUMBER
I_CURRENCY = GS_HEADER_BAPI-CURRENCY
I_TYP = 'R'
I_DISPLAY_PERIOD_LO = GS_HEADER_BAPI-PSTNG_DATE
I_DISPLAY_PERIOD_HI = GS_HEADER_BAPI-PSTNG_DATE
* IMPORTING
* E_ERROR_NUMBER =
TABLES
ITCJ_POSTINGS = LIT_POSTING
ITCJ_WTAX_ITEMS = LIT_WTAX_ITEMS
ITCJ_SPLIT_POSTINGS = LIT_SPLIT_POSTINGS
ITCJ_CPD = LIT_CPD
CHANGING
P_BEG_BALANCE = LV_BEG_BALANCE
P_TOTAL_RECEIPTS = LV_TOTAL_RECEIPTS
P_TOTAL_PAYMENTS = LV_TOTAL_PAYMENTS
P_TOTAL_CHECKS = LV_TOTAL_CHECKS
P_RUN_BALANCE = LV_RUN_BALANCE
P_RUN_CASH_BALANCE = LV_RUN_CASH_BALANCE
P_NUMB_OF_REC = LV_NUMB_OF_REC
P_NUMB_OF_PAYM = LV_NUMB_OF_PAYM
P_NUMB_OF_CHECKS = LV_NUMB_OF_CHECKS.
COMMIT WORK.
ENDIF.
APPEND GWA_CJ_S TO GIT_CJ_S.
GV_SUCCESS_RECORDS = GV_SUCCESS_RECORDS + GC_1.
CLEAR GWA_CJ_S.
ENDIF.
ENDIF.
ELSE.
CLEAR GWA_CJ_E.
MOVE-CORRESPONDING GS_HEADER_BAPI TO GWA_CJ_E.
MOVE GWA_RETURN-MESSAGE TO GWA_CJ_E-MSG.
GWA_CJ_E-POSTING_NUMBER = LV_RECORD_NO.
APPEND GWA_CJ_E TO GIT_CJ_E.
GV_ERROR_RECORDS = GV_ERROR_RECORDS + GC_1.
ENDIF.
ENDIF.
ELSE.
GWA_RETURN-MESSAGE = 'Transaction Name does not correspond to any Transaction Number'(017).
CLEAR GWA_CJ_E.
MOVE-CORRESPONDING GS_HEADER_BAPI TO GWA_CJ_E.
MOVE GWA_RETURN-MESSAGE TO GWA_CJ_E-MSG.
GWA_CJ_E-POSTING_NUMBER = LV_RECORD_NO.
APPEND GWA_CJ_E TO GIT_CJ_E.
GV_ERROR_RECORDS = GV_ERROR_RECORDS + GC_1.
ENDIF.
ENDLOOP.
ENDFORM. " SUB_BAPI_CALL -
How to upload trial balance when recon accounts wont allow direct postings
hi,
i would like to upload trial balance figures but i am not able to upload the figures for recon accounts since it wont allow direct postings. how to overcome this problem? any idea?Hello Raja,
Under normal circumstances, uploading of GL balances is done as below
- take the closing trial balance
- create a control account in SAP
- Create a JV to transfer debits to respective GL accounts in SAP and credit the clearing account
-Create another JV for all credits.
- For customers/ vendors / asset balances use seperate method. Create first the reconciliation GL master record in SAP.
- Check the recon account entry in all the master record.
- now create invoices and the recon account is automatically updated.
- lastly make sure the clearing account balance is zero
reg
*assign points if useful -
Upload Plan data for GL account
We want to upload plan data for the GL accounts so that the plan data shows with the actual data in the financial statement.
The question is what is name of the program/tcode
1. To upload plan data for GL accounts?
2. To upload plan data in the cost center accounting?
3. Most important - to transfer plan data from cost center accounting to GL accounts? Currently we have a custom program to upload plan data to CCA.
Thank you very much in advance
PrafulYou can plan at GL level using T code GP12N, Planning profile SAPFIGL & summary table GLT0. You will have to define plan version & planning period in t code OBP6.
Once plan is entered the same will be available in FI reports e.g. F.01
For Cost center plan use t code KP06. Alternatively you can activate excel integration for planning profile and upload from excel.
Regards
Rakesh Pawaskar
Message was edited by:
Rakesh Pawaskar -
How to use split command in upload program
Thanks for all ...for their quick response for my previous query.
Iam continuing with the same upload program,now i have transfered the data from internal table to application server,now iam trying to upload this to database,while doing this iam using split command for spliting the records,but its not at all spliting,can u give me a solution for this.OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
if sy-subrc <> 0.
PERFORM messaging USING 'E' '001' text-e10 p_file space space.
else.
DO.
READ DATASET P_file INTO WA .
IF SY-SUBRC <> 0.
EXIT.
ENDIF.
REPLACE ALL OCCURRENCES OF '"' IN WA WITH ''.
CONDENSE WA NO-GAPS.
SPLIT WA AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB
INTO wa_infile.
append wa_infile to it_infile.
clear wa_infile.
ENDDO.
endif.
try this...
vijay -
HCP tcode PA40 Upload program failing to move to next record.
Dear All
I have written and upload program for HCM tcode PA40 and the program is fine but only inserting one record and is failing to pick the next records in a loop. I dont know whats the problem i know the process have many screens, please help me, i have tried to research not yet found the answer yet.
Thank you for your assistance
Here is my Upload program
*& Report ZUPLOADEMPHIRING
REPORT ZUPLOADEMPHIRING.
include bdcrecx1.
PARAMETERS: p_file TYPE rlgrap-filename.
x_endrow TYPE i .
DATA: xdate(10).
DATA: Fullname type string.
DATA: x_begrow TYPE i VALUE 2,
x_begcol TYPE i VALUE 1,
x_endcol TYPE i VALUE 17,
x_endrow TYPE i VALUE 3.
TYPES: BEGIN OF t_datatab ,
FromDate(10),
Reasonforaction(2),
Position(8),
PersonalArea(4),
EmployeeGroup(1),
EmployeeSubGroup(2),
SubArea(4),
PayrolArea(2),
Title(5),
Lastname(40),
Firstname(40),
BirtDate(10),
Nationality(3),
Group(1),
Level(1),
BankKey(15),
BankAccount(18),
END OF t_datatab.
DATA: BEGIN OF t_datatabfinal OCCURS 0,
FromDate(10),
Reasonforaction(2),
Position(8),
PersonalArea(4),
EmployeeGroup(1),
EmployeeSubGroup(2),
SubArea(4),
PayrolArea(2),
Title(5),
Lastname(40),
Firstname(40),
BirtDate(10),
Nationality(3),
Group(1),
Level(1),
BankKey(15),
BankAccount(18),
END OF t_datatabfinal.
DATA: BEGIN OF it_record OCCURS 0,
FromDate(10),
Reasonforaction(2),
Position(8),
PersonalArea(4),
EmployeeGroup(1),
EmployeeSubGroup(2),
SubArea(4),
PayrolArea(2),
Title(5),
Lastname(40),
Firstname(40),
BirtDate(10),
Nationality(3),
Group(1),
Level(1),
BankKey(15),
BankAccount(18),
END OF it_record.
DATA: itab LIKE alsmex_tabline OCCURS 0 WITH HEADER LINE,
gd_currentrow TYPE i,
it_datatab TYPE STANDARD TABLE OF t_datatab,
wa_datatab TYPE t_datatab.
AT SELECTION-SCREEN on VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME' "
EXPORTING
FIELD_NAME = 'P_FILE '
IMPORTING
FILE_NAME = p_file.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
PROGRAM_NAME = SYST-REPID
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = ' '
STATIC = ' '
MASK = ' '
CHANGING
FILE_NAME =
EXCEPTIONS
MASK_TOO_LONG = 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.
START-OF-SELECTION.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = x_begcol
i_begin_row = x_begrow "Column header not required
i_end_col = x_endcol
i_end_row = x_endrow
TABLES
intern = itab.
Sort table by rows and colums
SORT itab BY row col.
Get first row retrieved
READ TABLE itab INDEX 1.
Set first row retrieved to current row
gd_currentrow = itab-row.
clear: t_datatabfinal.
refresh t_datatabfinal.
LOOP AT itab.
Reset values for next row
IF itab-row NE gd_currentrow.
APPEND wa_datatab TO t_datatabfinal.
CLEAR wa_datatab.
gd_currentrow = itab-row.
ENDIF.
concatenate sy-datum6(2)'.' sy-datum4(2)'.' sy-datum+2(4) into xdate .
CASE itab-col.
WHEN '0001'.
wa_datatab-FromDate = itab-value.
concatenate wa_datatab-DocumentDate6(2)'.' wa_datatab-DocumentDate4(2)'.' wa_datatab-DocumentDate+2(4) into wa_datatab-DocumentDate.
WHEN '0002'.
wa_datatab-Reasonforaction = itab-value.
WHEN '0003'.
wa_datatab-Position = itab-value.
WHEN '0004'.
wa_datatab-PersonalArea = itab-value.
WHEN '0005'.
wa_datatab-EmployeeGroup = itab-value.
WHEN '0006'.
wa_datatab-EmployeeSubGroup = itab-value.
WHEN '0007'.
wa_datatab-SubArea = itab-value.
WHEN '0008'.
wa_datatab-PayrolArea = itab-value.
WHEN '0009'.
wa_datatab-Title = itab-value.
WHEN '0010'.
wa_datatab-Lastname = itab-value.
WHEN '0011'.
wa_datatab-Firstname = itab-value.
WHEN '0012'.
wa_datatab-BirtDate = itab-value.
WHEN '0013'.
wa_datatab-Nationality = itab-value.
WHEN '0014'.
wa_datatab-Group = itab-value.
WHEN '0015'.
wa_datatab-Level = itab-value.
WHEN '0016'.
wa_datatab-BankKey = itab-value.
WHEN '0017'.
wa_datatab-BankAccount = itab-value.
WHEN OTHERS.
ENDCASE.
APPEND wa_datatab to t_datatabfinal.
ENDLOOP.
clear: it_record.
refresh it_record.
loop at t_datatabfinal into it_record.
append it_record.
endloop.
perform open_group.
loop at it_record.
concatenate it_record-Firstname it_record-Lastname into Fullname separated by space.
perform bdc_dynpro using 'SAPMP50A' '2000'.
perform bdc_field using 'BDC_CURSOR'
'T529T-MNTXT(02)'.
perform bdc_field using 'BDC_OKCODE'
'=PICK'.
perform bdc_field using 'RP50G-EINDA'
it_record-FromDate. "" '01012012'.
perform bdc_field using 'RP50G-SELEC(02)'
'X'.
perform bdc_dynpro using 'MP000000' '2000'.
perform bdc_field using 'BDC_CURSOR'
'PSPAR-PERSG'.
perform bdc_field using 'BDC_OKCODE'
'=UPD'.
perform bdc_field using 'P0000-BEGDA'
it_record-FromDate. "" '01.01.2012'.
perform bdc_field using 'P0000-ENDDA'
'31.12.9999'.
perform bdc_field using 'P0000-MASSN'
'ZB'.
perform bdc_field using 'P0000-MASSG'
it_record-Reasonforaction. "" '01'.
perform bdc_field using 'PSPAR-PLANS'
it_record-Position. "" '99999999'.
perform bdc_field using 'PSPAR-WERKS'
it_record-PersonalArea. " 'm003'.
perform bdc_field using 'PSPAR-PERSG'
it_record-EmployeeGroup. "" 'a'.
perform bdc_field using 'PSPAR-PERSK'
it_record-EmployeeSubGroup. "" '02'.
perform bdc_dynpro using 'MP000100' '2000'.
perform bdc_field using 'BDC_CURSOR'
'P0001-BTRTL'.
perform bdc_field using 'BDC_OKCODE'
'=UPD'.
perform bdc_field using 'P0001-BEGDA'
it_record-FromDate. ""'01.01.2012'.
perform bdc_field using 'P0001-ENDDA'
'31.12.9999'.
perform bdc_field using 'P0001-BTRTL'
it_record-SubArea. "" 'mm01'.
perform bdc_field using 'P0001-ABKRS'
it_record-PayrolArea. "" 'Z2'.
perform bdc_field using 'P0001-PLANS'
it_record-Position. ""'99999999'.
perform bdc_dynpro using 'MP000200' '2000'.
perform bdc_field using 'BDC_CURSOR'
'P0002-NATIO'.
perform bdc_field using 'BDC_OKCODE'
'=UPD'.
perform bdc_field using 'P0002-BEGDA'
it_record-FromDate. ""'01.01.2012'.
perform bdc_field using 'P0002-ENDDA'
'31.12.9999'.
perform bdc_field using 'Q0002-ANREX'
it_record-Title. "" 'Mr'.
perform bdc_field using 'P0002-NACHN'
it_record-Lastname. " 'maxwel'.
perform bdc_field using 'P0002-VORNA'
it_record-Firstname. "" 'razaro'.
perform bdc_field using 'P0002-GBDAT'
it_record-BirtDate. "" '01011970'.
perform bdc_field using 'P0002-SPRSL'
'EN'.
perform bdc_field using 'P0002-NATIO'
it_record-Nationality. "" 'ZW'.
perform bdc_dynpro using 'MP000700' '2000'.
perform bdc_field using 'BDC_CURSOR'
'P0007-BEGDA'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'P0007-BEGDA'
it_record-FromDate."" '01.01.2012'.
perform bdc_field using 'P0007-ENDDA'
'31.12.9999'.
perform bdc_field using 'P0007-SCHKZ'
'MANORM'.
perform bdc_field using 'P0007-ZTERF'
'9'.
perform bdc_field using 'P0007-EMPCT'
' 100,00'.
perform bdc_dynpro using 'MP000700' '2000'.
perform bdc_field using 'BDC_CURSOR'
'P0007-BEGDA'.
perform bdc_field using 'BDC_OKCODE'
'=UPD'.
perform bdc_field using 'P0007-BEGDA'
it_record-FromDate.""'01.01.2012'.
perform bdc_field using 'P0007-ENDDA'
'31.12.9999'.
perform bdc_field using 'P0007-SCHKZ'
'MANORM'.
perform bdc_field using 'P0007-ZTERF'
'9'.
perform bdc_field using 'P0007-EMPCT'
' 100,00'.
perform bdc_field using 'P0007-ARBST'
' 8,00'.
perform bdc_field using 'P0007-WKWDY'
' 5,00'.
perform bdc_dynpro using 'MP000800' '2000'.
perform bdc_field using 'BDC_CURSOR'
'P0008-TRFST'.
perform bdc_field using 'BDC_OKCODE'
'=UPD'.
perform bdc_field using 'P0008-BEGDA'
it_record-FromDate. "" '01.01.2012'.
perform bdc_field using 'P0008-ENDDA'
'31.12.9999'.
perform bdc_field using 'P0008-TRFAR'
'01'.
perform bdc_field using 'P0008-BSGRD'
'100,00'.
perform bdc_field using 'P0008-TRFGB'
'01'.
perform bdc_field using 'P0008-TRFGR'
it_record-Group. ""'a'.
perform bdc_field using 'P0008-TRFST'
it_record-Level. "" '1'.
perform bdc_field using 'P0008-DIVGV'
'173,00'.
perform bdc_field using 'P0008-ANCUR'
'USD'.
perform bdc_field using 'Q0008-IBBEG'
xdate.""'12.01.2012'.
perform bdc_field using 'P0008-WAERS'
'USD'.
perform bdc_dynpro using 'MP000900' '2000'.
perform bdc_field using 'BDC_CURSOR'
'P0009-ZLSCH'.
perform bdc_field using 'BDC_OKCODE'
'=UPD'.
perform bdc_field using 'P0009-BEGDA'
it_record-FromDate. ""'01.01.2012'.
perform bdc_field using 'P0009-ENDDA'
'31.12.9999'.
perform bdc_field using 'P0009-BNKSA'
'0'.
perform bdc_field using 'Q0009-EMFTX'
Fullname. "" 'maxwel razaro'.
perform bdc_field using 'P0009-BANKS'
'ZW'.
perform bdc_field using 'P0009-BANKL'
it_record-BankKey. ""'10351'.
perform bdc_field using 'P0009-BANKN'
it_record-BankAccount. "" '543234667778'.
perform bdc_field using 'P0009-ZLSCH'
'b'.
perform bdc_field using 'P0009-WAERS'
'USD'.
perform bdc_dynpro using 'SAPMP50A' '2000'.
perform bdc_field using 'BDC_OKCODE'
'/EBCK'.
perform bdc_field using 'BDC_CURSOR'
'RP50G-PERNR'.
perform bdc_transaction using 'PA40'.
endloop.
perform close_group.
Regards
WilliamHi,
It seems like you are uploading data to a screen that contains table control.just check the link below for your reference
[http://wiki.sdn.sap.com/wiki/display/ABAP/bdcontable+control]
Regards,
Vamshi
Edited by: vamshi reddy . ch on Jan 13, 2012 7:38 AM
Edited by: vamshi reddy . ch on Jan 13, 2012 7:39 AM -
Hi experts,
1.I am working on prospect BP uploading program in that I am facing issue like relationship and contact person fields are not populating.
2.In lead uploading program please guide me to maintain sales area data(sales organization,dis channel,division,sales office,sales group ).
Actually I am using BOL programming for uploading programs. Please guide me .
Regards,
shivaprasad.DHi Shivaprasad,
Please find below my comments.
1) For lead start date and end date, please check the filed's and data elements you are passing are same. And also fill input fields. Put a breakpoint in FM crm_order_maintain and fill the dates in webui and check what are the values passing in debugging.
Please find sample code below.
gs_appointment2-ref_handle = '0000000001'.
gs_appointment2-ref_guid = lv_guid.
gs_appointment2-ref_kind = 'A'.
gs_appointment2-appt_type = 'ORDERACTUAL'.
gs_appointment2-timestamp_from = lv_timestamp_from.
gs_appointment2-timestamp_to = lv_timestamp_to.
INSERT gs_appointment2 INTO TABLE gt_appointment2.
*** Input fields for Dates
gs_input_fields-ref_handle = '0000000001'.
gs_input_fields-ref_guid = lv_guid.
gs_input_fields-ref_kind = 'A'.
gs_input_fields-objectname = 'APPOINTMENT'.
gs_input_fields-logical_key = 'ORDERACTUAL'.
gs_field_line-fieldname = 'APPT_TYPE'.
APPEND gs_field_line TO gs_input_fields-field_names.
gs_field_line-fieldname = 'DOMINANT'.
APPEND gs_field_line TO gs_input_fields-field_names.
gs_field_line-fieldname = 'SHOW_LOCAL'.
APPEND gs_field_line TO gs_input_fields-field_names.
gs_field_line-fieldname = 'TIMESTAMP_FROM'.
APPEND gs_field_line TO gs_input_fields-field_names.
gs_field_line-fieldname = 'TIMESTAMP_TO'.
APPEND gs_field_line TO gs_input_fields-field_names.
gs_field_line-fieldname = 'TIMEZONE_FROM'.
APPEND gs_field_line TO gs_input_fields-field_names.
gs_field_line-fieldname = 'TIMEZONE_TO'.
APPEND gs_field_line TO gs_input_fields-field_names.
INSERT gs_input_fields INTO TABLE gt_input_fields.
CLEAR gs_input_fields.
2) For maintaining Org Data, if you are expecting the field values like O 00100244 use SALES_ORG_RESP. For field values with name of Sales Org use SALES_ORG_RESP_SHORT. Please check in debugging by putting break point in FM crm_order_maintain for fields and values.
Please find sample code below.
***** Fill Org Data
CLEAR gt_orgman2.
gs_orgman2-ref_handle = '0000000001'.
gs_orgman2-ref_guid = lv_guid.
gs_orgman2-ref_kind = 'A'. "For create, B for update
gs_orgman2-division = <fs_excel_data>-division.
gs_orgman2-sales_org_short = <fs_excel_data>-sales_organization.
gs_orgman2-dis_channel = <fs_excel_data>-distribution_channel.
gs_orgman2-sales_org_resp_short = <fs_excel_data>-sales_org_unit.
gs_orgman2-service_org_resp_short = <fs_excel_data>-service_org_unit.
gs_orgman2-service_org_short = <fs_excel_data>-service_organisation.
APPEND gs_orgman2 TO gt_orgman2.
CLEAR gs_orgman2.
*** Input fields for Org Data
gs_input_fields-ref_handle = '0000000001'.
gs_input_fields-ref_guid = lv_guid.
gs_input_fields-ref_kind = 'A'. "For create, B for update
gs_input_fields-objectname = 'ORGMAN'.
gs_field_line-fieldname = 'DIS_CHANNEL'.
INSERT gs_field_line INTO TABLE gs_input_fields-field_names.
gs_field_line-fieldname = 'DIS_CHANNEL_ORI'.
INSERT gs_field_line INTO TABLE gs_input_fields-field_names.
gs_field_line-fieldname = 'DIVISION'.
INSERT gs_field_line INTO TABLE gs_input_fields-field_names.
gs_field_line-fieldname = 'DIVISION_ORI'.
INSERT gs_field_line INTO TABLE gs_input_fields-field_names.
gs_field_line-fieldname = 'SALES_ORG'.
INSERT gs_field_line INTO TABLE gs_input_fields-field_names.
gs_field_line-fieldname = 'SALES_ORG_ORI'.
INSERT gs_field_line INTO TABLE gs_input_fields-field_names.
gs_field_line-fieldname = 'SALES_ORG_RESP'.
INSERT gs_field_line INTO TABLE gs_input_fields-field_names.
gs_field_line-fieldname = 'SALES_ORG_RESP_SHORT'.
INSERT gs_field_line INTO TABLE gs_input_fields-field_names.
gs_field_line-fieldname = 'SALES_ORG_SHORT'.
INSERT gs_field_line INTO TABLE gs_input_fields-field_names.
gs_field_line-fieldname = 'SERVICE_ORG'.
INSERT gs_field_line INTO TABLE gs_input_fields-field_names.
gs_field_line-fieldname = 'SERVICE_ORGR_ORI'.
INSERT gs_field_line INTO TABLE gs_input_fields-field_names.
gs_field_line-fieldname = 'SERVICE_ORG_RESP'.
INSERT gs_field_line INTO TABLE gs_input_fields-field_names.
gs_field_line-fieldname = 'SERVICE_ORG_RESP_SHORT'.
INSERT gs_field_line INTO TABLE gs_input_fields-field_names.
gs_field_line-fieldname = 'SERVICE_ORG_SHORT'.
INSERT gs_field_line INTO TABLE gs_input_fields-field_names.
INSERT gs_input_fields INTO TABLE gt_input_fields.
CLEAR gs_input_fields.
Thanks,
Varma -
How to Upload Program Source Code
Hello,
i have a program which downloads the source code into text files.
I need to create all these into another server.
so i need a program to upload these programs.
Any idea how to it? Thanks in advance.
Thanks&Regards,
Sayanna DamerlaTry this custom code:
Upload and Download ABAP Source Code
Source Code Listing
Report: ZKBPROGS *
Function : Up/Download ABAP reports complete with texts *
- this program does not update TRDIR with the *
TRDIR entries that are in the program uploaded. Instead, *
current users stats are used. *
- this program allows selection of reports from a list or *
a single report can be tuped in and uploaded *
- this program also updates TADIR so that a development class*
is assigned to the program *
- this program checks to see if the program already has a *
TRDIR entry, and if it does, warns the user *
- this program will save/restore the program documenation too*
REPORT ZKBPROGS
NO STANDARD PAGE HEADING
LINE-SIZE 255.
Declare Database Objects *
tables:
DOKIL,
TRDIR.
Constants*
CONSTANTS:
MC_TRDIR_IDENTIFIER(72) TYPE C VALUE '%&%& RDIR',
MC_REPORT_IDENTIFIER(72) TYPE C VALUE '%&%& REPO',
MC_TEXT_IDENTIFIER(72) TYPE C VALUE '%&%& TEXP',
MC_THEAD_IDENTIFIER(72) TYPE C VALUE '%&%& HEAD',
MC_DOC_IDENTIFIER(72) TYPE C VALUE '%&%& DOKL',
MC_TRDIR_SHORT(4) TYPE C VALUE 'RDIR',
MC_REPORT_SHORT(4) TYPE C VALUE 'REPO',
MC_TEXT_SHORT(4) TYPE C VALUE 'TEXP',
MC_THEAD_SHORT(4) TYPE C VALUE 'HEAD',
MC_DOC_SHORT(4) TYPE C VALUE 'DOKP'.
Declare Module level data structures *
DATA: BEGIN OF MTAB_PROGRAM_SOURCE OCCURS 0,
LINE(72) TYPE C,
END OF MTAB_PROGRAM_SOURCE.
DATA: MTAB_PROGRAM_TRDIR LIKE TRDIR OCCURS 0 WITH HEADER LINE.
DATA: MTAB_PROGRAM_TEXTS LIKE TEXTPOOL OCCURS 0 WITH HEADER LINE.
DATA: MSTR_THEAD LIKE THEAD.
DATA: BEGIN OF MTAB_PROGRAM_FILE OCCURS 0,
LINE(275) TYPE C,
END OF MTAB_PROGRAM_FILE.
DATA: BEGIN OF MTAB_DIRECTORY OCCURS 0,
NAME LIKE TRDIR-NAME,
DESC(72) TYPE C,
SAVENAME LIKE RLGRAP-FILENAME,
END OF MTAB_DIRECTORY.
DATA: BEGIN OF MTAB_PROGRAM_DOCUMENTATION OCCURS 0,
LINE(255) TYPE C,
END OF MTAB_PROGRAM_DOCUMENTATION.
Selection Screen *
*-- Options for upload/download of programs
SELECTION-SCREEN BEGIN OF BLOCK FRM_OPTIONS WITH FRAME TITLE TEXT-UDL.
PARAMETERS:
RB_DOWN RADIOBUTTON GROUP UDL DEFAULT 'X'. " Download reports
SELECTION-SCREEN BEGIN OF BLOCK FRM_TRDIR WITH FRAME TITLE TEXT-DIR.
SELECT-OPTIONS:
S_NAME FOR TRDIR-NAME, " Program Name
S_SUBC FOR TRDIR-SUBC " Program Type
DEFAULT 'F' OPTION EQ SIGN E," Exclude Functions by default
S_CNAM FOR TRDIR-CNAM " Created by
DEFAULT SY-UNAME,
S_UNAM FOR TRDIR-UNAM, " Last Changed by
S_CDAT FOR TRDIR-CDAT, " Creation date
S_UDAT FOR TRDIR-UDAT. " Last update date
SELECTION-SCREEN END OF BLOCK FRM_TRDIR.
*-- Options for uploading programs
PARAMETERS:
RB_UP RADIOBUTTON GROUP UDL. " Upload reports
SELECTION-SCREEN BEGIN OF BLOCK FRM_UPLOAD WITH FRAME TITLE TEXT-UPL.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(29) TEXT-SNG.
PARAMETERS:
RB_FILE RADIOBUTTON GROUP HOW DEFAULT 'X'.
SELECTION-SCREEN COMMENT 33(42) TEXT-FNA.
SELECTION-SCREEN END OF LINE.
PARAMETERS:
RB_LIST RADIOBUTTON GROUP HOW.
SELECTION-SCREEN END OF BLOCK FRM_UPLOAD.
SELECTION-SCREEN END OF BLOCK FRM_OPTIONS.
*-- Options for up/downloading programs
SELECTION-SCREEN BEGIN OF BLOCK FRM_FILEN WITH FRAME TITLE TEXT-FIL.
PARAMETERS:
RB_DOS RADIOBUTTON GROUP FIL DEFAULT 'X', " Save to local
RB_UNIX RADIOBUTTON GROUP FIL, " Save to UNIX
P_PATH LIKE RLGRAP-FILENAME " Path to save files to
DEFAULT 'c:\temp\'.
SELECTION-SCREEN END OF BLOCK FRM_FILEN.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_NAME-LOW.
CALL FUNCTION 'F4_PROGRAM'
EXPORTING
OBJECT = S_NAME-LOW
SUPPRESS_SELECTION = 'X'
IMPORTING
RESULT = S_NAME-LOW
EXCEPTIONS
OTHERS = 1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_NAME-HIGH.
CALL FUNCTION 'F4_PROGRAM'
EXPORTING
OBJECT = S_NAME-HIGH
SUPPRESS_SELECTION = 'X'
IMPORTING
RESULT = S_NAME-HIGH
EXCEPTIONS
OTHERS = 1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_UNAM-LOW.
PERFORM GET_NAME USING 'S_UNAM-LOW'
CHANGING S_UNAM-LOW.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_UNAM-HIGH.
PERFORM GET_NAME USING 'S_UNAM-HIGH'
CHANGING S_UNAM-HIGH.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_CNAM-LOW.
PERFORM GET_NAME USING 'S_CNAM-LOW'
CHANGING S_CNAM-LOW.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_CNAM-HIGH.
PERFORM GET_NAME USING 'S_CNAM-HIGH'
CHANGING S_CNAM-HIGH.
TOP-OF-PAGE.
IF RB_LIST = 'X'.
FORMAT COLOR COL_HEADING.
NEW-LINE.
WRITE: AT 3 TEXT-H01,
AT 15 TEXT-H03.
FORMAT COLOR OFF.
ENDIF.
AT LINE-SELECTION.
CHECK RB_LIST = 'X'. " only do in list mode
READ LINE SY-CUROW FIELD VALUE MTAB_DIRECTORY-SAVENAME.
*-- Read file into an internal table
PERFORM READ_REPORT_FROM_DISK TABLES MTAB_PROGRAM_FILE
USING MTAB_DIRECTORY-SAVENAME.
*-- Split table into TADIR entry, report lines, and report text
PERFORM SPLIT_INCOMING_FILE TABLES MTAB_PROGRAM_FILE
MTAB_PROGRAM_SOURCE
MTAB_PROGRAM_TEXTS
MTAB_PROGRAM_DOCUMENTATION
CHANGING TRDIR
MSTR_THEAD.
*-- Save all of the data
PERFORM INSERT_NEW_REPORT TABLES MTAB_PROGRAM_SOURCE
MTAB_PROGRAM_TEXTS
MTAB_PROGRAM_DOCUMENTATION
USING TRDIR
MSTR_THEAD.
Start of processing *
START-OF-SELECTION.
FORMAT COLOR COL_NORMAL.
IF RB_DOWN = 'X'.
PERFORM DOWNLOAD_REPORTS.
ELSEIF RB_UP = 'X'.
PERFORM UPLOAD_REPORTS.
ENDIF.
END-OF-SELECTION.
IF RB_DOWN = 'X'.
CONCATENATE P_PATH
'directory.txt'
INTO P_PATH.
PERFORM SAVE_TABLE_TO_FILE TABLES MTAB_DIRECTORY
USING P_PATH.
ENDIF.
FORM UPLOAD_REPORTS *
FORM UPLOAD_REPORTS.
*-- Can upload a reports entered in selection criteria or
*-- select from a list. List can be from index.txt in same directory
*-- (created by the download) or by reading the first line of each file
*-- in the directory.
IF RB_FILE = 'X'. " Upload single program from a file
*-- Read file into an internal table
PERFORM READ_REPORT_FROM_DISK TABLES MTAB_PROGRAM_FILE
USING P_PATH.
*-- Split table into TADIR entry, report lines, and report text
PERFORM SPLIT_INCOMING_FILE TABLES MTAB_PROGRAM_FILE
MTAB_PROGRAM_SOURCE
MTAB_PROGRAM_TEXTS
MTAB_PROGRAM_DOCUMENTATION
CHANGING TRDIR
MSTR_THEAD.
*-- Save all of the data
PERFORM INSERT_NEW_REPORT TABLES MTAB_PROGRAM_SOURCE
MTAB_PROGRAM_TEXTS
MTAB_PROGRAM_DOCUMENTATION
USING TRDIR
MSTR_THEAD.
ELSEIF RB_LIST = 'X'. " Show list for user to choose from
*-- get list of report names/descriptions from directory text
CONCATENATE P_PATH
'directory.txt'
INTO P_PATH.
PERFORM READ_REPORT_FROM_DISK TABLES MTAB_DIRECTORY
USING P_PATH.
SORT MTAB_DIRECTORY.
*-- Write out list of report names/descriptions
LOOP AT MTAB_DIRECTORY.
WRITE:
/ MTAB_DIRECTORY-NAME UNDER TEXT-H01,
MTAB_DIRECTORY-DESC UNDER TEXT-H03,
MTAB_DIRECTORY-SAVENAME.
ENDLOOP.
*-- Process user selections for reports to upload.
ENDIF.
ENDFORM. " upload_reports
FORM DOWNLOAD_REPORTS *
From the user selections, get all programs that meet the *
criteria, and save them in ftab_program_directory. *
Also save the report to disk. *
FORM DOWNLOAD_REPORTS.
DATA:
LC_FULL_FILENAME LIKE RLGRAP-FILENAME.
*-- The table is put into an internal table because the program will
*-- abend if multiple transfers to a dataset occur within a SELECT/
*-- ENDSELCT (tested on 3.1H)
SELECT * FROM TRDIR
INTO TABLE MTAB_PROGRAM_TRDIR
WHERE NAME IN S_NAME
AND SUBC IN S_SUBC
AND CNAM IN S_CNAM
AND UNAM IN S_UNAM
AND CDAT IN S_CDAT
AND UDAT IN S_UDAT.
LOOP AT MTAB_PROGRAM_TRDIR.
*-- Clear out text and source code tables
CLEAR:
MTAB_PROGRAM_FILE,
MTAB_PROGRAM_SOURCE,
MTAB_PROGRAM_TEXTS,
MTAB_PROGRAM_DOCUMENTATION.
REFRESH:
MTAB_PROGRAM_FILE,
MTAB_PROGRAM_SOURCE,
MTAB_PROGRAM_TEXTS,
MTAB_PROGRAM_DOCUMENTATION.
*-- Get the report
READ REPORT MTAB_PROGRAM_TRDIR-NAME INTO MTAB_PROGRAM_SOURCE.
*-- Get the text for the report
READ TEXTPOOL MTAB_PROGRAM_TRDIR-NAME INTO MTAB_PROGRAM_TEXTS.
*-- Get the documentation for the report
CLEAR DOKIL.
SELECT * UP TO 1 ROWS FROM DOKIL
WHERE ID = 'RE'
AND OBJECT = MTAB_PROGRAM_TRDIR-NAME
AND LANGU = SY-LANGU
AND TYP = 'E'
ORDER BY VERSION DESCENDING.
ENDSELECT.
*-- Documentation exists for this object
IF SY-SUBRC = 0.
CALL FUNCTION 'DOCU_READ'
EXPORTING
ID = DOKIL-ID
LANGU = DOKIL-LANGU
OBJECT = DOKIL-OBJECT
TYP = DOKIL-TYP
VERSION = DOKIL-VERSION
IMPORTING
HEAD = MSTR_THEAD
TABLES
LINE = MTAB_PROGRAM_DOCUMENTATION
EXCEPTIONS
OTHERS = 1.
ENDIF.
*-- Put the report code and texts into a single file
*-- Put the identifier line in so that the start of the TRDIR line
*-- is marked
CONCATENATE MC_TRDIR_IDENTIFIER
MTAB_PROGRAM_TRDIR-NAME
INTO MTAB_PROGRAM_FILE-LINE.
APPEND MTAB_PROGRAM_FILE.
*-- Add the TRDIR line
MTAB_PROGRAM_FILE-LINE = MTAB_PROGRAM_TRDIR.
APPEND MTAB_PROGRAM_FILE.
*-- Put the identifier line in so that the start of the report code
*-- is marked
CONCATENATE MC_REPORT_IDENTIFIER
MTAB_PROGRAM_TRDIR-NAME
INTO MTAB_PROGRAM_FILE-LINE.
APPEND MTAB_PROGRAM_FILE.
*-- Add the report code
LOOP AT MTAB_PROGRAM_SOURCE.
MTAB_PROGRAM_FILE = MTAB_PROGRAM_SOURCE.
APPEND MTAB_PROGRAM_FILE.
ENDLOOP.
*-- Put the identifier line in so that the start of the report text
*-- is marked
CONCATENATE MC_TEXT_IDENTIFIER
MTAB_PROGRAM_TRDIR-NAME
INTO MTAB_PROGRAM_FILE-LINE.
APPEND MTAB_PROGRAM_FILE.
*-- Add the report texts
LOOP AT MTAB_PROGRAM_TEXTS.
MTAB_PROGRAM_FILE = MTAB_PROGRAM_TEXTS.
APPEND MTAB_PROGRAM_FILE.
ENDLOOP.
*-- Put the identifier line in so that the start of the THEAD record
*-- is marked
CONCATENATE MC_THEAD_IDENTIFIER
MTAB_PROGRAM_TRDIR-NAME
INTO MTAB_PROGRAM_FILE-LINE.
APPEND MTAB_PROGRAM_FILE.
MTAB_PROGRAM_FILE = MSTR_THEAD.
APPEND MTAB_PROGRAM_FILE.
*-- Put the identifier line in so that the start of the report
*-- documentation is marked
CONCATENATE MC_DOC_IDENTIFIER
MTAB_PROGRAM_TRDIR-NAME
INTO MTAB_PROGRAM_FILE-LINE.
APPEND MTAB_PROGRAM_FILE.
*-- Add the report documentation
LOOP AT MTAB_PROGRAM_DOCUMENTATION.
MTAB_PROGRAM_FILE = MTAB_PROGRAM_DOCUMENTATION.
APPEND MTAB_PROGRAM_FILE.
ENDLOOP.
*-- Make the fully pathed filename that report will be saved to
CONCATENATE P_PATH
MTAB_PROGRAM_TRDIR-NAME
'.txt'
INTO LC_FULL_FILENAME.
PERFORM SAVE_TABLE_TO_FILE TABLES MTAB_PROGRAM_FILE
USING LC_FULL_FILENAME.
*-- Write out message with Program Name/Description
READ TABLE MTAB_PROGRAM_TEXTS WITH KEY ID = 'R'.
IF SY-SUBRC = 0.
MTAB_DIRECTORY-NAME = MTAB_PROGRAM_TRDIR-NAME.
MTAB_DIRECTORY-DESC = MTAB_PROGRAM_TEXTS-ENTRY.
MTAB_DIRECTORY-SAVENAME = LC_FULL_FILENAME.
APPEND MTAB_DIRECTORY.
WRITE: / MTAB_PROGRAM_TRDIR-NAME,
MTAB_PROGRAM_TEXTS-ENTRY(65) COLOR COL_HEADING.
ELSE.
MTAB_DIRECTORY-NAME = MTAB_PROGRAM_TRDIR-NAME.
MTAB_DIRECTORY-DESC = 'No description available'.
MTAB_DIRECTORY-SAVENAME = LC_FULL_FILENAME.
APPEND MTAB_DIRECTORY.
WRITE: / MTAB_PROGRAM_TRDIR-NAME.
ENDIF.
ENDLOOP.
ENDFORM. " BUILD_PROGRAM_DIRECTORY
FORM SAVE_TABLE_TO_FILE *
--> FTAB_TABLE *
--> F_FILENAME *
FORM SAVE_TABLE_TO_FILE TABLES FTAB_TABLE
USING F_FILENAME.
IF RB_DOS = 'X'. " Save file to presentation server
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
FILENAME = F_FILENAME
FILETYPE = 'ASC'
TABLES
DATA_TAB = FTAB_TABLE
EXCEPTIONS
OTHERS = 4.
IF SY-SUBRC NE 0.
WRITE: / 'Error opening dataset' COLOR COL_NEGATIVE,
F_FILENAME COLOR COL_NEGATIVE.
ENDIF.
ELSE. " Save file to application server
OPEN DATASET F_FILENAME FOR OUTPUT IN TEXT MODE.
IF SY-SUBRC = 0.
LOOP AT FTAB_TABLE.
TRANSFER FTAB_TABLE TO F_FILENAME.
IF SY-SUBRC NE 0.
WRITE: / 'Error writing record to file;' COLOR COL_NEGATIVE,
F_FILENAME COLOR COL_NEGATIVE.
ENDIF.
ENDLOOP.
ELSE.
WRITE: / 'Error opening dataset' COLOR COL_NEGATIVE,
F_FILENAME COLOR COL_NEGATIVE.
ENDIF.
ENDIF. " End RB_DOS
ENDFORM. " SAVE_PROGRAM
FORM READ_REPORT_FROM_DISK *
Read report into internal table. Can read from local or *
remote computer *
FORM READ_REPORT_FROM_DISK TABLES FTAB_TABLE
USING F_FILENAME.
DATA:
LC_MESSAGE(128) TYPE C.
CLEAR FTAB_TABLE.
REFRESH FTAB_TABLE.
IF RB_DOS = 'X'.
TRANSLATE F_FILENAME USING '/\'. " correct slash for Dos PC file
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = F_FILENAME
FILETYPE = 'ASC'
TABLES
DATA_TAB = FTAB_TABLE
EXCEPTIONS
CONVERSION_ERROR = 1
FILE_OPEN_ERROR = 2
FILE_READ_ERROR = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
OTHERS = 8.
IF SY-SUBRC >< 0.
WRITE: / 'Error reading file from local PC' COLOR COL_NEGATIVE.
ENDIF.
ELSEIF RB_UNIX = 'X'.
TRANSLATE F_FILENAME USING '\/'. " correct slash for unix
OPEN DATASET F_FILENAME FOR INPUT MESSAGE LC_MESSAGE IN TEXT MODE.
IF SY-SUBRC = 0.
DO.
READ DATASET F_FILENAME INTO FTAB_TABLE.
IF SY-SUBRC = 0.
APPEND FTAB_TABLE.
ELSE.
EXIT.
ENDIF.
ENDDO.
CLOSE DATASET F_FILENAME.
ELSE.
WRITE: / 'Error reading file from remote computer'
COLOR COL_NEGATIVE,
/ LC_MESSAGE,
/ F_FILENAME.
SY-SUBRC = 4.
ENDIF.
ENDIF.
ENDFORM. " READ_REPORT_FROM_DISK
FORM SPLIT_INCOMING_FILE *
--> FTAB_PROGRAM_FILE *
--> FTAB_PROGRAM_SOURCE *
--> ` *
--> FTAB_PROGRAM_TEXTS *
FORM SPLIT_INCOMING_FILE TABLES FTAB_PROGRAM_FILE
STRUCTURE MTAB_PROGRAM_FILE
FTAB_PROGRAM_SOURCE
STRUCTURE MTAB_PROGRAM_SOURCE
FTAB_PROGRAM_TEXTS
STRUCTURE MTAB_PROGRAM_TEXTS
FTAB_PROGRAM_DOCUMENTATION
STRUCTURE MTAB_PROGRAM_DOCUMENTATION
CHANGING FSTR_TRDIR
FSTR_THEAD.
DATA:
LC_DATATYPE(4) TYPE C, " Type of data, REPO, TEXP, RDIR
LC_PROGRAM_FILE LIKE MTAB_PROGRAM_FILE.
LOOP AT FTAB_PROGRAM_FILE.
LC_PROGRAM_FILE = FTAB_PROGRAM_FILE.
CASE LC_PROGRAM_FILE(9).
WHEN MC_TRDIR_IDENTIFIER.
LC_DATATYPE = MC_TRDIR_SHORT.
WHEN MC_REPORT_IDENTIFIER.
LC_DATATYPE = MC_REPORT_SHORT.
WHEN MC_TEXT_IDENTIFIER.
LC_DATATYPE = MC_TEXT_SHORT.
WHEN MC_DOC_IDENTIFIER.
LC_DATATYPE = MC_DOC_SHORT.
WHEN MC_THEAD_IDENTIFIER.
LC_DATATYPE = MC_THEAD_SHORT.
WHEN OTHERS. " Actual contents of report, trdir, or text
CASE LC_DATATYPE.
WHEN MC_TRDIR_SHORT.
FSTR_TRDIR = FTAB_PROGRAM_FILE.
WHEN MC_REPORT_SHORT.
FTAB_PROGRAM_SOURCE = FTAB_PROGRAM_FILE.
APPEND FTAB_PROGRAM_SOURCE.
WHEN MC_TEXT_SHORT.
FTAB_PROGRAM_TEXTS = FTAB_PROGRAM_FILE.
APPEND FTAB_PROGRAM_TEXTS.
WHEN MC_THEAD_SHORT.
FSTR_THEAD = FTAB_PROGRAM_FILE.
WHEN MC_DOC_SHORT.
FTAB_PROGRAM_DOCUMENTATION = FTAB_PROGRAM_FILE.
APPEND FTAB_PROGRAM_DOCUMENTATION.
ENDCASE.
ENDCASE.
ENDLOOP.
ENDFORM. " SPLIT_INCOMING_FILE
FORM INSERT_NEW_REPORT*
--> FTAB_PROGRAM_SOURCE *
--> FTAB_PROGRAM_TEXTS *
--> F_TRDIR *
FORM INSERT_NEW_REPORT TABLES FTAB_PROGRAM_SOURCE
STRUCTURE MTAB_PROGRAM_SOURCE
FTAB_PROGRAM_TEXTS
STRUCTURE MTAB_PROGRAM_TEXTS
FTAB_PROGRAM_DOCUMENTATION
STRUCTURE MTAB_PROGRAM_DOCUMENTATION
USING FSTR_TRDIR LIKE TRDIR
FSTR_THEAD LIKE MSTR_THEAD.
DATA:
LC_OBJ_NAME LIKE E071-OBJ_NAME,
LC_LINE2(40) TYPE C,
LC_ANSWER(1) TYPE C.
*-- read trdir to see if the report already exists, if it does, prompt
*-- user to overwrite or abort.
SELECT SINGLE * FROM TRDIR WHERE NAME = FSTR_TRDIR-NAME.
IF SY-SUBRC = 0. " Already exists
CONCATENATE 'want to overwrite report'
FSTR_TRDIR-NAME
INTO LC_LINE2 SEPARATED BY SPACE.
CONCATENATE LC_LINE2
INTO LC_LINE2.
CALL FUNCTION 'POPUP_TO_CONFIRM_STEP'
EXPORTING
DEFAULTOPTION = 'N'
TEXTLINE1 = 'The selected report already exists, do you'
TEXTLINE2 = LC_LINE2
TITEL = 'Report already exists'
CANCEL_DISPLAY = SPACE
IMPORTING
ANSWER = LC_ANSWER
EXCEPTIONS
OTHERS = 1.
ELSE.
LC_ANSWER = 'J'.
ENDIF.
IF LC_ANSWER = 'J'.
*-- Create the TADIR entry. (TRDIR entry created by INSERT REPORT)
LC_OBJ_NAME = TRDIR-NAME.
CALL FUNCTION 'TR_TADIR_POPUP_ENTRY_E071'
EXPORTING
WI_E071_PGMID = 'R3TR'
WI_E071_OBJECT = 'PROG'
WI_E071_OBJ_NAME = LC_OBJ_NAME
WI_TADIR_DEVCLASS = '$TMP'
EXCEPTIONS
EXIT = 3
OTHERS = 4.
IF SY-SUBRC = 0.
*-- Create Report
INSERT REPORT FSTR_TRDIR-NAME FROM FTAB_PROGRAM_SOURCE.
*-- Create Texts
INSERT TEXTPOOL FSTR_TRDIR-NAME FROM FTAB_PROGRAM_TEXTS
LANGUAGE SY-LANGU.
*-- Save Documentation
CALL FUNCTION 'DOCU_UPDATE'
EXPORTING
HEAD = FSTR_THEAD
STATE = 'A'
TYP = 'E'
VERSION = '1'
TABLES
LINE = FTAB_PROGRAM_DOCUMENTATION
EXCEPTIONS
OTHERS = 1.
ELSE.
WRITE: / 'Error updating the TADIR entry' COLOR COL_NEGATIVE,
'Program' COLOR COL_NEGATIVE INTENSIFIED OFF,
FSTR_TRDIR-NAME, 'was not loaded into SAP.'
COLOR COL_NEGATIVE INTENSIFIED OFF.
ENDIF.
ELSE.
WRITE: / FSTR_TRDIR-NAME COLOR COL_NEGATIVE,
'was not uploaded into SAP. Action cancelled by user'
COLOR COL_NEGATIVE INTENSIFIED OFF.
ENDIF.
ENDFORM. " INSERT_NEW_REPORT
FORM GET_NAME *
--> VALUE(F_FIELD) *
--> F_NAME *
FORM GET_NAME USING VALUE(F_FIELD)
CHANGING F_NAME.
DATA: LTAB_FIELDS LIKE DYNPREAD OCCURS 0 WITH HEADER LINE,
LC_PROG LIKE D020S-PROG,
LC_DNUM LIKE D020S-DNUM.
TRANSLATE F_FIELD TO UPPER CASE.
refresh ltab_fields.
LTAB_FIELDS-FIELDNAME = F_FIELD.
append ltab_fields.
LC_PROG = SY-REPID .
LC_DNUM = SY-DYNNR .
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
DYNAME = LC_PROG
DYNUMB = LC_DNUM
TABLES
dynpfields = ltab_fields
EXCEPTIONS
OTHERS = 01.
read table ltab_fields index 1.
IF SY-SUBRC EQ 0.
F_NAME = LTAB_FIELDS-FIELDVALUE.
refresh ltab_fields.
ENDIF.
CALL FUNCTION 'F4_USER'
EXPORTING
OBJECT = F_NAME
IMPORTING
RESULT = F_NAME.
ENDFORM. " GET_NAME
Program Texts
DIR File Download Options (File Selection)
FIL File Options
FNA Enter filename below (under File Options)
H01 Prog Name
H03 Program Description
SNG Upload a single file
UDL Upload to SAP/Download from SAP
UPL File Upload Options
R Backup/Restore program source code with texts
P_PATH Path to save programs to
RB_DOS Files on local computer
RB_DOWN Download Programs
RB_FILE Upload a single file
RB_LIST Select program(s) from a list
RB_UNIX Files on remote computer
RB_UP Upload Programs to SAP
S_CDAT Date Created
S_CNAM Created by UserID
S_NAME Program Name
S_SUBC Program Type
S_UDAT Date Changed
S_UNAM Last Changed by UserID
Regards,
Joy. -
SC Uploading Program to create SC automatically.
Hello
We use the classic scenario with SRM server 5.5
Sometime enduser should create SC with line items 100-300.
For this reason, my customer wants uploading program to create SC.
First of all, enduser will make the excel file with material code, price, qty.
And then user convert file type (excel  text) to upload.
Could you explain the way how to create SC?
Which FM can we use to create SC automatically during uploading the file?
Thank you
Best Regards
Lee, Sohee.Hello , you can use FM BBP_PD_SC_CREATE to create a shopping cart, in order to have a shopping cart created you will have to read some additional data.
You will have to prepare an header and define a guid for it, this guid has to be used in the 'parent' field of the items, you will also have to generate a guid for the items and use it when creating the accounting lines, the partner functions lines and the organizational structure informations. For example
header-guid = 1.
item-parent = 1.
item-guid = 2.
accounting-guid = 3.
accounting-p_guid = item-guid.
partner-partner_guid = 4.
partner-p_guid = item-guid.
organization-guid = 5.
organization-p_guid = item-guid.
You can assign the shopping to a user defining his business partner as role '00000016' in the partner function table
After you have called BBP_PD_SC_CREATE and receive no error messages you will have to call BBP_PD_SC_SAVE to have the shopping cart saved.
Regards, Luciano. -
Upload program to load Custom PA infotype
I need to develope UpLoad program to load Custom PA infotype which I created with 9001.
Can you please give the steps to Write upload program.
Thanks
RajThis is an example of the HR_INFOTYPE_OPERATION use, in this case for a custom infotype as well.
LOOP AT IT_9129.
clear : W_PERNR, W_RETCODE, i9129, t_output.
* Primeiro vamos buscar o número de empregado associado ao número do sistema anterior
PERFORM GET_NEW_PERNR USING IT_9129-PERNR
IT_9129-BEGDA
CHANGING W_PERNR
W_RETCODE.
CHECK W_RETCODE = 0.
* Aqui assignamos os valores
MOVE-CORRESPONDING it_9129 to i9129.
i9129-pernr = w_pernr.
i9129-endda = w_endda.
* Bloquear o Empregado
perform ENQUEUE_EPPRELE using W_PERNR .
* Executar PA30
CALL FUNCTION 'HR_INFOTYPE_OPERATION'
EXPORTING
INFTY = '9129'
NUMBER = i9129-pernr
VALIDITYEND = i9129-endda
VALIDITYBEGIN = i9129-begda
RECORD = i9129
OPERATION = 'INS'
TCLAS = 'A'
DIALOG_MODE = P_MODO
IMPORTING
RETURN = return.
if not return is initial.
perform fill_error using return .
else.
t_output-mensagem = 'Infotipo 9129 criado com sucesso'.
endif.
* Output
t_output-PERNR = w_pernr.
t_output-PNALT = it_9129-PERNR.
append t_output.
ENDLOOP. -
How do you Install programs to one user account on a macbook pro?
I want to download programs to my user account on my laptop without the other peoples accounts having access to it. How do you specify only to download to this account, or change the settings of past installed programs to only be accessible to my account and not the others
As Csound1 has already pointed out create a folder in your Home folder for only those applications that you want exclusive access to like this one in my Home folder:
For those application that have an installer, you'll need to install and then move the app from the Applications folder to your own app folder. -
Document type KR is not picking to Clear GL account with T-code F-03
Hi all,
My client wants to clear GL account Cash-in-Transit which is open item managed. He has posted two items. One is with KR document type like Intercompnay adjustment account debit (40) and Cash-in-Transit account credit (50). Second item is with SA document type like Cash-in-Transit accont debit (40) and Intercompany adjustment account credit (50). He did not give vendor number and appropriate posting key (31) while postings. With document type KR, he posted with posting keys 40 and 50. Now while clearing the GL account through T-code F-03, system is picking only SA document type. The system is not picking document type KR. He wants to clear the items with each other. I have checked the document type settings. Check boxes Intercompany postings and trading partner are active in both above document types.
How can the GL account be cleared ? Are any configuration settings missing ? Kindly advice as soon as possible.
Thanks in advance.
Regards,
K.S.KHi,
First of all..why would system need a Exchange gain/Loss Account..If your local currency is INR and you posted a debit and a credit document both in INR..then there is no question of a foreign exchange gain/loss account..
BUT, if you have posted the document in any currency other than INR, ie: your local currency...then the system would need a exchnage gain/loss account when you try to clear the debits and credits.. i am giving an example below to explain better..
You posted a debit of 100 USD @ 40 = Rs. 4000.00
You posted a Credit of 100 USD @ 42 = Rs. 4200.00
Now, if you clear this debit and credit then there is no difference in 100 USD, as the debit and credit is netting off.. but if you see INR there is a difference of Rs. 200.00 which system posts to Exchange gain/loss account..which we maintain in OB09.
Hope it is clear to you now..
Regards,
SAPFICO.
Maybe you are looking for
-
Photoshop CS4 corrupted file while save to server
Hello We have or Leopard OS X Server running for months. Running CS3 Clients on 10.4.11 without any problems. A couple of weeks ago we swapped to 10.5 Clients and all Photoshop where corrupted when using "save", the "save as" works fine. After some d
-
10.4.8 (and any other system upgrade) - Safe Mode?
It has recently been suggested to me that in addition to the repair permissions before and after, verify disc, unplug all externals, and use the Combo routine, that booting into safe mode to do any system upgrade is the preferred path since there's l
-
Saving files and future Java Virtual Machine updates questions
So I've made A program that keeps a list of Ingredients and Recipes for my dads small business. This program is currently on 3 computers my dads, the secretaries, and mine. I made it so it saved and loaded from a shared folder in the network where al
-
Loading video to 160gb classic
I can't load video into my ipod library after its been ripped, (istudio & DVD Magic). I have no problem ripping video formats but my library just wont accept it, (simple drag and drop), I already have a 60gb ipod that i have had no problem loading v
-
Search Windows Space in Leopard: failure
In Snow leopard, trying to search Windows drive/space returns nothing. It is on a separate drive, Mac stuff on another. I can find files manually.