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

Reg.Bdc

Former Member
0 Likes
525

Hi Experts,

Iam doing one bdc program for the transaction LT06. TO upload the document numbers.My problem is i recorded the lt06 t.code and i written the program also.while running the session it is going to the

LT05 T.code. so it is showing error . how to rectify this problem?.

Rewards are helpful answers.

Thanks & Regards,

Narasimha Rao.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
487

Hi,

can you check it in your code where passing the Tcode into BDC_insert function module....or call transaction function module plz checkit once..

otherwise...plz put the code once then i can give better suggestion.

regards,

venkat n

3 REPLIES 3
Read only

Former Member
0 Likes
488

Hi,

can you check it in your code where passing the Tcode into BDC_insert function module....or call transaction function module plz checkit once..

otherwise...plz put the code once then i can give better suggestion.

regards,

venkat n

Read only

0 Likes
487

hi ,

iam sending my code please check it once again, and send solution to me.

report ZAN_TAJLOC_LT06

no standard page heading line-size 255.

data: begin of record occurs 0,

MBLNR_001(010),

MJAHR_002(004),

LGNUM_003(003),

  • DUNKL_004(001),

NLTYP_005(003),

NLBER_006(003),

NLPLA_007(010),

end of record.

*.... Declaring BDC data structure.

DATA: bdcdata TYPE TABLE OF bdcdata WITH HEADER LINE,

*... Internal table for sorting flat file

itab(200) OCCURS 0 WITH HEADER LINE.

...........................................................

  • SELECTION-SCREEN *

...........................................................

SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

Parameters : filename like rlgrap-filename OBLIGATORY,

p_ses LIKE apqi-groupid OBLIGATORY.

SELECTION-SCREEN END OF BLOCK B1.

............................................................

  • SELECTION SCREEN FOR VALUE REQUEST *

............................................................

AT SELECTION-SCREEN ON VALUE-REQUEST FOR filename.

*..Information message.

MESSAGE i000(zmsg2) WITH 'Please select .csv file only'.

*....Form declaraton for getting .csv file

perform get_flatfile.

............................................................

  • Start of selection *

............................................................

start-of-selection.

*...form declaration for uploading the flat file

PERFORM it_upload.

*...form declaration for converting CSV file format into sap structure.

PERFORM mapping.

*...form declaration for open BDC session.

perform open_group.

*....processing the file data into SAP data.

loop at record. " loop begining

clear bdcdata. " clear bdcdata

refresh bdcdata.

        • End generated data section ***

*

*start-of-selection.

*

*perform open_dataset using dataset.

*perform open_group.

*

*do.

*

*read dataset dataset into record.

*if sy-subrc <> 0. exit. endif.

perform bdc_dynpro using 'SAPML02B' '0203'.

perform bdc_field using 'BDC_CURSOR'

'RL02B-LGNUM'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RL02B-MBLNR'

record-MBLNR_001.

perform bdc_field using 'RL02B-MJAHR'

record-MJAHR_002.

perform bdc_field using 'RL02B-LGNUM'

record-LGNUM_003.

*perform bdc_field using 'RL02B-DUNKL'

  • record-DUNKL_004.

perform bdc_dynpro using 'SAPML03T' '0102'.

perform bdc_field using 'LTAP-NLTYP'

record-NLTYP_005.

perform bdc_field using 'LTAP-NLBER'

record-NLBER_006.

perform bdc_field using 'LTAP-NLPLA'

record-NLPLA_007.

perform bdc_transaction using 'LT06'.

*enddo.

endloop.

perform close_group.

*perform close_dataset using dataset.

....................................................................

  • ROUTINES *

....................................................................

&----


*& Form GET_FLATFILE

&----


  • Form declaraton for getting .csv file

----


form GET_FLATFILE .

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

  • DEF_FILENAME = ' '

DEF_PATH = 'C:\ '

MASK = '.,..'

  • MODE = ' '

  • TITLE = ' '

  • IMPORTING

FILENAME = filename

  • RC =

EXCEPTIONS

INV_WINSYS = 1

NO_BATCH = 2

SELECTION_CANCEL = 3

SELECTION_ERROR = 4

OTHERS = 5

.

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. " GET_FLATFILE

&----


*& Form IT_UPLOAD

&----


  • form declaration for uploading the flat file

----


form IT_UPLOAD .

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = filename

FILETYPE = 'ASC'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • DAT_D_FORMAT = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = itab

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.

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

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

ENDIF.

endform. " IT_UPLOAD

&----


*& Form OPEN_GROUP

&----


  • orm declaration for open BDC session

----


form OPEN_GROUP .

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

  • DEST = FILLER8

GROUP = p_ses

  • HOLDDATE = FILLER8

KEEP = 'X'

USER = sy-uname

  • RECORD = FILLER1

  • PROG = SY-CPROG

  • DCPFM = '%'

  • DATFM = '%'

  • IMPORTING

  • QID =

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. " OPEN_GROUP

&----


*& Form BDC_TRANSACTION

&----


  • Form Definition for inserting the data into session

----


form BDC_TRANSACTION using tcode.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = tcode

  • POST_LOCAL = NOVBLOCAL

  • PRINTING = NOPRINT

  • SIMUBATCH = ' '

  • CTUPARAMS = ' '

TABLES

dynprotab = bdcdata

EXCEPTIONS

INTERNAL_ERROR = 1

NOT_OPEN = 2

QUEUE_ERROR = 3

TCODE_INVALID = 4

PRINTING_INVALID = 5

POSTING_INVALID = 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.

endform. " BDC_TRANSACTION

&----


*& Form CLOSE_GROUP

&----


  • Form Defintion for Closing the Session

----


form 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. " CLOSE_GROUP

&----


*& Form BDC_DYNPRO

&----


  • Form Defintion for Dynpro

----


form BDC_DYNPRO using program dynpro.

CLEAR bdcdata.

bdcdata-program = program.

bdcdata-dynpro = dynpro.

bdcdata-dynbegin = 'X'.

APPEND bdcdata.

endform. " BDC_DYNPRO

&----


*& Form BDC_FIELD

&----


  • Form defintion for BDC Fields

----


form BDC_FIELD using fnam fval.

CLEAR bdcdata.

bdcdata-fnam = fnam.

bdcdata-fval = fval.

APPEND bdcdata.

endform. " BDC_FIELD

&----


*& Form MAPPING

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form MAPPING .

loop at itab.

split itab at ',' into record-MBLNR_001

record-MJAHR_002

record-LGNUM_003

record-NLTYP_005

record-NLBER_006

record-NLPLA_007.

append record.

clear record.

endloop.

endform. " MAPPING

Thanks & Regards,

Narasimha Rao.

Read only

0 Likes
487

What error you are getting ???

Ranjith.