BDC upload - FF67
Dear friends,
I need ur help for uploading the BRS datas in FF67 thru BDC object.I've created one object and did some coding.But while recording/executing the object...its recording/taking only one line item of my jtab table items,which i've marked in BOLD below.
FYR...
Pls check below the datas is the example of my flat file and also my Report object.
Pls advise...how to proceed to record on continuous basis of all line items of jtab.
****flat file datas and to upload it to my itab & jtab*****
itab[]
H600024005 252400 2100318499 INR 1 25.04.2008 755365 731681 25.04.2008(1st row of my notepad or excel sheet)
jtab[] (the below or mentioned as second row in my flat file)
in01 2,621 20.04.2008 1211
in01 3,931 21.04.2008 1212
in01 4,083 23.04.2008 1213
in01 7,284 24.04.2008 1214
in01 5,225 25.04.2008 1215
******report program*****
report ZFI_FF67_UPLOAD2
no standard page heading line-size 255.
DATA : BEGIN OF IT_DUMMY OCCURS 0,
DUMMY(300) TYPE C,
END OF IT_DUMMY.
data: var type c.
var = CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
data: str1(16), str2(18), str3(5), str4(5), str5(10), str6(13), str7(13), str8(10),
str9(12),
str10(4), str11(13), str12(10),
str13(13).
data: begin of itab occurs 0,
bankl(15) type c,
bankn(18) type c,
waers(5) type c,
aznum(5) type c,
azdat(10) type c,
ssald(13) type c,
esald(13) type c,
budtm(10) type c,
mnam1(12) type c,
end of itab.
data: begin of jtab occurs 0,
vgman(4) type c,
kwbtr(13) type c,
valut(10) type c,
check(13) type c,
end of jtab.
include bdcrecx1.
start-of-selection.
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = ' '
FILETYPE = ' '
TABLES
DATA_TAB = IT_DUMMY.
IF SY-SUBRC <> 0.
ENDIF.
break ab5shank.
loop at it_dummy.
str11 str12 str13.
if it_dummy-dummy+0(1) = 'H'.
split it_dummy-dummy at var into : str1 str2 str3 str4 str5 str6 str7 str8 .
itab-bankl = str1+1(15).
move str2 to itab-bankn.
move str3 to itab-waers.
move str4 to itab-aznum.
move str5 to itab-azdat.
move str6 to itab-ssald.
move str7 to itab-esald.
move str8 to itab-budtm.
move str9 to itab-mnam1.
append itab.
else.
split it_dummy-dummy at var into: STR10 str11 str12 str13.
move str10 to jtab-vgman.
move str11 to jtab-kwbtr.
move str12 to jtab-valut.
move str13 to jtab-check.
append jtab.
endif.
endloop.
perform open_group.
loop at itab.
perform bdc_dynpro using 'SAPMF40K' '0102'.
perform bdc_field using 'BDC_CURSOR'
'FEBMKA-MNAM1'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'FEBMKA-BANKL'
itab-bankl.
perform bdc_field using 'FEBMKA-BANKN'
itab-bankn.
perform bdc_field using 'FEBMKA-WAERS'
itab-waers.
perform bdc_field using 'FEBMKA-AZNUM'
itab-aznum.
perform bdc_field using 'FEBMKA-AZDAT'
itab-azdat.
perform bdc_field using 'FEBMKA-SSALD'
itab-ssald.
perform bdc_field using 'FEBMKA-ESALD'
itab-esald.
perform bdc_field using 'FEBMKA-BUDTM'
itab-budtm.
perform bdc_field using 'FEBMKA-NM1VB'
'X'.
perform bdc_field using 'FEBMKA-MNAM1'
itab-mnam1.
loop at jtab.
perform bdc_dynpro using 'SAPMF40K' '8000'.
perform bdc_field using 'BDC_CURSOR'
'FEBMKK-BLDAT(01)'.
perform bdc_dynpro using 'SAPMF40K' '8002'.
perform bdc_field using 'BDC_CURSOR'
'FEBMKK-CHECT_KF(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'FEBMKA-VGMAN(01)'
jtab-vgman.
perform bdc_field using 'FEBMKA-KWBTR(01)'
jtab-kwbtr.
perform bdc_field using 'FEBEP-VALUT(01)'
jtab-valut.
perform bdc_field using 'FEBMKK-CHECT_KF(01)'
jtab-check.
perform bdc_dynpro using 'SAPMF40K' '8000'.
perform bdc_field using 'BDC_CURSOR'
'FEBMKK-BLDAT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
endloop.
perform bdc_dynpro using 'SAPMF40K' '0102'.
perform bdc_field using 'BDC_CURSOR'
'FEBMKA-BANKL'.
perform bdc_field using 'BDC_OKCODE'
'=BACK'.
perform bdc_field using 'FEBMKA-BANKL'
itab-bankl.
perform bdc_field using 'FEBMKA-BANKN'
itab-bankn.
perform bdc_field using 'FEBMKA-WAERS'
itab-waers.
perform bdc_field using 'FEBMKA-AZNUM'
itab-aznum.
perform bdc_field using 'FEBMKA-AZDAT'
itab-azdat.
perform bdc_field using 'FEBMKA-SSALD'
itab-ssald.
perform bdc_field using 'FEBMKA-ESALD'
itab-esald.
perform bdc_field using 'FEBMKA-BUDTM'
itab-budtm.
perform bdc_field using 'FEBMKA-NM1VB'
'X'.
perform bdc_field using 'FEBMKA-MNAM1'
itab-mnam1.
perform bdc_dynpro using 'SAPLSPO1' '0100'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_dynpro using 'SAPMSSY0' '0120'.
perform bdc_field using 'BDC_OKCODE'
'=PS 85'.
perform bdc_dynpro using 'SAPMSSY0' '0120'.
perform bdc_field using 'BDC_OKCODE'
'=PS 1'.
perform bdc_dynpro using 'SAPMSSY0' '0120'.
perform bdc_field using 'BDC_OKCODE'
'=&F03'.
perform bdc_transaction using 'FF67'.
endloop.
perform close_group.
Pls reply.
thanks & regards
sankar.
check this coding
TABLES : febmka.
DATA: g_f_repid TYPE sy-repid,
g_f_dynnr TYPE sy-dynnr,
g_t_excel TYPE kcde_cells OCCURS 0 WITH HEADER LINE,
l_f_index TYPE i,
g_v_lines TYPE i,
g_v_statement LIKE febmka-aznum,
g_v_currency LIKE febmka-ssald,
g_v_currkey LIKE febmkk-fwaer_kf,
g_v_date LIKE sy-datum,
g_f_session LIKE febmka-mnam1,
g_t_febko LIKE febko OCCURS 0 WITH HEADER LINE,
wa_febko LIKE febko,
wa_t001 LIKE t001,
g_v_length TYPE i ,
g_v_curr TYPE mseg-waers.
FIELD-SYMBOLS : <fs>.
Data declaration for BDC
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE,
g_t_msg LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE,
: msgtext(132) TYPE c .
*Internal table to uplaod from Excel sheet
DATA : BEGIN OF g_t_upload OCCURS 0 ,
col1(5) ,
col2(10) ,
col3(15) ,
col4(4) ,
col5(20) ,
col6(13) ,
col7(15) ,
col8(15) ,
col9(13) ,
col10(10),
END OF g_t_upload.
*Internal table for item data.
DATA : BEGIN OF g_t_item OCCURS 0,
vgman LIKE febmka-vgman,
valut(10) TYPE c ,
kwbtr(15) TYPE c ,
gsber_kf(4) TYPE c ,
xblnr(16) TYPE c ,
chect_kf(13) TYPE c ,
kunnr(10) TYPE c ,
fwaer_kf(10) TYPE c ,
fwbtr_kf(13) TYPE c ,
END OF g_t_item.
Internal table for Header data.
DATA : BEGIN OF g_t_header OCCURS 0,
bukrs LIKE febmka-bukrs ,
hbkid LIKE febmka-hbkid ,
hktid LIKE febmka-hktid ,
aznum LIKE febmka-aznum ,
azdat(10) TYPE c ,
waers LIKE febmka-waers ,
ssald(15) TYPE c ,
esald(15) TYPE c ,
budtm(10) TYPE c ,
mnam1 LIKE febmka-mnam1 ,
END OF g_t_header .
*Constants for the function module.
CONSTANTS:
c_beg_col TYPE i VALUE 1 ,
c_beg_row TYPE i VALUE 1 ,
c_end_col TYPE i VALUE 12 ,
c_end_row TYPE i VALUE 9999 .
TABLES: febko.
*Selection screen
SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME TITLE text-001.
PARAMETERS: p_file LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN END OF BLOCK blk.
INITIALIZATION.
REFRESH : g_t_header, g_t_item , g_t_upload , g_t_msg.
CLEAR : g_t_header, g_t_item , g_t_upload ,g_t_msg .
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
Function module to get the filename
g_f_repid = sy-repid.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
program_name = g_f_repid
dynpro_number = g_f_dynnr
IMPORTING
file_name = p_file.
START-OF-SELECTION.
To check Specifications
PERFORM check_specification.
*To get the data
PERFORM get_data.
TO call transaction FF67
PERFORM bdc_ff67.
Form Get_data
FORM get_data.
Function module to get the excel data
CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
filename = p_file
i_begin_col = c_beg_col
i_begin_row = c_beg_row
i_end_col = c_end_col
i_end_row = c_end_row
TABLES
intern = g_t_excel
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.
Delete the description lines
DELETE g_t_excel[] WHERE row = 1.
DELETE g_t_excel[] WHERE row = 3.
*Move data to internal table g_t_upload
IF NOT g_t_excel[] IS INITIAL.
SORT g_t_excel BY row col.
LOOP AT g_t_excel.
MOVE : g_t_excel-col TO l_f_index.
ASSIGN COMPONENT l_f_index OF STRUCTURE g_t_upload TO <fs>.
MOVE : g_t_excel-value TO <fs>.
AT END OF row.
APPEND g_t_upload.
CLEAR g_t_upload.
ENDAT.
ENDLOOP.
ENDIF.
Move the header data to the internal table g_t_header
READ TABLE g_t_upload INDEX 1.
IF sy-subrc = 0.
IF g_t_upload-col1 NE '1800'.
MESSAGE e900(oo) WITH text-007.
EXIT.
ENDIF.
MOVE g_t_upload-col1 TO g_t_header-bukrs.
Authority check for the company code
AUTHORITY-CHECK OBJECT 'F_PAYR_BUK'
ID 'BUKRS' FIELD g_t_header-bukrs
ID 'ACTVT' FIELD '02'.
IF SY-SUBRC NE 0.
MESSAGE e000(oo) with text-019 g_t_header-bukrs .
ENDIF.
MOVE g_t_upload-col2 TO g_t_header-hbkid.
MOVE g_t_upload-col3 TO g_t_header-hktid.
MOVE g_t_upload-col4 TO g_t_header-aznum.
Fetch Currency Key For the corresponding Bank Account
CLEAR g_v_curr.
SELECT SINGLE waers FROM t012k
INTO g_v_curr
WHERE
bukrs = g_t_header-bukrs AND
hbkid = g_t_header-hbkid AND
hktid = g_t_header-hktid.
To check if the statement number already exists.
SELECT * FROM febko UP TO 1 ROWS
WHERE bukrs = g_t_header-bukrs AND
hbkid = g_t_header-hbkid AND
hktid = g_t_header-hktid AND
aznum = g_t_header-aznum.
ENDSELECT.
IF sy-subrc = 0.
MESSAGE i000(oo) WITH text-011 .
STOP.
ENDIF.
IF g_t_upload-col5 = ''.
MESSAGE e000(oo) WITH text-012.
EXIT.
ENDIF.
CONCATENATE g_t_upload-col56(4) g_t_upload-col53(2)
g_t_upload-col5+0(2) INTO g_v_date.
WRITE:g_v_date TO g_t_header-azdat.
CLEAR g_v_date.
MOVE g_t_upload-col6 TO g_t_header-waers.
g_v_curr = g_t_header-waers.
g_v_currency = g_t_upload-col7.
WRITE : g_v_currency TO g_t_header-ssald CURRENCY g_v_curr.
CLEAR g_v_currency.
g_v_currency = g_t_upload-col8.
WRITE: g_v_currency TO g_t_header-esald CURRENCY g_v_curr.
CLEAR g_v_currency.
CONCATENATE g_t_upload-col96(4) g_t_upload-col93(2)
g_t_upload-col9+0(2) INTO g_v_date.
WRITE: g_v_date TO g_t_header-budtm .
CLEAR g_v_date.
MOVE g_t_upload-col10 TO g_t_header-mnam1.
*To Validtate if the header fields in the excel are blank.
IF ( g_t_header-bukrs IS INITIAL OR g_t_header-hbkid IS INITIAL OR
g_t_header-hktid IS INITIAL OR g_t_header-aznum IS INITIAL OR
g_t_header-azdat IS INITIAL ).
MESSAGE e000(oo) WITH text-010.
ENDIF.
APPEND g_t_header.
ENDIF.
Move the statement no to a variable
READ TABLE g_t_header INDEX 1.
IF sy-subrc = 0.
MOVE g_t_header-aznum TO g_v_statement.
ENDIF.
*To check if there is only one header line given
DESCRIBE TABLE g_t_header LINES g_v_lines.
IF NOT g_v_lines = 1.
MESSAGE e000(oo) WITH text-002.
EXIT.
ENDIF.
DELETE g_t_upload INDEX 1.
Move the item data to the intenal table g_t_item
LOOP AT g_t_upload.
MOVE g_t_upload-col1 TO g_t_item-vgman.
CONCATENATE g_t_upload-col26(4) g_t_upload-col23(2)
g_t_upload-col2+0(2) INTO g_v_date.
WRITE:g_v_date TO g_t_item-valut.
CLEAR g_v_date.
g_v_currency = g_t_upload-col3.
WRITE: g_v_currency TO g_t_item-kwbtr CURRENCY g_v_curr.
CLEAR g_v_currency.
MOVE g_t_upload-col4 TO g_t_item-gsber_kf.
MOVE g_t_upload-col5 TO g_t_item-xblnr.
MOVE g_t_upload-col6 TO g_t_item-chect_kf.
MOVE g_t_upload-col7 TO g_t_item-kunnr.
MOVE g_t_upload-col8 TO g_t_item-fwaer_kf.
g_v_currency = g_t_upload-col9.
WRITE g_v_currency TO g_t_item-fwbtr_kf CURRENCY g_v_curr.
CLEAR g_v_currency.
APPEND g_t_item.
ENDLOOP.
ENDFORM. " Get_data
FORM BDC_FF67 *
FORM bdc_ff67.
READ TABLE g_t_header INDEX 1.
IF sy-subrc = 0.
g_f_session = g_t_header-mnam1.
PERFORM bdc_dynpro USING 'SAPMF40K' '0102'.
PERFORM bdc_field USING 'BDC_CURSOR'
'FEBMKA-MNAM1'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'FEBMKA-BUKRS'
g_t_header-bukrs.
PERFORM bdc_field USING 'FEBMKA-HBKID'
g_t_header-hbkid.
PERFORM bdc_field USING 'FEBMKA-HKTID'
g_t_header-hktid.
PERFORM bdc_field USING 'FEBMKA-AZNUM'
g_t_header-aznum.
PERFORM bdc_field USING 'FEBMKA-AZDAT'
g_t_header-azdat.
PERFORM bdc_field USING 'FEBMKA-SSALD'
g_t_header-ssald.
PERFORM bdc_field USING 'FEBMKA-ESALD'
g_t_header-esald.
PERFORM bdc_field USING 'FEBMKA-BUDTM'
g_t_header-budtm.
PERFORM bdc_field USING 'FEBMKA-MNAM1'
g_t_header-mnam1.
changes
PERFORM bdc_dynpro USING 'SAPMF40K' '0102'.
PERFORM bdc_field USING 'FEBMKA-AZNUM'
g_t_header-aznum.
PERFORM bdc_field USING 'FEBMKA-AZDAT'
g_t_header-azdat.
PERFORM bdc_field USING 'FEBMKA-SSALD'
g_t_header-ssald.
PERFORM bdc_field USING 'FEBMKA-ESALD'
g_t_header-esald.
PERFORM bdc_field USING 'FEBMKA-BUDTM'
g_t_header-budtm.
PERFORM bdc_field USING 'FEBMKA-MNAM1'
g_t_header-mnam1.
LOOP AT g_t_item.
PERFORM bdc_dynpro USING 'SAPMF40K' '8000'.
PERFORM bdc_field USING 'BDC_CURSOR'
'FEBMKA-KWBTR(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'FEBMKA-VGMAN(01)'
g_t_item-vgman.
PERFORM bdc_field USING 'FEBEP-VALUT(01)'
g_t_item-valut.
PERFORM bdc_field USING 'FEBMKA-KWBTR(01)'
g_t_item-kwbtr.
PERFORM bdc_field USING 'FEBMKK-GSBER_KF(01)'
g_t_item-gsber_kf.
PERFORM bdc_field USING 'FEBMKK-XBLNR(01)'
g_t_item-xblnr.
PERFORM bdc_field USING 'FEBMKK-CHECT_KF(01)'
g_t_item-chect_kf.
PERFORM bdc_field USING 'FEBMKK-KUNNR(01)'
g_t_item-kunnr.
PERFORM bdc_field USING 'FEBMKK-FWAER_KF(01)'
g_t_item-fwaer_kf.
PERFORM bdc_field USING 'FEBMKK-FWBTR_KF(01)'
g_t_item-fwbtr_kf.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ZINS'.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPMF40K' '8000'.
PERFORM bdc_field USING 'BDC_CURSOR'
'FEBMKA-KWBTR(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SICH'.
PERFORM bdc_dynpro USING 'SAPMF40K' '0101'.
PERFORM bdc_field USING 'BDC_CURSOR'
'FEBMKA-BUKRS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BUCH'.
PERFORM bdc_field USING 'FEBMKA-BUKRS'
g_t_header-bukrs.
PERFORM bdc_field USING 'FEBMKA-HBKID'
g_t_header-hbkid.
PERFORM bdc_field USING 'FEBMKA-HKTID'
g_t_header-hktid.
PERFORM bdc_field USING 'FEBMKA-AZNUM'
g_t_header-aznum.
PERFORM bdc_field USING 'FEBMKA-AZDAT'
g_t_header-azdat.
PERFORM bdc_field USING 'FEBMKA-SSALD'
g_t_header-ssald.
PERFORM bdc_field USING 'FEBMKA-ESALD'
g_t_header-esald.
PERFORM bdc_field USING 'FEBMKA-BUDTM'
g_t_header-budtm.
PERFORM bdc_field USING 'FEBMKA-MNAM1'
g_t_header-mnam1.
PERFORM bdc_dynpro USING 'SAPMSSY0' '0120'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
PERFORM bdc_dynpro USING 'SAPMF40K' '0101'.
PERFORM bdc_field USING 'BDC_CURSOR'
'FEBMKA-BUKRS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
PERFORM bdc_field USING 'FEBMKA-BUKRS'
g_t_header-bukrs.
PERFORM bdc_field USING 'FEBMKA-HBKID'
g_t_header-hbkid.
PERFORM bdc_field USING 'FEBMKA-HKTID'
g_t_header-hktid.
PERFORM bdc_field USING 'FEBMKA-AZNUM'
g_t_header-aznum.
PERFORM bdc_field USING 'FEBMKA-AZDAT'
g_t_header-azdat.
PERFORM bdc_field USING 'FEBMKA-MNAM1'
g_t_header-mnam1.
ENDIF.
CALL TRANSACTION 'FF67' USING bdcdata
MODE 'A'
UPDATE 'S'
MESSAGES INTO g_t_msg.
IF NOT g_t_msg[] IS INITIAL.
READ TABLE g_t_msg WITH KEY msgtyp = 'S'
MSGNR = '041'
MSGID = 'FV'.
IF sy-subrc = 0.
WRITE:/ sy-uline(110).
WRITE:/ sy-vline, text-003 ,23 g_v_statement, 110 sy-vline.
WRITE:/ sy-uline(110).
WRITE:/ sy-vline, g_f_session ,text-008,110 sy-vline.
WRITE:/ sy-uline(110).
ELSE.
WRITE:/ sy-uline(110).
WRITE:/ sy-vline, text-003 ,23 g_v_statement, 110 sy-vline.
WRITE:/ sy-uline(110).
WRITE:/ sy-vline,text-004,21 sy-vline , 23 text-005,
75 sy-vline,77 text-006 ,110 sy-vline.
WRITE:/ sy-uline(110).
LOOP AT g_t_msg WHERE msgtyp EQ 'E'.
MESSAGE ID g_t_msg-msgid
TYPE g_t_msg-msgtyp
NUMBER g_t_msg-msgnr
WITH g_t_msg-msgv1 g_t_msg-msgv2 g_t_msg-msgv3
g_t_msg-msgv4 INTO msgtext.
WRITE :/ sy-vline, g_t_msg-msgtyp UNDER text-004,
21 sy-vline ,msgtext UNDER text-005,
75 sy-vline ,g_t_msg-fldname UNDER text-006,
110 sy-vline.
WRITE:/ sy-uline(110).
ENDLOOP.
ENDIF.
ELSE.
WRITE:/ text-014.
ENDIF.
ENDFORM.
FORM bdc_dynpro *
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM.
FORM bdc_field *
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM.
*& Form check_specification
text
FORM check_specification.
Check for the existing Specification in the Settings of FF67
IMPORT febmka-vari_start
febmka-kont_int
febmka-wvar_art
FROM DATABASE rfdt(mk) ID sy-uname.
IF febmka-kont_int = space .
MESSAGE e000(oo) WITH text-017 text-018.
EXIT.
ENDIF.
IF febmka-vari_start NE 'IN01'.
MESSAGE e000(oo) WITH text-017 text-015.
EXIT.
ENDIF.
IF febmka-wvar_art NE '1'.
MESSAGE e000(oo) WITH text-017 text-016.
EXIT.
ENDIF.
ENDFORM. " check_specification
Similar Messages
-
BDC for FF67 not displaying the line itmes of second page
Hi all,
I am using the Z BDC report Manual Bank Statement Upload (FF67). The BDC is as mentioned below :
We are using start variant in the BDC.
The report is working fine but the issue is that suppose if their are 45 line items and on one page we can have only 30 line items . Then only 30 line items are been displayed . It is not taking the line items which have come on the second page. Please advsie . Below is the code of the BDC.
REPORT zfi_bank_recon.
TABLES : febko.
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
DATA : i_messtab LIKE bdcmsgcoll OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF itab OCCURS 0,
vgman TYPE febmka-vgman,
valut TYPE char10, "febep-valut,
kwbtr TYPE char17, "febmka-kwbtr,
chect_kf TYPE febmkk-chect_kf,
sgtxt_kf TYPE febmkk-sgtxt_kf,
count(6) TYPE n,
END OF itab.
DATA : BEGIN OF error OCCURS 0,
msg TYPE string,
END OF error.
DATA :flag,
update VALUE 'A',
mode VALUE 'N'.
DATA : aznum1 TYPE aznum,
lv_esbtr TYPE febko-esbtr,
lv_esvoz TYPE febko-esvoz,
lv_opening TYPE char17, "febmka-kwbtr,
lv_closing TYPE char17. "febmka-kwbtr.
*& Selection screen
SELECTION-SCREEN : BEGIN OF BLOCK blk WITH FRAME TITLE text.
PARAMETERS : bukrs LIKE febmka-bukrs OBLIGATORY,
hbkid LIKE febmka-hbkid OBLIGATORY,
hktid LIKE febmka-hktid OBLIGATORY,
azdat LIKE febmka-azdat OBLIGATORY,
aznum LIKE febmka-aznum OBLIGATORY,
budtm LIKE febmka-budtm OBLIGATORY DEFAULT sy-datum.
SELECTION-SCREEN : END OF BLOCK blk.
SELECTION-SCREEN : BEGIN OF BLOCK blk1 WITH FRAME TITLE text1.
PARAMETERS: p_file LIKE rlgrap-filename OBLIGATORY.
SELECTION-SCREEN : END OF BLOCK blk1.
AT SELECTION-SCREEN.
SELECT SINGLE * FROM febko INTO febko
WHERE bukrs = bukrs AND hbkid = hbkid AND
hktid = hktid AND aznum = aznum
AND budtm = budtm
AND azdat = azdat.
IF sy-subrc EQ 0.
MESSAGE e038(000) WITH 'Statement' aznum 'already uploaded; No further processing done'.
ENDIF.
At Selection Screen Event
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL FUNCTION 'F4_FILENAME'
IMPORTING
file_name = p_file.
*& Start of Selection
START-OF-SELECTION.
CLEAR : flag.
PERFORM data_upload.
PERFORM check_data.
IF itab[] IS NOT INITIAL AND flag IS INITIAL..
PERFORM open_group.
REFRESH bdcdata.
PERFORM bdcdata. " USING LV_OPENING LV_CLOSING.
PERFORM bdc_insert.
PERFORM close_group.
ENDIF.
*& Form check_data
FORM check_data.
LOOP AT itab.
DATA : int(6) TYPE n.
CLEAR : int.
int = sy-tabix.
IF itab-vgman IS INITIAL.
CONCATENATE 'Transaction type should not be blank : Record no' int INTO error-msg SEPARATED BY space.
APPEND error.
CLEAR : error.
ENDIF.
IF itab-valut IS INITIAL.
CONCATENATE 'Value Date should not be blank : Record no' int INTO error-msg SEPARATED BY space.
APPEND error.
CLEAR : error.
ENDIF.
IF itab-kwbtr IS INITIAL.
CONCATENATE 'Amount should not be blank : Record no' int INTO error-msg SEPARATED BY space.
APPEND error.
CLEAR : error.
ENDIF.
IF itab-chect_kf IS INITIAL.
CONCATENATE 'Bank Reference should not be blank : Record no' int INTO error-msg SEPARATED BY space.
APPEND error.
CLEAR : error.
ENDIF.
IF itab-vgman NE 'DLF1'
AND itab-vgman NE 'DLF2'.
CONCATENATE 'A Transaction type is not used : Record no' int INTO error-msg SEPARATED BY space.
APPEND error.
CLEAR : error.
ENDIF.
IF itab-vgman EQ 'DLF1'
AND itab-kwbtr LE 0.
CONCATENATE 'As per Transaction type, the Amount should be Positive : Record no' int INTO error-msg SEPARATED BY space.
APPEND error.
CLEAR : error.
ENDIF.
IF itab-vgman EQ 'DLF2'
AND itab-kwbtr GE 0.
CONCATENATE 'As per Transaction type, the Amount should be Negative : Record no' int INTO error-msg SEPARATED BY space.
APPEND error.
CLEAR : error.
ENDIF.
ENDLOOP.
IF error[] IS NOT INITIAL.
WRITE : / 'Error found in upload file'.
SKIP 2 .
LOOP AT error.
WRITE : / error-msg.
ENDLOOP.
flag = 'X'.
ENDIF.
CLEAR : lv_esbtr, lv_esvoz, aznum1, lv_opening, lv_closing.
IF flag IS INITIAL.
SELECT MAX( DISTINCT aznum ) FROM febko INTO aznum1
WHERE bukrs = bukrs AND hbkid = hbkid AND hktid = hktid.
IF sy-subrc = 0.
SELECT SINGLE esbtr esvoz FROM febko INTO (lv_esbtr,lv_esvoz)
WHERE bukrs = bukrs AND hbkid = hbkid AND hktid = hktid AND aznum = aznum1 .
IF lv_esvoz = 'S'.
lv_opening = lv_esbtr * -1.
ELSE.
lv_opening = lv_esbtr.
ENDIF.
lv_closing = lv_opening.
ENDIF.
LOOP AT itab.
lv_closing = lv_closing + itab-kwbtr.
DATA : lv_count(6) TYPE n.
lv_count = lv_count + 1.
MOVE lv_count TO itab-count .
MODIFY itab FROM itab.
CLEAR : itab.
ENDLOOP.
ENDIF.
ENDFORM. "check_data
*& Form data_upload
FORM data_upload.
DATA: loc_filename TYPE string.
loc_filename = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = loc_filename
filetype = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. "data_upload
*& Form bdcdata
FORM bdcdata. " USING lv_opening TYPE febko-ssbtr
" lv_closing TYPE febko-esbtr.
DATA : day(2),
month(2),
year(4),
date(10).
year = azdat+0(4).
month = azdat+4(2).
day = azdat+6(2).
CONCATENATE day month year INTO date.
CONDENSE : date.
Comment
PERFORM bdc_dynpro USING 'SAPMF40K' '0101'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/EVORG'.
PERFORM bdc_field USING 'BDC_CURSOR'
'FEBMKA-AZDAT'.
PERFORM bdc_dynpro USING 'SAPMF40K' '0110'.
PERFORM bdc_field USING 'BDC_CURSOR'
'FEBMKA-VARI_START'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTE'.
PERFORM bdc_field USING 'FEBMKA-KONT_INT'
'X'.
PERFORM bdc_field USING 'FEBMKA-FDIS_SEL'
'X'.
PERFORM bdc_field USING 'FEBMKA-VARI_START'
'Z0001'.
PERFORM bdc_field USING 'FEBMKA-DEBI_MID'
'D'.
PERFORM bdc_field USING 'FEBMKA-KRED_MID'
'K'.
PERFORM bdc_field USING 'FEBMKA-WVAR_ART'
'4'.
PERFORM bdc_field USING 'FEBMKA-BUCH_VAL'
'X'.
PERFORM bdc_dynpro USING 'SAPMF40K' '0101'.
PERFORM bdc_field USING 'BDC_CURSOR'
'FEBMKA-ESALD'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'FEBMKA-BUKRS'
bukrs.
PERFORM bdc_field USING 'FEBMKA-HBKID'
hbkid.
PERFORM bdc_field USING 'FEBMKA-HKTID'
hktid.
PERFORM bdc_field USING 'FEBMKA-AZNUM'
aznum.
PERFORM bdc_field USING 'FEBMKA-AZDAT'
date.
PERFORM bdc_field USING 'FEBMKA-SSALD'
lv_opening.
PERFORM bdc_field USING 'FEBMKA-ESALD'
lv_closing.
PERFORM bdc_dynpro USING 'SAPMF40K' '8000'.
PERFORM bdc_field USING 'BDC_CURSOR'
'FEBMKK-SGTXT_KF(01)'.
SORT itab DESCENDING BY count.
LOOP AT itab.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SICH'.
PERFORM bdc_field USING 'FEBMKA-VGMAN(01)'
itab-vgman.
PERFORM bdc_field USING 'FEBEP-VALUT(01)'
itab-valut.
PERFORM bdc_field USING 'FEBMKA-KWBTR(01)'
itab-kwbtr.
PERFORM bdc_field USING 'FEBMKK-CHECT_KF(01)'
itab-chect_kf.
PERFORM bdc_field USING 'FEBMKK-SGTXT_KF(01)'
itab-sgtxt_kf.
PERFORM bdc_dynpro USING 'SAPMF40K' '8000'.
PERFORM bdc_field USING 'BDC_CURSOR'
'FEBMKK-SGTXT_KF(01)'.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPMF40K' '8000'.
PERFORM bdc_field USING 'BDC_CURSOR'
'FEBMKA-KWBTR(01)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=SICH'.
PERFORM bdc_dynpro USING 'SAPMF40K' '0101'.
PERFORM bdc_field USING 'BDC_CURSOR'
'FEBMKA-BUKRS'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=BACK'.
PERFORM bdc_dynpro USING 'SAPLSPO1' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=NO'.
ENDFORM. "bdcdata
*& Form OPEN_GROUP
FORM open_group .
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = 'BANK_STAT'
user = sy-uname.
keep = 'X'.
ENDFORM. " OPEN_GROUP
*& Form CLOSE_GROUP
FORM close_group .
CALL FUNCTION 'BDC_CLOSE_GROUP'.
CALL TRANSACTION 'SM35'.
ENDFORM. " CLOSE_GROUP
*& Form bdc_insert
FORM bdc_insert.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = 'FF67'
TABLES
dynprotab = bdcdata.
ENDFORM. " bdc_insert
Start new screen *
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "BDC_DYNPRO
Insert field *
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. "BDC_FIELDHi,
Use:
If line item = 30.
OKCODE = 'P++'. --->For next page after every 30 line items.
endif.
Or:(Sumilate in BDC)
1 . New line. -
>Get the Fcode/Sy-ucomm value of New line(Icon on menu bar)
2.Enter Line Item.
Follow this after every line item.
Hope this resolves the issue.
Regards,
Gurpreet -
BDC upload problem in hr master
Hi,
we are facing a problem in BDC upload for hr master tcode pa40.
we want to stop bdc after 2 screens only and not process further screens. how to do this?
please help
Thanks.Hi,
If you are using Session Mode :
After 2nd screen's is porcessed Use \BEND in the ok code field of BDC TABLE.
This will work,
Regards,
Gurpreet. -
BDC upload program for inoftypes 14 and 168
Hi All,
I am uploading IT 14 and 168 through a single BDC program. i am opening the bdc session using
BDC_OPEN_GROUP before bdc recording. my requirement is to upload IT 168 only when uploading
of IT 14 is successful. For this i am using the message table of the first upload(for IT14). if the message
type is 'S'(success) then i am uploading IT168 else i am moving it to an error internal table. Please suugest
wthr this logic is fine. Also where should i call BDC_CLOSE_GROUP. currently i am calling it after the
PERFORM for upload of infotype 168 but it is giving error "unable to open BDC_CLOSE_GROUP".
Can anyone suggest me the solution through some sample code.
i am attaching here my code for your reference.
REPORT ZUSAHR_IN_BN_E_014_168 NO STANDARD PAGE HEADING
LINE-COUNT 65 LINE-SIZE 132.
*=======================================================================
TYPE-POOLS
*=======================================================================
TYPE-POOLS: slis,
truxs.
*=======================================================================
TABLES
*=======================================================================
TABLES: pernr.
*=======================================================================
INFOTYPES
*=======================================================================
INFOTYPES: 0000, "Action
0014, "Recurring payement/deductions
0168. "Insurance plan
*=======================================================================
TYPES
*=======================================================================
TYPES : BEGIN OF t_0014_0168,
num(20) type c, "Number
actcode(1) type c, "action code
lgart LIKE p0014-lgart, "Wage Type
betrg LIKE q0014-betrg, "Amount
betrg(14) type c, "Amount
bplan LIKE p0168-bplan, "Benefit plan
bcovr like p0168-bcovr, "Insurance Option
END OF t_0014_0168,
BEGIN OF t_pernr,
pernr LIKE p0002-pernr, "personnel number
perid like p0002-perid, "SSN
END OF t_pernr,
BEGIN OF errmsg,
pernr LIKE p0014-pernr, "personnel number
messg(85), " message text
END OF errmsg,
BEGIN OF succmsg,
pernr LIKE p0014-pernr, "personnel number
messg(85), " message text
END OF succmsg.
*=======================================================================
INTERNAL TABLES
*=======================================================================
DATA : i_itab TYPE STANDARD TABLE OF t_0014_0168,
i_pernr TYPE STANDARD TABLE OF t_pernr,
i_bdcitab TYPE STANDARD TABLE OF bdcdata ,
i_bdcmsgcoll TYPE STANDARD TABLE OF bdcmsgcoll,
i_errmsg TYPE STANDARD TABLE OF errmsg,
i_succmsg TYPE STANDARD TABLE OF succmsg.
*=======================================================================
RANGES
*=======================================================================
*=======================================================================
DATA DECLARATION
*=======================================================================
DATA : messg(85).
*=======================================================================
GLOBAL WORKAREAS
*=======================================================================
DATA : wa_itab TYPE t_0014_0168,
wa_pernr TYPE t_pernr,
wa_bdcitab TYPE bdcdata ,
wa_bdcmsgcoll TYPE bdcmsgcoll,
wa_errmsg TYPE errmsg,
wa_succmsg TYPE succmsg.
*=======================================================================
GLOBAL VARIABLES
*=======================================================================
DATA : g_n1 TYPE sy-dbcnt.
*=======================================================================
GLOBAL CONSTANTS
*=======================================================================
DATA : g_x TYPE c VALUE 'X',
g_asc TYPE char10 VALUE 'ASC',
g_xls(3) TYPE c VALUE 'XLS',
g_f TYPE c VALUE 'F',
g_1 TYPE c VALUE '1',
g_0 TYPE c VALUE '0',
g_u TYPE c VALUE 'U',
g_int(3) TYPE c VALUE 'INT',
g_raw(3) TYPE c VALUE 'RAW',
G_A(1) TYPE C VALUE 'A',
G_C(1) TYPE C VALUE 'C',
G_D(1) TYPE C VALUE 'D'.
*=======================================================================
SELECTION-SCREEN
*=======================================================================
*Block for Additional selection
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS : p_check TYPE char1 DEFAULT 'X', "check box for test run
p_file1 TYPE rlgrap-filename OBLIGATORY, " upload file
p_file2 TYPE rlgrap-filename OBLIGATORY, " succ emp
p_file3 TYPE rlgrap-filename OBLIGATORY. " err emp
SELECTION-SCREEN END OF BLOCK b1.
*=======================================================================
AT SELECTION-SCREEN
*=======================================================================
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file1.
PERFORM sub_file_intake.
*=======================================================================
START-OF-SELECTION
*=======================================================================
START-OF-SELECTION.
PERFORM sub_data_upload.
PERFORM GET_PERNR_SSN.
*=======================================================================
END-OF-SELECTION
*=======================================================================
END-OF-SELECTION.
*> upload the data using BDC
PERFORM sub_bdc_upload.
*> To display the contents of the input file for test run
IF p_check = space.
PERFORM sub_output.
ELSE.
*> To display in the messages after uploading the input file
PERFORM sub_output_messages.
ENDIF.
*& Form sub_file_intake
F4 on filename to accept file
--> p1 text
<-- p2 text
FORM sub_file_intake .
To provide F4 Functionality for file path
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
program_name = syst-repid
CHANGING
file_name = p_file1
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.
ENDFORM. " sub_file_intake
*& Form SUB_DATA_UPLOAD
Upload the input file and perform the checkings.
--> p1 text
<-- p2 text
FORM SUB_DATA_UPLOAD .
*> local variable for filename
DATA : l_file1 TYPE string.
*> assign value for file1.
l_file1 = p_file1.
*> function to upload the input file
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_file1
filetype = g_asc
has_field_separator = g_x
TABLES
data_tab = i_itab
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " SUB_DATA_UPLOAD
*& Form sub_output
if program is on test run mode then display records
FORM sub_output .
*> Count the number of employee to be processed
CLEAR g_n1.
DESCRIBE TABLE i_itab LINES g_n1.
IF g_n1 NE 0.
*> if program is in test run mode then display
LOOP AT i_itab INTO wa_itab.
WRITE: / wa_itab-num,
wa_itab-lgart,
wa_itab-betrg,
wa_itab-bplan,
wa_itab-bcovr.
ENDLOOP.
ENDIF.
ENDFORM. " sub_output
*& Form sub_bdc_upload
bdc upload
FORM sub_bdc_upload .
*> Count the number of employee to be processed
CLEAR g_n1.
DESCRIBE TABLE i_itab LINES g_n1.
IF g_n1 NE 0.
PERFORM sub_open_group.
PERFORM sub_bdc_sessions.
PERFORM sub_close_group.
ELSE.
MESSAGE e003(zmsg) WITH text-021.
ENDIF.
ENDFORM. " sub_bdc_upload
*& Form sub_open_group
bdc_open_group
FORM sub_open_group .
*> group name
DATA : c_group LIKE apqi-groupid .
c_group = text-001.
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = c_group
holddate = sy-datum
keep = g_x
user = sy-uname
prog = sy-cprog
EXCEPTIONS
client_invalid = 1
destination_invalid = 2
group_invalid = 3
group_is_locked = 4
holddate_invalid = 5
internal_error = 6
queue_error = 7
running = 8
system_lock_error = 9
user_invalid = 10
OTHERS = 11.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ENDFORM. " sub_open_group
*& Form sub_close_group
Close the BDC Session
FORM sub_close_group .
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
not_open = 1
queue_error = 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.
ENDFORM. " sub_close_group
*& Form sub_bdc_sessions
BDC Sessions
FORM sub_bdc_sessions .
*> Local Constants
DATA: l_ctumode LIKE ctu_params-dismode VALUE 'A',
l_cupdate LIKE ctu_params-updmode VALUE 'S',
l_startdate(10) type c,
l_enddate(10) type c,
l_tcode(4) TYPE c VALUE 'PA30',
l_info(2) TYPE c VALUE '14'.
LOOP AT i_itab INTO wa_itab.
perform bdc_dynpro using 'SAPMP50A' '1000'.
IF wa_itab-actcode = G_A.
perform bdc_field using 'BDC_OKCODE'
'=INS'.
ELSEIF wa_itab-actcode = G_D.
perform bdc_field using 'BDC_OKCODE'
'=DEL'.
ELSEIF wa_itab-actcode = G_C.
perform bdc_field using 'BDC_OKCODE'
'=MOD'.
ENDIF.
perform bdc_field using 'RP50G-PERNR' wa_itab-num.
perform bdc_field using 'RP50G-TIMR6'
'X'.
perform bdc_field using 'BDC_CURSOR'
'RP50G-CHOIC'.
perform bdc_field using 'RP50G-CHOIC' l_info.
perform bdc_dynpro using 'MP001400' '2010'.
perform bdc_field using 'BDC_CURSOR'
'Q0014-BETRG'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'P0014-BEGDA'
'03/18/2008'.
perform bdc_field using 'P0014-ENDDA'
'12/31/9999'.
perform bdc_field using 'P0014-LGART' wa_itab-lgart.
perform bdc_field using 'Q0014-BETRG' wa_itab-betrg.
perform bdc_field using 'Q0014-BETRG'
wa_itab-betrg.
' 248'.
perform bdc_field using 'P0014-BETRG' wa_itab-betrg.
perform bdc_field using 'P0014-WAERS'
'USD'.
perform bdc_dynpro using 'MP001400' '2010'.
perform bdc_field using 'BDC_CURSOR'
'P0014-BEGDA'.
perform bdc_field using 'BDC_OKCODE'
'=UPD'.
perform bdc_field using 'P0014-BEGDA'
'03/18/2008'.
perform bdc_field using 'P0014-ENDDA'
'12/31/9999'.
perform bdc_field using 'P0014-LGART' wa_itab-lgart.
perform bdc_field using 'Q0014-BETRG' wa_itab-betrg.
perform bdc_field using 'P0014-BETRG' wa_itab-betrg.
perform bdc_field using 'P0014-WAERS'
'USD'.
*> refresh the message tab
REFRESH i_bdcmsgcoll.
CALL TRANSACTION l_tcode USING i_bdcitab
MODE l_ctumode
UPDATE l_cupdate
MESSAGES INTO i_bdcmsgcoll.
*> refresh the bdc data tab
REFRESH i_bdcitab.
*> store the message for this pernr
PERFORM sub_build_messages.
ENDLOOP.
ENDFORM. " sub_bdc_sessions
Start new screen *
FORM bdc_dynpro USING program dynpro.
CLEAR wa_bdcitab.
wa_bdcitab-program = program.
wa_bdcitab-dynpro = dynpro.
wa_bdcitab-dynbegin = g_x.
APPEND wa_bdcitab TO i_bdcitab.
ENDFORM. "BDC_DYNPRO
Insert field *
FORM bdc_field USING fnam fval.
IF fval <> space.
CLEAR wa_bdcitab.
wa_bdcitab-fnam = fnam.
wa_bdcitab-fval = fval.
APPEND wa_bdcitab TO i_bdcitab.
ENDIF.
ENDFORM. "BDC_FIELD
*& Form sub_build_messages
Generate the messages
FORM sub_build_messages .
*> Local Constants
DATA : l_s TYPE c VALUE 'S'.
LOOP AT i_bdcmsgcoll INTO wa_bdcmsgcoll.
*> generate the message
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = wa_bdcmsgcoll-msgid
msgnr = wa_bdcmsgcoll-msgnr
msgv1 = wa_bdcmsgcoll-msgv1
msgv2 = wa_bdcmsgcoll-msgv2
msgv3 = wa_bdcmsgcoll-msgv3
msgv4 = wa_bdcmsgcoll-msgv4
IMPORTING
message_text_output = messg
EXCEPTIONS
OTHERS = 1.
IF sy-subrc EQ 0.
*> if message type is 'S' then store in successful table
IF wa_bdcmsgcoll-msgtyp = l_s.
MOVE wa_itab-num TO wa_succmsg-pernr.
MOVE messg TO wa_succmsg-messg.
APPEND wa_succmsg TO i_succmsg.
CLEAR wa_succmsg.
PERFORM BDC_UPLOAD_168.
ELSE.
*> if message type is 'E' then store in error table
MOVE wa_itab-num TO wa_errmsg-pernr.
MOVE messg TO wa_errmsg-messg.
APPEND wa_errmsg TO i_errmsg.
CLEAR wa_errmsg.
ENDIF.
ENDIF.
ENDLOOP.
ENDFORM. " sub_build_messages
*& Form sub_output_messages
text
--> p1 text
<-- p2 text
FORM sub_output_messages .
IF p_check = g_x.
*> clear the count
CLEAR g_n1.
*> count the number of successful employees
DESCRIBE TABLE i_succmsg LINES g_n1.
IF g_n1 <> 0 .
*> download success file
PERFORM sub_succ_file.
*> display the successful employees
WRITE :/ text-002.
LOOP AT i_succmsg INTO wa_succmsg.
WRITE:/ wa_succmsg-pernr, wa_succmsg-messg.
ENDLOOP.
ENDIF.
*> clear the count
CLEAR g_n1.
*> count the number of error employees
DESCRIBE TABLE i_errmsg LINES g_n1.
IF g_n1 <> 0 .
*> download error file
PERFORM sub_err_file.
*> display the error employees
WRITE :/ text-003.
LOOP AT i_errmsg INTO wa_errmsg.
WRITE:/ wa_errmsg-pernr,wa_errmsg-messg.
ENDLOOP.
ENDIF.
ENDIF.
ENDFORM. " sub_output_messages
*& Form SUB_SUCC_FILE
text
--> p1 text
<-- p2 text
FORM sub_succ_file .
*> local variable for filename
DATA : l_file1 TYPE string.
*> assign value for file1.
l_file1 = p_file2.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_file1
filetype = g_asc
TABLES
data_tab = i_succmsg
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc EQ 0.
MESSAGE s003(zmsg) WITH text-006.
ENDIF.
ENDFORM. " SUB_SUCC_FILE
*& Form SUB_ERR_FILE
text
--> p1 text
<-- p2 text
FORM sub_err_file .
*> local variable for filename
DATA : l_file1 TYPE string.
*> assign value for file1.
l_file1 = p_file3.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = l_file1
filetype = g_asc
TABLES
data_tab = i_errmsg
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
IF sy-subrc EQ 0.
MESSAGE s003(zmsg) WITH text-007.
ENDIF.
ENDFORM. " SUB_ERR_FILE
*& Form GET_PERNR_SSN
text
--> p1 text
<-- p2 text
FORM GET_PERNR_SSN .
data : l_cnt type i.
describe table i_itab lines l_cnt.
if l_cnt ge 0.
SELECT PERNR PERID FROM PA0002 INTO table i_pernr
FOR ALL ENTRIES IN i_itab
WHERE PERID EQ i_itab-num.
IF SY-SUBRC EQ 0.
PERFORM MODIFY_TABLE.
ENDIF.
endif.
ENDFORM. " GET_PERNR_SSN
*& Form MODIFY_TABLE
text
--> p1 text
<-- p2 text
FORM MODIFY_TABLE .
LOOP AT i_itab INTO wa_itab.
READ TABLE i_pernr INTO wa_pernr WITH KEY perid = wa_itab-num.
IF SY-SUBRC EQ 0.
MOVE WA_PERNR-PERNR TO WA_ITAB-NUM.
MODIFY i_itab FROM wa_itab.
ENDIF.
ENDLOOP.
ENDFORM. " MODIFY_TABLE
*& Form BDC_UPLOAD_168
text
--> p1 text
<-- p2 text
FORM BDC_UPLOAD_168 .
PERFORM sub_open_group.
PERFORM sub_bdc_sessions_168.
PERFORM sub_close_group.
ENDFORM. " BDC_UPLOAD_168
*& Form SUB_BDC_SESSIONS_168
text
--> p1 text
<-- p2 text
FORM SUB_BDC_SESSIONS_168 .
DATA: l_ctumode LIKE ctu_params-dismode VALUE 'A',
l_cupdate LIKE ctu_params-updmode VALUE 'S',
l_sdate(10) type c,
l_edate(10) type c,
l_tcode(4) TYPE c VALUE 'PA30',
l_info(3) TYPE c VALUE '168'.
LOOP AT i_itab INTO wa_itab.
perform bdc_dynpro using 'SAPMP50A' '1000'.
IF wa_itab-actcode = G_A.
perform bdc_field using 'BDC_OKCODE'
'=INS'.
ELSEIF wa_itab-actcode = G_D.
perform bdc_field using 'BDC_OKCODE'
'=DEL'.
ELSEIF wa_itab-actcode = G_C.
perform bdc_field using 'BDC_OKCODE'
'=MOD'.
ENDIF.
perform bdc_field using 'RP50G-PERNR' wa_itab-num.
perform bdc_field using 'RP50G-TIMR6'
'X'.
perform bdc_field using 'BDC_CURSOR'
'RP50G-CHOIC'.
perform bdc_field using 'RP50G-CHOIC' l_info.
perform bdc_dynpro using 'MP016800' '2000'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'P0168-BEGDA'
'03/18/2008'.
perform bdc_field using 'P0168-ENDDA'
'12/31/9999'.
perform bdc_field using 'BDC_CURSOR'
'P0168-BCOVR'.
perform bdc_field using 'P0168-BPLAN' wa_itab-bplan.
perform bdc_field using 'P0168-BCOVR' wa_itab-bcovr.
perform bdc_field using 'Q0168-CSTDT'
'03/18/2008'.
perform bdc_field using 'Q0168-EEPER'
'2'.
perform bdc_field using 'P0168-PERIO'
'2'.
perform bdc_dynpro using 'MP016800' '2000'.
perform bdc_field using 'BDC_CURSOR'
'P0168-BEGDA'.
perform bdc_field using 'BDC_OKCODE'
'=UPD'.
perform bdc_field using 'P0168-BEGDA'
'03/18/2008'.
perform bdc_field using 'P0168-ENDDA'
'12/31/9999'.
perform bdc_field using 'P0168-BPLAN' wa_itab-bplan.
perform bdc_field using 'P0168-BCOVR' wa_itab-bcovr.
perform bdc_field using 'Q0168-CSTDT'
'03/18/2008'.
perform bdc_field using 'Q0168-EEPER'
'2'.
*> refresh the message tab
REFRESH i_bdcmsgcoll.
CALL TRANSACTION l_tcode USING i_bdcitab
MODE l_ctumode
UPDATE l_cupdate
MESSAGES INTO i_bdcmsgcoll.
*> refresh the bdc data tab
REFRESH i_bdcitab.
*> store the message for this pernr
PERFORM sub_build_messages_168.
ENDLOOP.
ENDFORM. " SUB_BDC_SESSIONS_168
*& Form SUB_BUILD_MESSAGES_168
text
--> p1 text
<-- p2 text
FORM SUB_BUILD_MESSAGES_168 .
*> Local Constants
DATA : l_s TYPE c VALUE 'S'.
LOOP AT i_bdcmsgcoll INTO wa_bdcmsgcoll.
*> generate the message
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = wa_bdcmsgcoll-msgid
msgnr = wa_bdcmsgcoll-msgnr
msgv1 = wa_bdcmsgcoll-msgv1
msgv2 = wa_bdcmsgcoll-msgv2
msgv3 = wa_bdcmsgcoll-msgv3
msgv4 = wa_bdcmsgcoll-msgv4
IMPORTING
message_text_output = messg
EXCEPTIONS
OTHERS = 1.
IF sy-subrc EQ 0.
*> if message type is 'S' then store in successful table
IF wa_bdcmsgcoll-msgtyp = l_s.
MOVE wa_itab-num TO wa_succmsg-pernr.
MOVE messg TO wa_succmsg-messg.
APPEND wa_succmsg TO i_succmsg.
CLEAR wa_succmsg.
ELSE.
*> if message type is 'E' then store in error table
MOVE wa_itab-num TO wa_errmsg-pernr.
MOVE messg TO wa_errmsg-messg.
APPEND wa_errmsg TO i_errmsg.
CLEAR wa_errmsg.
ENDIF.
ENDIF.
ENDLOOP.
Many thanks in advance!!!!
RupeshFor the IDOC perspective, you can uses CREMAS.
For the mass maintenance you still have XK99 (which also uses CREMAS internally)
True there is NO BAPI
For the BDC and the table control. Well this is not really true.
In batchinput, instead of maintaining the rows by there Number, you should select it at the first position.
OK-CODE /06 will open a selection screen SAPMF02K 2324. The result of the selection screen goes to the first line of the table control.
Of course this works only in BDC
reward points if helpful
Edited by: Alain Bacchi on Jun 18, 2008 8:48 AM -
hi experts.
I am using a BDC-UPLOAD program for MB11 but there is one error during an upload.
Here is a procedure which i am following:
I have created an upload file, which is tab-delimited format. In which such information exists:
01.12.2008 12.12.2008 561 d920 m920 536319000 1 PC 100
Now when i am uploading this file using movement type P61 or 561 a same error occurs:
Formatting error in the field MSEG-EXBWR ; see next message
Make an entry in all required fields and this is a required field, its a currency type field but i have even checked it by replacing it into char & num.
Is there any standard upload program for STOCK UPLOAD using MB11? If there is any one who can send me a solution.
thanks in advance.
Regards,
Yahya Shoaib.Hi,
For Stock upload I prefer creation of a program by calling Function Module BAPI_GOODSMVT_CREATE. When you use BAPI, as it is being function module you need not do the recording as well. You can test the BAPI also manually in SE37. This simulation helps in passing the data in the feed file. You may contact your ABAPer for creating a program using this BAPI. You can input the feed file in similar fashion that of BDC -
can u send me the step by step process for a BDC program
i had given a excel sheet with field names and length .....that is to be uploaded
it is material master(MM01)
thanks in advanceHi,
for the bdc upload
step1. go to the Transaction SHDb and create a new recording for the transaction MM01 and save the recording.
step 2: from the same transaction select the recording and go the program.
Note: if you have ur file in presentation server insted of open dataset use gui_upload.
make the needed necessary changes in the coding.
i've attached the sample coding, keep that as reference and do according to your need.
REPORT zmm01_bdc
NO STANDARD PAGE HEADING LINE-SIZE 255.
INCLUDE bdcrecx1.
DATA: dataset(132) TYPE c.
DO NOT CHANGE - the generated data section - DO NOT CHANGE ***
If it is nessesary to change the data section use the rules:
1.) Each definition of a field exists of two lines
2.) The first line shows exactly the comment
'* data element: ' followed with the data element
which describes the field.
If you don't have a data element use the
comment without a data element name
3.) The second line shows the fieldname of the
structure, the fieldname must consist of
a fieldname and optional the character '_' and
three numbers and the field length in brackets
4.) Each field must be type C.
Generated data section with specific formatting - DO NOT CHANGE ***
DATA: BEGIN OF record,
data element: MATNR
matnr_001(018),
data element: MBRSH
mbrsh_002(001),
data element: MTART
mtart_003(004),
data element: XFELD
kzsel_01_004(001),
data element: XFELD
kzsel_02_005(001),
data element: MATNR
matnr_006(018),
data element: MBRSH
mbrsh_007(001),
data element: MTART
mtart_008(004),
data element: XFELD
kzsel_01_009(001),
data element: XFELD
kzsel_02_010(001),
data element: MAKTX
maktx_011(040),
data element: MEINS
meins_012(003),
data element: MATKL
matkl_013(009),
data element: MTPOS_MARA
mtpos_mara_014(004),
data element: MAKTX
maktx_015(040),
END OF record.
DATA l_lines TYPE i .
DATA it_record LIKE TABLE OF record WITH HEADER LINE .
DATA wa_record LIKE record .
End generated data section ***
START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename ='C:\MM01_FILE.TXT'
filetype = 'ASC'
has_field_separator = '#'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = it_record
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
PERFORM open_dataset USING dataset.
PERFORM open_group.
DO.
READ DATASET dataset INTO record.
IF sy-subrc <> 0. EXIT. ENDIF.
LOOP AT it_record INTO wa_record.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0060'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RMMG1-MTART'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RMMG1-MATNR'
record-matnr_001.
PERFORM bdc_field USING 'RMMG1-MBRSH'
record-mbrsh_002.
PERFORM bdc_field USING 'RMMG1-MTART'
record-mtart_003.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0070'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(02)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(01)'
record-kzsel_01_004.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(02)'
record-kzsel_02_005.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0060'.
PERFORM bdc_field USING 'BDC_CURSOR'
'RMMG1-MATNR'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'RMMG1-MATNR'
record-matnr_006.
PERFORM bdc_field USING 'RMMG1-MBRSH'
record-mbrsh_007.
PERFORM bdc_field USING 'RMMG1-MTART'
record-mtart_008.
PERFORM bdc_dynpro USING 'SAPLMGMM' '0070'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MSICHTAUSW-DYTXT(02)'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=ENTR'.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(01)'
record-kzsel_01_009.
PERFORM bdc_field USING 'MSICHTAUSW-KZSEL(02)'
record-kzsel_02_010.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4004'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'MAKT-MAKTX'
record-maktx_011.
PERFORM bdc_field USING 'BDC_CURSOR'
'MARA-MATKL'.
PERFORM bdc_field USING 'MARA-MEINS'
record-meins_012.
PERFORM bdc_field USING 'MARA-MATKL'
record-matkl_013.
PERFORM bdc_field USING 'MARA-MTPOS_MARA'
record-mtpos_mara_014.
PERFORM bdc_dynpro USING 'SAPLMGMM' '4004'.
PERFORM bdc_field USING 'BDC_OKCODE'
'/00'.
PERFORM bdc_field USING 'BDC_CURSOR'
'MAKT-MAKTX'.
PERFORM bdc_field USING 'MAKT-MAKTX'
record-maktx_015.
PERFORM bdc_dynpro USING 'SAPLSPO1' '0300'.
PERFORM bdc_field USING 'BDC_OKCODE'
'=YES'.
PERFORM bdc_transaction USING 'MM01'.
ENDDO.
PERFORM close_group.
PERFORM close_dataset USING dataset. -
Hi,
I am facing a problem in BDC upload for hr master data tcode pa40.
I want to stop bdc after 3 screens and i dont want to processforthe remaining screens.
Can anyone help me onthis?
Thanks in advance.Hi Anil,
I am regret to you becz i could nt tell thanks because i am full busy of my work.
Thanks a lot.
I have checked with your valuable logic. Now I am processing BDC upto two screens.
Regards,
Sreekanth -
BDC Uploading - Organisation structure position error
Hi Gurus,
When we are uploading Master data through BDC its uploading in pa30 but its not updating positions in organization structure (PPOM_OLD - TCODE) . we cant find the holder under the position though we have upload the data and clear see the data in pa30 for that position.
when we are doing Action manually its updating the position. ofcourse its common too.
My question is why its not updaing the holder to the position when we are doing BDC upload
Any thoughts and suggestions.
Regards,
Ravi
Edited by: ravi Kumar on Jun 17, 2010 12:02 PMFirst try this.
1. Execute RHINTE00 for one person
Selection screen
tick CREATE RELATIONSHIPS and CREATE HOLDER RELATIONSHIPS ONLY.
Remove the TEST tick and run.
First try for one person only then you can run it for others.
cheers
Ajay -
hie gurus , can anyone help me , i have created a bdc upload for transaction MFBF repetitive manufacturing backflush
, when i upload a material with multiple production version i get an error , production version for material could not be
determined. initially its supposed to give a pop up window that allows me to select the production version, in the bdc recording so the pop window is not being called in the program for some reason i have not modified the recording
in anyway this is straight from sm35 recording to my z program :
perform bdc_dynpro using 'SAPLBARM' '0800'.
perform bdc_field using 'BDC_OKCODE'
'=GOON'.
perform bdc_field using 'RM61B-RB_BAUGR'
'X'.
perform bdc_field using 'RM61B-BUDAT'
'06.06.2011'.
perform bdc_field using 'RM61B-BLDAT'
'06.06.2011'.
perform bdc_field using 'BDC_CURSOR'
'RM61B-MATNR'.
perform bdc_field using 'RM61B-MATNR'
'900-03-000'.
perform bdc_field using 'RM61B-WERKS'
'1200'.
perform bdc_field using 'RM61B-ERFMG'
'1111'.
error screen not being called
perform bdc_dynpro using 'SAPLBARM' '0160'.
perform bdc_field using 'BDC_CURSOR'
'MKAL-VERID(02)'.
perform bdc_field using 'BDC_OKCODE'
'=GOON'.
perform bdc_field using 'RM61B-SELEK(02)'
'X'.Hi Daniel,
Please check the BAPIs available in Function group 2127 if you can use any. That way you do not have to manipulate the screens in BDC.
Regards,
Shyam -
hi experts.
I am using a BDC-UPLOAD program for MB11 but there is one error during an upload.
Here is a procedure which i am following:
I have created an upload file, which is tab-delimited format. In which such information exists:
01.12.2008 12.12.2008 561 d920 m920 536319000 1 PC 100
Now when i am uploading this file using movement type P61 or 561 a same error occurs:
Formatting error in the field MSEG-EXBWR ; see next message
Make an entry in all required fields and this is a required field, its a currency type field but i have even checked it by replacing it into char & num.
Is there any standard upload program for STOCK UPLOAD using MB11? If there is any one who can send me a solution.
thanks in advance.
Regards,
Yahya Shoaib.OK...I think you have declared the internal table field for that value same as the standard table right??
Now, create a variable with char and then move the value to that char variable and then pass it to the subroutines...
Ex:
loop at itab into wa.
var1 = wa-amount
perform bdc_field using mseg-exwbr var1.
endloop.
Now, I think it will pick up the value.
VIshwa. -
How to send email after bdc upload done?
Hi Experts,
How do we send an email after the bdc upload program run successfully. I want to send email to the users saying the material upload successfully message with the material details.
How can i do it? Is there any way to trigger a mail after calling the bdc upload part?
Please help me on this.
Thanks in advance.
Regards,
Rashika.Hi,
After the BDC has run. check if sy-subrc is zero or not.
IF sy-subrc EQ 0.
COMMIT WORK.
and in this IF statement use the following code:
wa_receivers-receiver = so_malid-low.
wa_receivers-rec_id = so_malid-low.
wa_receivers-rec_type = 'U'.
wa_receivers-com_type = 'INT'.
wa_receivers-notif_del = 'X'.
wa_receivers-notif_ndel = 'X'.
APPEND wa_receivers TO gi_receivers.
CLEAR wa_receivers.
Populate the subject/generic message attributes
wa_doc_data-obj_langu = sy-langu.
wa_doc_data-obj_name = lc_obj_name.
wa_doc_data-obj_descr = 'Find Inactive PU/DU'(001).
wa_doc_data-sensitivty = lc_sensitivity.
Describe the body of the message
wa_message = '<html><head>'.
APPEND wa_message TO gi_messages.
wa_message = '<style type="text/css">'.
APPEND wa_message TO gi_messages.
wa_message = lc_style_content.
APPEND wa_message TO gi_messages.
wa_message = lc_style_content1.
APPEND wa_message TO gi_messages.
wa_message = '</style></head>'.
APPEND wa_message TO gi_messages.
wa_message = '<body>'.
APPEND wa_message TO gi_messages.
wa_message = 'Hi,<BR><BR>'(002).
APPEND wa_message TO gi_messages.
CONCATENATE(' Updation successful')
'.<BR><BR>'
INTO wa_message SEPARATED BY space.
APPEND wa_message TO gi_messages.
DATA: lv_tab_lines TYPE i VALUE 255.
CLEAR gi_packing_list.
REFRESH gi_packing_list.
wa_packing_list-transf_bin = space.
wa_packing_list-head_start = 1.
wa_packing_list-head_num = 0.
wa_packing_list-body_start = 1.
DESCRIBE TABLE gi_messages LINES lv_tab_lines.
READ TABLE gi_messages INDEX lv_tab_lines INTO wa_message.
wa_doc_data-doc_size = ( lv_tab_lines - 1 ) * 255 + STRLEN( wa_message ).
APPEND wa_message TO gi_messages.
DESCRIBE TABLE gi_messages LINES wa_packing_list-body_num.
wa_packing_list-doc_type = 'HTM'.
wa_packing_list-doc_size = lv_tab_lines * 255.
APPEND wa_packing_list TO gi_packing_list.
CLEAR wa_packing_list.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = wa_doc_data
sender_address = gc_sender_address
sender_address_type = gc_sender_address_type
commit_work = 'X'
TABLES
packing_list = gi_packing_list
contents_txt = gi_messages
receivers = gi_receivers.
Regards,
Rajesh Kumar -
Need Navigation about BDC Upload (Diagramitacal way)
Need Navigation about BDC Upload (Diagramitacal way) for easy understand.
Hi
file:///C:/Documents%20and%20Settings/nnelapat/Desktop/New%20Microsoft%20PowerPoint%20Presentation.ppt#259,4,Slide 4
<b>Reward if usefull</b> -
Dear friends,
I need ur help for uploading the BRS datas in FF67 thru BDC object.I've created one object and did some coding.But while recording/executing the object...its recording/taking only one line item of my jtab table items,which i've marked in BOLD below.
FYR...
Pls check below the datas is the example of my flat file and also my Report object.
Pls advise...how to proceed to record on continuous basis of all line items of jtab.
****flat file datas and to upload it to my itab & jtab*****
itab[]
H600024005 252400 2100318499 INR 1 25.04.2008 755365 731681 25.04.2008(1st row of my notepad or excel sheet)
jtab[] (the below or mentioned as second row in my flat file)
in01 2,621 20.04.2008 1211
in01 3,931 21.04.2008 1212
in01 4,083 23.04.2008 1213
in01 7,284 24.04.2008 1214
in01 5,225 25.04.2008 1215
******report program*****
report ZFI_FF67_UPLOAD2
no standard page heading line-size 255.
DATA : BEGIN OF IT_DUMMY OCCURS 0,
DUMMY(300) TYPE C,
END OF IT_DUMMY.
data: var type c.
var = CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.
data: str1(16), str2(18), str3(5), str4(5), str5(10), str6(13), str7(13), str8(10),
str9(12),
str10(4), str11(13), str12(10),
str13(13).
data: begin of itab occurs 0,
bankl(15) type c,
bankn(18) type c,
waers(5) type c,
aznum(5) type c,
azdat(10) type c,
ssald(13) type c,
esald(13) type c,
budtm(10) type c,
mnam1(12) type c,
end of itab.
data: begin of jtab occurs 0,
vgman(4) type c,
kwbtr(13) type c,
valut(10) type c,
check(13) type c,
end of jtab.
include bdcrecx1.
start-of-selection.
CALL FUNCTION 'UPLOAD'
EXPORTING
FILENAME = ' '
FILETYPE = ' '
TABLES
DATA_TAB = IT_DUMMY.
IF SY-SUBRC <> 0.
ENDIF.
break ab5shank.
loop at it_dummy.
str11 str12 str13.
if it_dummy-dummy+0(1) = 'H'.
split it_dummy-dummy at var into : str1 str2 str3 str4 str5 str6 str7 str8 .
itab-bankl = str1+1(15).
move str2 to itab-bankn.
move str3 to itab-waers.
move str4 to itab-aznum.
move str5 to itab-azdat.
move str6 to itab-ssald.
move str7 to itab-esald.
move str8 to itab-budtm.
move str9 to itab-mnam1.
append itab.
else.
split it_dummy-dummy at var into: STR10 str11 str12 str13.
move str10 to jtab-vgman.
move str11 to jtab-kwbtr.
move str12 to jtab-valut.
move str13 to jtab-check.
append jtab.
endif.
endloop.
perform open_group.
loop at itab.
perform bdc_dynpro using 'SAPMF40K' '0102'.
perform bdc_field using 'BDC_CURSOR'
'FEBMKA-MNAM1'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'FEBMKA-BANKL'
itab-bankl.
perform bdc_field using 'FEBMKA-BANKN'
itab-bankn.
perform bdc_field using 'FEBMKA-WAERS'
itab-waers.
perform bdc_field using 'FEBMKA-AZNUM'
itab-aznum.
perform bdc_field using 'FEBMKA-AZDAT'
itab-azdat.
perform bdc_field using 'FEBMKA-SSALD'
itab-ssald.
perform bdc_field using 'FEBMKA-ESALD'
itab-esald.
perform bdc_field using 'FEBMKA-BUDTM'
itab-budtm.
perform bdc_field using 'FEBMKA-NM1VB'
'X'.
perform bdc_field using 'FEBMKA-MNAM1'
itab-mnam1.
loop at jtab.
perform bdc_dynpro using 'SAPMF40K' '8000'.
perform bdc_field using 'BDC_CURSOR'
'FEBMKK-BLDAT(01)'.
perform bdc_dynpro using 'SAPMF40K' '8002'.
perform bdc_field using 'BDC_CURSOR'
'FEBMKK-CHECT_KF(01)'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'FEBMKA-VGMAN(01)'
jtab-vgman.
perform bdc_field using 'FEBMKA-KWBTR(01)'
jtab-kwbtr.
perform bdc_field using 'FEBEP-VALUT(01)'
jtab-valut.
perform bdc_field using 'FEBMKK-CHECT_KF(01)'
jtab-check.
perform bdc_dynpro using 'SAPMF40K' '8000'.
perform bdc_field using 'BDC_CURSOR'
'FEBMKK-BLDAT(01)'.
perform bdc_field using 'BDC_OKCODE'
'=SICH'.
endloop.
perform bdc_dynpro using 'SAPMF40K' '0102'.
perform bdc_field using 'BDC_CURSOR'
'FEBMKA-BANKL'.
perform bdc_field using 'BDC_OKCODE'
'=BACK'.
perform bdc_field using 'FEBMKA-BANKL'
itab-bankl.
perform bdc_field using 'FEBMKA-BANKN'
itab-bankn.
perform bdc_field using 'FEBMKA-WAERS'
itab-waers.
perform bdc_field using 'FEBMKA-AZNUM'
itab-aznum.
perform bdc_field using 'FEBMKA-AZDAT'
itab-azdat.
perform bdc_field using 'FEBMKA-SSALD'
itab-ssald.
perform bdc_field using 'FEBMKA-ESALD'
itab-esald.
perform bdc_field using 'FEBMKA-BUDTM'
itab-budtm.
perform bdc_field using 'FEBMKA-NM1VB'
'X'.
perform bdc_field using 'FEBMKA-MNAM1'
itab-mnam1.
perform bdc_dynpro using 'SAPLSPO1' '0100'.
perform bdc_field using 'BDC_OKCODE'
'=YES'.
perform bdc_dynpro using 'SAPMSSY0' '0120'.
perform bdc_field using 'BDC_OKCODE'
'=PS 85'.
perform bdc_dynpro using 'SAPMSSY0' '0120'.
perform bdc_field using 'BDC_OKCODE'
'=PS 1'.
perform bdc_dynpro using 'SAPMSSY0' '0120'.
perform bdc_field using 'BDC_OKCODE'
'=&F03'.
perform bdc_transaction using 'FF67'.
endloop.
perform close_group.
Pls reply.
thanks & regards
sankar.
Edited by: sankar babu on Apr 28, 2008 3:24 PMHi,
Use:
If line item = 30.
OKCODE = 'P++'. --->For next page after every 30 line items.
endif.
Or:(Sumilate in BDC)
1 . New line. -
>Get the Fcode/Sy-ucomm value of New line(Icon on menu bar)
2.Enter Line Item.
Follow this after every line item.
Hope this resolves the issue.
Regards,
Gurpreet -
Error in bdc uploading for transaction F-02
Hi all,
Iam uploading transactional data for the transaction F-02 using BDC call transaction.
I have recorded all the screens of F-02 and internal table with fields also declared.
While running the program, it is showing the error saying -- " Input value is longer than screen field "
In debugging, Iam getting all the data from flat file into the internal table.
Iam unable to identify where it has gone wrong.
Can anybody look into it.
Thanks and Regards,
Murali Krishna .TModerator message - Please search before asking - post locked
Rob -
Bdc upload file data into internal table problem with gui_upload fm
Hello experts,
my coding is like this ..
data : begin of itab occurs 0 .
field1 like mara-matnr,
field2......
etc,
end of itab.
data: file1 type string.
parameter :file like rlgrap-filename.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR file.
CALL FUNCTION 'KD_GET_FILENAME_ON_F4'
EXPORTING
static = 'X'
mask = space
field_name = 'FILE'
CHANGING
file_name = file.
START-OF-SELECTION.
FILE1 = FILE . "HERE I AM PASSING INTO STRING
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = FILE1
FILETYPE = 'ASC'
has_field_separator = 'X'
TABLES
data_tab = itab. " here the data is not populating from the file , it is giving the error like speified table not found.
HERE i am getting the message like "specified table name not recgonised" . the data is not populating into the itab from the file.
file structure is same as the internal table.
I stored the file as .txt( ie in notepad).
my file is like this..
10000 200 323 sunndarrr.......
i had a problem with this bdc , i am getting like "specified table name not recgonised" in the fm gui_upload while debugging.
when i am using the ws_upload it is working fine.
please guide me where i have done the mistake.
thank you so much for all the replies.Hi,
Have a look on the following code.
TABLES: kna1.
DATA: BEGIN OF itab1 OCCURS 0,
str(255),
END OF itab1.
DATA: itab2 TYPE kna1 OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = 'D:\ABAP EVE\ffile1.txt'
filetype = 'ASC'
TABLES
data_tab = itab1
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
no_authority = 10
OTHERS = 11.
IF sy-subrc <> 0.
WRITE:/ 'sorry'.
ELSE.
LOOP AT itab1.
SPLIT itab1-str AT ',' INTO itab2-kunnr itab2-name1.
APPEND itab2.
ENDLOOP.
IF sy-subrc = 0.
LOOP AT itab2.
WRITE:/ itab2-kunnr,itab2-name1.
INSERT INTO kna1 VALUES itab2.
ENDLOOP.
IF sy-subrc = 0.
WRITE:/ 'inserted'.
ELSE.
WRITE:/ 'not inserted'.
ENDIF.
ELSE.
WRITE:/ 'fail'.
ENDIF.
ENDIF.
Flat file:
10001,Sadney
10003,Yogesh
20005,Madan
1.U need to define internal table with one field of max size
2.upload the flat file data into that internal table
3.split that internal table data into another internal table(having fields)
<REMOVED BY MODERATOR>
thanks,
Chandu
Edited by: Alvaro Tejada Galindo on Apr 30, 2008 12:17 PM
Maybe you are looking for
-
Hello, Does anyone has a code example of table maintenance events? I have a custom table ( zitab ) , with a maintenance view in SM30. I would like to use the table maintenance events for some authorisation check before the data is displayed, then, de
-
The reporting service web service connection pool reached the max pool size
I got a problem that it throw an exception "The timeout peroid elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connection was in use and max pool size was reached." The satuation is our service use 15
-
My laptop has been repaired and for some reason my library on itunes has been wiped. Didn't pay attention and synced my iphone so have lost all the tunes off that now too. Ipad still has all the music on, is there an easy and free way to repopulate i
-
I updated my safari till 7.1.5. After this I cant open safari. Why?
-
Useing Selection listener in table cause some Problems
Hi, i am use jdev 11.1.1.4.0 my use case : i have master/detail table when the end user change data in the detail table then he click Directly to anather record in the master table i need to show alert message ("you must save changes first") and Prev