Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Update program for BDC-FBCJ

Former Member
0 Likes
834

HI Guru's,

Iam new to abap.. i created bdc recording using with T.Code: SHDB.. i want to create flat file upload programm for following bdc recording.. any can help me to create programm...

report ZTESTFBCJ

no standard page heading line-size 255.

include bdcrecx1.

start-of-selection.

perform open_group.

perform bdc_dynpro using 'SAPMFCJ0' '0100'.

perform bdc_field using 'BDC_OKCODE'

'=CHCJ'.

perform bdc_field using 'F_DISPLAY_PERIOD_LO'

'03.11.2008'.

perform bdc_field using 'F_DISPLAY_PERIOD_HI'

'03.11.2008'.

perform bdc_field using 'BDC_CURSOR'

'ISCJ_E_POSTINGS-TRANSACT_NAME(02)'.

perform bdc_dynpro using 'SAPMFCJ0' '0050'.

perform bdc_field using 'BDC_CURSOR'

'TCJ_C_JOURNALS-CAJO_NUMBER'.

perform bdc_field using 'BDC_OKCODE'

'=OK50'.

perform bdc_field using 'TCJ_C_JOURNALS-COMP_CODE'

'a1sg'.

perform bdc_field using 'TCJ_C_JOURNALS-CAJO_NUMBER'

'a500'.

perform bdc_dynpro using 'SAPMFCJ0' '0100'.

perform bdc_field using 'BDC_OKCODE'

'=POST'.

perform bdc_field using 'F_DISPLAY_PERIOD_LO'

'03.11.2008'.

perform bdc_field using 'F_DISPLAY_PERIOD_HI'

'03.11.2008'.

perform bdc_field using 'BDC_CURSOR'

'ISCJ_E_POSTINGS-TRANSACT_NAME(02)'.

perform bdc_field using 'ISCJ_E_POSTINGS-TRANSACT_NAME(02)'

'postage'.

perform bdc_field using 'ISCJ_E_POSTINGS-H_PAYMENTS(02)'

' 10'.

perform bdc_field using 'ISCJ_E_POSTINGS-TAX_CODE(02)'

'p5'.

perform bdc_field using 'ISCJ_E_POSTINGS-POSITION_TEXT(02)'

'test'.

perform bdc_field using 'ISCJ_E_POSTINGS-POSTING_DATE(02)'

'03.11.2008'.

perform bdc_field using 'ISCJ_E_POSTINGS-DOCUMENT_DATE(02)'

'03.11.2008'.

perform bdc_field using 'ISCJ_E_POSTINGS-DOCUMENT_NUMBER(02)'

'test'.

perform bdc_field using 'ISCJ_E_POSTINGS-KOSTL(02)'

'a3070020'.

perform bdc_field using 'F_LINE_SEL(02)'

'X'.

perform bdc_transaction using 'FBCJ'.

regards

JK

4 REPLIES 4
Read only

Former Member
0 Likes
644

Hello,

For the Tcode FBCJ you enter the values manually in one sequence order then you take that value in the same order, create the flat file with values you have entered with separation of , or ;.

1: After creating the flat file.

2: Take the flat file data into the internal table to the flat file to the interanal table you use the Function module GUI_UPLOAD.

3:If the file data is in the internal table then move the value to the particular field in you below mention code.

Read only

0 Likes
644

HI,

I created following code but unable to select file from input.. its showing error.. kinely help me ...

report ZTESTFBCJ

no standard page heading line-size 255.

Tables : TCJ_C_JOURNALS , ISCJ_E_POSTINGS.

data: begin of bdcdata occurs 0,

COMP_CODE TYPE TCJ_C_JOURNALS-COMP_CODE,

CAJO_NUMBER TYPE TCJ_C_JOURNALS-CAJO_NUMBER,

TRANSACT_NAME TYPE ISCJ_E_POSTINGS-TRANSACT_NAME,

H_PAYMENTS TYPE ISCJ_E_POSTINGS-H_PAYMENTS,

TAX_CODE TYPE ISCJ_E_POSTINGS-TAX_CODE,

POSITION_TEXT TYPE ISCJ_E_POSTINGS-POSITION_TEXT,

DOCUMENT_NUMBER TYPE ISCJ_E_POSTINGS-DOCUMENT_NUMBER,

POSTING_DATE TYPE ISCJ_E_POSTINGS-POSTING_DATE,

