Skip to Content
0
Former Member
May 20, 2008 at 04:51 AM

out put problem in call transaction f-27

17 Views

hi,

i am get a problem in my call transaction programm that it will print success and error of programm 2 times but i want it only one time as the call transaction is executed i send my code to u plz help me.

o/p as

Document 1600000833 was posted in company code 8601

Document 1600000833 was posted in company code 8601

Document 1600000834 was posted in company code 8601

Document 1600000834 was posted in company code 8601

Document 1600000835 was posted in company code 8601

Document 1600000835 was posted in company code 8601

on screen when transaction executed

START-OF-SELECTION.

PERFORM upload USING p_file.

IF p_back EQ c_x.

PERFORM bdc.

ELSEIF p_onli EQ c_x.

PERFORM bdc.

ENDIF.

&----


*& Form bdc

&----


  • text

----


FORM bdc.

LOOP AT lt_output.

v_index = sy-tabix.

REFRESH i_bdcdata.

CLEAR i_bdcdata.

READ TABLE lt_output INDEX 1.

PERFORM bdc_dynpro USING 'SAPMF05A' '0100' c_x.

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' c_x.

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.

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

PERFORM bdc_dynpro USING 'SAPMF05A' '0301' c_x.

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

PERFORM bdc_field USING 'BDC_OKCODE' '=BU'.

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

PERFORM f_call_transaction.

ENDLOOP.

ENDFORM. "bdc

----


  • FORM BDC_DYNPRO *

----


  • ........ *

----


  • --> PROGRAM *

  • --> DYNPRO *

----


FORM bdc_dynpro USING program dynpro dynbegin.

i_bdcdata-program = program.

i_bdcdata-dynpro = dynpro.

i_bdcdata-dynbegin = dynbegin.

APPEND i_bdcdata.

CLEAR i_bdcdata.

ENDFORM. "BDC_DYNPRO

----


  • FORM *

----


  • ........ *

----


FORM bdc_field USING fnam fval.

i_bdcdata-fnam = fnam.

i_bdcdata-fval = fval.

APPEND i_bdcdata.

CLEAR i_bdcdata.

ENDFORM. "BDC_FIELD

&----


*& Form upload

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM upload USING p_filename.

DATA: p_file1 TYPE string.

p_file1 = p_file.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = p_file1

filetype = 'DAT'

TABLES

data_tab = lt_output.

ENDFORM. " upload

----


  • FORM F_CALL_TRANSACTION *

----


  • This subroutine executes the F-27 BDC transaction *

----


FORM f_call_transaction.

REFRESH it_messtab.

IF p_back EQ c_x.

  • Execute the BDC transaction in background mode

CALL TRANSACTION c_f27 USING i_bdcdata

MODE c_n

MESSAGES INTO it_messtab.

*Get the BDC error messages

PERFORM f_error_handling USING it_messtab-msgid

it_messtab-msgnr

it_messtab-msgv1

it_messtab-msgv2

it_messtab-msgv3

it_messtab-msgv4.

ELSEIF p_onli EQ c_x.

  • Execute the BDC transaction in online mode

CALL TRANSACTION c_f27 USING i_bdcdata

MODE c_a

MESSAGES INTO it_messtab.

*Get the BDC error messages

PERFORM f_error_handling USING it_messtab-msgid

it_messtab-msgnr

it_messtab-msgv1

it_messtab-msgv2

it_messtab-msgv3

it_messtab-msgv4.

ENDIF.

ENDFORM. " f_call_transaction

*----


  • FORM f_error_handling

*

*----


  • This subroutine populates the BDC table

*

*----


FORM f_error_handling USING it_messtab-msgid

it_messtab-msgnr

it_messtab-msgv1

it_messtab-msgv2

it_messtab-msgv3

it_messtab-msgv4.

  • Get the BDC error messages

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

plz send me the solution i will give points its urgent.

thanks

jayant