Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

urgent plz BDC

hi gurus,

i have a problem in bdc programm there is 3 screen using transaction f-27

there is two amount field as(wrbtr,wrbtr2)

two screen are run fine but the 3 screen does't take data automatically from flat file plz help me its urgent see my codes and give me solution.

TYPES: BEGIN OF it_output,

bldat(10) TYPE C, "Document Date

blart TYPE bkpf-blart, "Document Type

bukrs TYPE bkpf-bukrs, "Company Code

budat(10) TYPE C, "Posting Date

monat TYPE bkpf-monat, "Period

waers TYPE bkpf-waers, "Currency

xblnr TYPE bkpf-xblnr, "Reference Field

docid TYPE fs006-docid, "Document ID

newbs TYPE rf05a-newbs, "Posting Key

newko TYPE rf05a-newko, "Account Code

wrbtr(16) TYPE C, "Amount in Document currency

zfbdt(10) TYPE C, "Baseline Date

newbs2 TYPE rf05a-newbs, "Account Key2

newko2 TYPE rf05a-newko, "Account code2

wrbtr2(16) TYPE C, "Amount2

END OF it_output.

DATA lt_output TYPE it_output OCCURS 0 WITH HEADER LINE.

DATA it_bdc LIKE bdcdata OCCURS 0 WITH HEADER LINE.

DATA it_messtab LIKE bdcmsgcoll OCCURS 1 WITH HEADER LINE.

************************************************************************

  • D A T A *

************************************************************************

DATA: message TYPE string.

DATA: p_file1 type string.

************************************************************************

  • S E L E C T - O P T I O N S / P A R A M E T E R S *

************************************************************************

SELECTION-SCREEN BEGIN OF BLOCK block0 WITH FRAME.

PARAMETERS : p_file LIKE rlgrap-filename OBLIGATORY.

SELECTION-SCREEN END OF BLOCK block0.

************************************************************************

  • A T S E L E C T I O N - S C R E E N *

************************************************************************

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

CALL FUNCTION 'KD_GET_FILENAME_ON_F4'

EXPORTING

static = 'X'

mask = space

CHANGING

file_name = p_file.

************************************************************************

  • S T A R T - O F - S E L E C T I O N

*

************************************************************************

START-OF-SELECTION.

PERFORM upload.

PERFORM bdc.

PERFORM write_message.

&----


*& Form bdc

&----


  • text

----


FORM bdc.

LOOP AT lt_output.

READ TABLE lt_output INDEX 1.

PERFORM bdc_dynpro USING 'SAPMF05A' '0100'.

PERFORM bdc_field USING 'BDC_CURSOR' 'RF05A-NEWKO'.

PERFORM bdc_field USING 'BDC_OKCODE' '/00'.

PERFORM bdc_field USING 'BKPF-BLDAT' lt_output-bldat.

PERFORM bdc_field USING 'BKPF-BLART' lt_output-blart.

PERFORM bdc_field USING 'BKPF-BUKRS' lt_output-bukrs.

PERFORM bdc_field USING 'BKPF-BUDAT' lt_output-budat.

PERFORM bdc_field USING 'BKPF-MONAT' lt_output-monat.

PERFORM bdc_field USING 'BKPF-WAERS' lt_output-waers.

PERFORM bdc_field USING 'BKPF-XBLNR' lt_output-xblnr.

PERFORM bdc_field USING 'FS006-DOCID' lt_output-docid.

PERFORM bdc_field USING 'RF05A-NEWBS' lt_output-newbs.

PERFORM bdc_field USING 'RF05A-NEWKO' lt_output-newko.

PERFORM bdc_dynpro USING 'SAPMF05A' '0302'.

PERFORM bdc_field USING 'BDC_CURSOR' 'RF05A-NEWKO'.

PERFORM bdc_field USING 'BDC_OKCODE' '/00'.

PERFORM bdc_field USING 'BSEG-WRBTR' lt_output-wrbtr.

PERFORM bdc_field USING 'BSEG-ZFBDT' lt_output-zfbdt.

PERFORM bdc_field USING 'RF05A-NEWBS' lt_output-newbs2."newbs2

PERFORM bdc_field USING 'RF05A-NEWKO' lt_output-newko2."newko2

PERFORM bdc_dynpro USING 'SAPMF05A' '0301'.

PERFORM bdc_field USING 'BDC_CURSOR' 'BSEG-WRBTR'.

PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.

PERFORM bdc_field USING 'BSEG-WRBTR' lt_output-wrbtr2."wrbtr2

  • PERFORM bdc_field USING 'BSEG-MWSKZ' '**'.

  • PERFORM bdc_field USING 'BSEG-ZTERM' 'C007'.

  • PERFORM bdc_field USING 'BSEG-ZBD1T' '7'.

CALL TRANSACTION 'F-27' USING it_bdc mode 'A'

MESSAGES INTO it_messtab.

CLEAR it_bdc. REFRESH it_bdc.

ENDLOOP.

ENDFORM. "bdc

&----


*& Form write_message

&----


  • text

----


FORM write_message.

LOOP AT it_messtab .

CLEAR message.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = sy-msgid

lang = 'EN'

no = sy-msgno

v1 = sy-msgv1

v2 = sy-msgv2

v3 = sy-msgv3

v4 = sy-msgv4

IMPORTING

msg = message.

CASE it_messtab-msgtyp.

WHEN 'S'.

WRITE:/ message.

CLEAR message.

WHEN 'E'.

FORMAT COLOR 6 ON.

WRITE:/ message.

CLEAR message.

ENDCASE.

ENDLOOP.

ENDFORM. "write_message

----


  • FORM BDC_DYNPRO *

----


  • ........ *

----


  • --> PROGRAM *

  • --> DYNPRO *

----


FORM bdc_dynpro USING program dynpro.

it_bdc-program = program.

it_bdc-dynpro = dynpro.

it_bdc-dynbegin = 'X'.

APPEND it_bdc.

CLEAR it_bdc.

ENDFORM. "BDC_DYNPRO

----


  • FORM *

----


  • ........ *

----


FORM bdc_field USING fnam fval.

it_bdc-fnam = fnam.

it_bdc-fval = fval.

APPEND it_bdc.

CLEAR it_bdc.

ENDFORM. "BDC_FIELD

&----


*& Form upload

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM upload .

p_file1 = p_file.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = p_file1

FILETYPE = 'DAT'

tables

data_tab = lt_output

  • 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. " upload

i am also send u my flat file the client says that in amount filed of 3rd screen we will give the * asterick or other amount plz take it.

thank

plz help me.

jay

Edited by: jayant kumar on Apr 30, 2008 12:42 PM

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question