DOCUMENT_DATE TYPE ISCJ_E_POSTINGS-DOCUMENT_DATE,

KOSTL TYPE ISCJ_E_POSTINGS-KOSTL,

end of bdcdata.

data : it_bdcdata type standard table of bdcdata.

data : wa_bdcdata type bdcdata.

SELECTION-SCREEN : BEGIN OF BLOCK blk WITH FRAME TITLE text.

PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.

SELECTION-SCREEN : END OF BLOCK blk.

start-of-selection.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = P_file

FLETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

tables

data_tab = it_bdcdata

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.

loop at it_bdcdata into wa_bdcdata.

*replace all the values entered during the recording with corresponding

*Wrk area fields.

perform bdc_dynpro using 'SAPMFCJ0' '0100'.

perform bdc_field using 'BDC_OKCODE'

' =CHCJ'.

perform bdc_field using 'F_DISPLAY_PERIOD_LO'

'03.11.2008'.

perform bdc_field using 'F_DISPLAY_PERIOD_HI'

'03.11.2008'.

perform bdc_field using 'BDC_CURSOR'

'ISCJ_E_POSTINGS-TRANSACT_NAME(02)'.

perform bdc_dynpro using 'SAPMFCJ0' '0050'.

perform bdc_field using 'BDC_CURSOR'

'TCJ_C_JOURNALS-CAJO_NUMBER'.

perform bdc_field using 'BDC_OKCODE'

'=OK50'.

perform bdc_field using 'TCJ_C_JOURNALS-COMP_CODE'

'a1sg'.

perform bdc_field using 'TCJ_C_JOURNALS-CAJO_NUMBER'

'a500'.

perform bdc_dynpro using 'SAPMFCJ0' '0100'.

perform bdc_field using 'BDC_OKCODE'

'=POST'.

perform bdc_field using 'F_DISPLAY_PERIOD_LO'

'03.11.2008'.

perform bdc_field using 'F_DISPLAY_PERIOD_HI'

'03.11.2008'.

perform bdc_field using 'BDC_CURSOR'

'ISCJ_E_POSTINGS-TRANSACT_NAME(02)'.

perform bdc_field using 'ISCJ_E_POSTINGS-TRANSACT_NAME(02)'

'postage'.

perform bdc_field using 'ISCJ_E_POSTINGS-H_PAYMENTS(02)'

' 10'.

perform bdc_field using 'ISCJ_E_POSTINGS-TAX_CODE(02)'

'p5'.

perform bdc_field using 'ISCJ_E_POSTINGS-POSITION_TEXT(02)'

'test'.

perform bdc_field using 'ISCJ_E_POSTINGS-POSTING_DATE(02)'

'03.11.2008'.

perform bdc_field using 'ISCJ_E_POSTINGS-DOCUMENT_DATE(02)'

'03.11.2008'.

perform bdc_field using 'ISCJ_E_POSTINGS-DOCUMENT_NUMBER(02)'

'test'.

perform bdc_field using 'ISCJ_E_POSTINGS-KOSTL(02)'

'a3070020'.

perform bdc_field using 'F_LINE_SEL(02)'

'X'.

endloop.

call transaction 'FBCJ' using it_BDCDATA.

*----


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR wa_BDCDATA.

wa_BDCDATA-PROGRAM = PROGRAM.

wa_BDCDATA-DYNPRO = DYNPRO.

wa_BDCDATA-DYNBEGIN = 'X'.

APPEND wa_BDCDATA to it_bdcdata.

ENDFORM.

*----


*Insert field

*----


FORM BDC_FIELD USING FNAM FVAL.

CLEAR wa_BDCDATA.

wa_BDCDATA-FNAM = FNAM.

wa_BDCDATA-FVAL = FVAL.

APPEND wa_BDCDATA to it_bdcdata.

regardsJK

Read only

Former Member
0 Likes
644

Hi,

Proceed with the declaration of of structure, Internal tables and work area declarations for the defined structure and for holding error messages.

At selection screen call your flat file, using F4_FILENAME. Read your flat file using ALSM_EXCEL_TO_INTERNAL_TABLE if you flat file is excel else use GUI_UPLOAD for note pad.

Loop your records and call transaction.

Actually many examples are present in the forum.

Check for the sample example or else revert me back what is your issue by which i can help you. Take care of decimal places where there will be lot of issues while you prepare your flat file its just a caution.

Cheers!!

VEnk@

Read only

Former Member
0 Likes
644

answered