Application Development 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: 

BDc recording

Former Member
0 Kudos

WE are uploading the data for G/L A/Cs using BDC method , all of the steps are done but recording not possible plz check my coding given suggestion

===========================================================

report ZPR1 no standard page heading line-size 255.

include bdcrecx1.

data: begin of itab occurs 0,

saknr(010),

bukrs(004),

ktoks(004),

txt20_ml(020),

txt50_ml(050),

waers(005),

zuawa(003),

fstag(004),

end of itab.

start-of-selection.

CALL FUNCTION 'UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = 'c:\ritu.prn '

FILETYPE = 'asc '

  • ITEM = ' '

  • FILEMASK_MASK = ' '

  • FILEMASK_TEXT = ' '

  • FILETYPE_NO_CHANGE = ' '

  • FILEMASK_ALL = ' '

  • FILETYPE_NO_SHOW = ' '

  • LINE_EXIT = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • SILENT = 'S'

  • IMPORTING

  • FILESIZE =

  • CANCEL =

  • ACT_FILENAME =

  • ACT_FILETYPE =

TABLES

data_tab = itab.

  • EXCEPTIONS

  • CONVERSION_ERROR = 1

  • INVALID_TABLE_WIDTH = 2

  • INVALID_TYPE = 3

  • NO_BATCH = 4

  • UNKNOWN_ERROR = 5

  • GUI_REFUSE_FILETRANSFER = 6

  • OTHERS = 7

.

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_group.

loop at itab.

perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

perform bdc_field using 'BDC_CURSOR'

'GLACCOUNT_SCREEN_KEY-SAKNR'.

perform bdc_field using 'BDC_OKCODE'

'=ACC_CRE'.

perform bdc_field using 'GLACCOUNT_SCREEN_KEY-SAKNR'

'4400359'.

perform bdc_field using 'GLACCOUNT_SCREEN_KEY-BUKRS'

'7001'.

perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

perform bdc_field using 'BDC_OKCODE'

'=2102_GROUP'.

perform bdc_field using 'BDC_CURSOR'

'GLACCOUNT_SCREEN_COA-KTOKS'.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-KTOKS'

'440'.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-XPLACCT'

'X'.

perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

perform bdc_field using 'BDC_OKCODE'

'=2102_BS_PL'.

perform bdc_field using 'BDC_CURSOR'

'GLACCOUNT_SCREEN_COA-XBILK'.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-KTOKS'

'440'.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-XPLACCT'

''.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-XBILK'

'X'.

perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

perform bdc_field using 'BDC_OKCODE'

'=TAB02'.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-KTOKS'

'440'.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-XBILK'

'X'.

perform bdc_field using 'BDC_CURSOR'

'GLACCOUNT_SCREEN_COA-TXT20_ML'.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-TXT20_ML'

'SS'.

perform bdc_field using 'GLACCOUNT_SCREEN_COA-TXT50_ML'

'AA'.

perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

perform bdc_field using 'BDC_OKCODE'

'=TAB03'.

perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-WAERS'

'INR'.

perform bdc_field using 'BDC_CURSOR'

'GLACCOUNT_SCREEN_CCODE-ZUAWA'.

perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-ZUAWA'

'001'.

perform bdc_dynpro using 'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

perform bdc_field using 'BDC_OKCODE'

'=SAVE'.

perform bdc_field using 'BDC_CURSOR'

'GLACCOUNT_SCREEN_CCODE-FSTAG'.

perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-FSTAG'

'G001'.

perform bdc_transaction using 'FS00'.

endloop.

2 REPLIES 2

Former Member
0 Kudos

Hi,

The same recording you do it through LSMW and you can map the fields.

Enter LSMW transaction and you have an option to do recording.

This ia quite easy.

Regards,

Jack.

Former Member
0 Kudos

Hi

You can use the LSMW with the object '0010' and the program RFBIDE00 for uploading the GL upload using direct input method. or

See the sample code for GL upload

REPORT zfi_gl_fss0

NO STANDARD PAGE HEADING

LINE-SIZE 255.

  • Standard Include for Selection Screen

INCLUDE bdcrecx1.

  • Internal Table for Upload Data

DATA: BEGIN OF i_gl OCCURS 0,

saknr(010), " GL Account

bukrs(004), " Company Code

waers(005), " Currency

xsalh(001), " BAl Local Curr Ind

mwskz(002), " Tax Category

  • xopvw(001), " Open Item Ind

  • xkres(001), " Line Item Ind

zuawa(003), " Sort Key

fstag(004), " Field Category

END OF i_gl.

  • Data Variables & Constants

CONSTANTS : c_x VALUE 'X', " Flag

c_tax VALUE '0'. " Tax Category

  • Parameters

PARAMETERS: p_file LIKE ibipparms-path. " Filename

  • At selection-screen on Value Request for file Name

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

  • Get the F4 Values for the File

CALL FUNCTION 'F4_FILENAME'

EXPORTING

program_name = syst-cprog

dynpro_number = syst-dynnr

IMPORTING

file_name = p_file.

  • Start of Selection

START-OF-SELECTION.

  • Open the BDC Session

PERFORM open_group.

  • Upload the File into internal Table

CALL FUNCTION 'UPLOAD'

EXPORTING

filename = p_file

filetype = 'DAT'

TABLES

data_tab = i_gl

EXCEPTIONS

conversion_error = 1

invalid_table_width = 2

invalid_type = 3

no_batch = 4

unknown_error = 5

gui_refuse_filetransfer = 6

OTHERS = 7.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • Upload the Data from Internal Table

LOOP AT i_gl.

  • Initial Screen

PERFORM bdc_dynpro USING 'SAPLGL_ACCOUNT_MASTER_MAINTAIN'

'2001'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=ACC_CRE'.

PERFORM bdc_field USING 'BDC_CURSOR'

'GLACCOUNT_SCREEN_KEY-SAKNR'.

PERFORM bdc_field USING 'GLACCOUNT_SCREEN_KEY-SAKNR'

i_gl-saknr.

PERFORM bdc_field USING 'GLACCOUNT_SCREEN_KEY-BUKRS'

i_gl-bukrs.

perform bdc_dynpro using

'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

perform bdc_field using 'BDC_OKCODE'

'=TAB02'.

perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-WAERS'

i_gl-WAERS.

perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-XSALH'

i_gl-XSALH.

perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-MWSKZ'

i_gl-MWSKZ.

perform bdc_field using 'BDC_CURSOR'

'GLACCOUNT_SCREEN_CCODE-ZUAWA'.

  • perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-XOPVW'

  • i_gl-XOPVW.

perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-XKRES'

c_x."i_gl-XKRES.

perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-ZUAWA'

i_gl-ZUAWA.

perform bdc_dynpro using

'SAPLGL_ACCOUNT_MASTER_MAINTAIN' '2001'.

perform bdc_field using 'BDC_OKCODE'

'=SAVE'.

perform bdc_field using 'BDC_CURSOR'

'GLACCOUNT_SCREEN_CCODE-FSTAG'.

perform bdc_field using 'GLACCOUNT_SCREEN_CCODE-FSTAG'

i_gl-FSTAG.

  • Call The Transaction

PERFORM bdc_transaction USING 'FSS0'.

ENDLOOP.

  • Close the BDC Session

PERFORM close_group.

Reward points for useful Answers

Regards

Anji

Message was edited by:

Anji Reddy Vangala