Skip to Content
author's profile photo Former Member
Former Member

bdc

This is lalitha

in the below prg no msg is displayed in the output

REPORT ZSONU_BDC .

DATA : K TYPE STRING,

TEMP TYPE STRING.

DATA : BEGIN OF ITAB OCCURS 1 ,

ID(1) TYPE C,

LIFNR LIKE RF02K-LIFNR,

BUKRS LIKE RF02K-BUKRS,

EKORG LIKE RF02K-EKORG,

KTOKK LIKE RF02K-KTOKK,

NAME1 LIKE LFA1-NAME1,

SORTL LIKE LFA1-SORTL,

LAND1 LIKE LFA1-LAND1,

AKONT LIKE LFB1-AKONT,

FDGRV LIKE LFB1-FDGRV,

WAERS LIKE LFM1-WAERS,

END OF ITAB,

BEGIN OF JTAB OCCURS 1 ,

ID(1) TYPE C ,

BANKS LIKE LFBK-BANKS,

BANKL LIKE LFBK-BANKL,

BANKN LIKE LFBK-BANKN,

END OF JTAB.

DATA: FNAME1 TYPE STRING,

FNAME2 TYPE STRING.

DATA: I_BDCMSGCOLL LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

DATA: I_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE .

PARAMETERS : P_FILE LIKE RLGRAP-FILENAME,

P_FILE1 LIKE RLGRAP-FILENAME.

AT selection-screen ON VALUE-REQUEST FOR P_FILE .

CALL FUNCTION 'F4_FILENAME'

  • EXPORTING

  • PROGRAM_NAME = SYST-CPROG

  • DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = ' '

IMPORTING

FILE_NAME = P_FILE

.

AT selection-screen ON VALUE-REQUEST FOR P_FILE1 .

CALL FUNCTION 'F4_FILENAME'

  • EXPORTING

  • PROGRAM_NAME = SYST-CPROG

  • DYNPRO_NUMBER = SYST-DYNNR

  • FIELD_NAME = ' '

IMPORTING

FILE_NAME = P_FILE1

.

MOVE P_FILE TO FNAME1.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = FNAME1

  • FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = ITAB

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

MOVE P_FILE1 TO FNAME2 .

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = FNAME2

  • FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • IMPORTING

  • FILELENGTH =

  • HEADER =

TABLES

DATA_TAB = JTAB

  • 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 ITAB .

REFRESH I_BDCDATA.

perform bdc_dynpro using 'SAPMF02K' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RF02K-KTOKK'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RF02K-LIFNR'

ITAB-LIFNR.

perform bdc_field using 'RF02K-BUKRS'

ITAB-BUKRS.

perform bdc_field using 'RF02K-EKORG'

ITAB-EKORG.

perform bdc_field using 'RF02K-KTOKK'

ITAB-KTOKK.

perform bdc_dynpro using 'SAPMF02K' '0110'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-LAND1'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'LFA1-NAME1'

ITAB-NAME1.

perform bdc_field using 'LFA1-SORTL'

ITAB-SORTL.

perform bdc_field using 'LFA1-LAND1'

ITAB-LAND1.

perform bdc_dynpro using 'SAPMF02K' '0120'.

perform bdc_field using 'BDC_CURSOR'

'LFA1-KUNNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

K = '1' .

LOOP AT JTAB WHERE ID = ITAB-ID .

perform bdc_dynpro using 'SAPMF02K' '0130'.

perform bdc_field using 'BDC_CURSOR'

'LFBK-BANKN(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

CLEAR TEMP .

CONCATENATE 'LFBK-BANKS(' K ')' INTO TEMP .

perform bdc_field using TEMP

JTAB-BANKS.

CLEAR TEMP .

CONCATENATE 'LFBK-BANKL(' K ')' INTO TEMP .

perform bdc_field using TEMP

JTAB-BANKL.

CLEAR TEMP .

CONCATENATE 'LFBK-BANKN(' K ')' INTO TEMP .

perform bdc_field using TEMP

JTAB-BANKN.

K = K + 1 .

IF K > 5 .

perform bdc_field using 'BDC_OKCODE'

'=P+'.

K = '1'.

ENDIF .

ENDLOOP.

*perform bdc_dynpro using 'SAPMF02K' '0130'.

*perform bdc_field using 'BDC_CURSOR'

  • 'LFBK-BANKN(02)'.

*perform bdc_field using 'BDC_OKCODE'

  • '=ENTR'.

*perform bdc_field using 'LFBK-BANKS(02)'

  • 'IN'.

*perform bdc_field using 'LFBK-BANKL(02)'

  • 'SBH'.

*perform bdc_field using 'LFBK-BANKN(02)'

  • '0000004567'.

perform bdc_dynpro using 'SAPMF02K' '0130'.

perform bdc_field using 'BDC_CURSOR'

'LFBK-BANKS(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_dynpro using 'SAPMF02K' '0210'.

perform bdc_field using 'BDC_CURSOR'

'LFB1-FDGRV'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'LFB1-AKONT'

ITAB-AKONT.

perform bdc_field using 'LFB1-FDGRV'

ITAB-FDGRV.

perform bdc_dynpro using 'SAPMF02K' '0215'.

perform bdc_field using 'BDC_CURSOR'

'LFB1-ZTERM'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPMF02K' '0220'.

perform bdc_field using 'BDC_CURSOR'

'LFB5-MAHNA'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_dynpro using 'SAPMF02K' '0310'.

perform bdc_field using 'BDC_CURSOR'

'LFM1-WAERS'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'LFM1-WAERS'

ITAB-WAERS.

perform bdc_dynpro using 'SAPMF02K' '0320'.

perform bdc_field using 'BDC_CURSOR'

'RF02K-LIFNR'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_dynpro using 'SAPLSPO1' '0300'.

perform bdc_field using 'BDC_OKCODE'

'=YES'.

CALL TRANSACTION 'XK01' USING I_BDCDATA MODE 'A' MESSAGES INTO

I_BDCMSGCOLL.

ENDLOOP .

DATA: W_MSG TYPE C..

LOOP AT I_BDCMSGCOLL.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = I_BDCMSGCOLL-MSGID

LANG = SY-LANGU

NO = i_bdcmsgcoll-msgnr

V1 = I_BDCMSGCOLL-MSGV1

V2 = I_BDCMSGCOLL-MSGV2

V3 = I_BDCMSGCOLL-MSGV3

V4 = I_BDCMSGCOLL-MSGV4

IMPORTING

MSG = W_MSG.

  • EXCEPTIONS

  • NOT_FOUND = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

WRITE : / W_MSG.

ENDLOOP.

----


  • Start new screen *

----


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR I_BDCDATA.

I_BDCDATA-PROGRAM = PROGRAM.

i_BDCDATA-DYNPRO = DYNPRO.

I_BDCDATA-DYNBEGIN = 'X'.

APPEND I_BDCDATA.

ENDFORM.

----


  • Insert field *

----


FORM BDC_FIELD USING FNAM FVAL.

IF FVAL <> SPACE.

CLEAR I_BDCDATA.

I_BDCDATA-FNAM = FNAM.

I_BDCDATA-FVAL = FVAL.

APPEND I_BDCDATA.

ENDIF.

ENDFORM.

what mistake i have done ?

with regards.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Nov 25, 2007 at 06:03 PM

    You have to put the LOOP of the MESSAGE tab inside the main LOOP like:

    CALL TRANSACTION 'XK01' USING I_BDCDATA MODE 'A' MESSAGES INTO

    I_BDCMSGCOLL.

    DATA: W_MSG TYPE C..
    
    LOOP AT I_BDCMSGCOLL.
    CALL FUNCTION 'FORMAT_MESSAGE'
    EXPORTING
    ID = I_BDCMSGCOLL-MSGID
    LANG = SY-LANGU
    NO = i_bdcmsgcoll-msgnr
    V1 = I_BDCMSGCOLL-MSGV1
    V2 = I_BDCMSGCOLL-MSGV2
    V3 = I_BDCMSGCOLL-MSGV3
    V4 = I_BDCMSGCOLL-MSGV4
    IMPORTING
    MSG = W_MSG.
    * EXCEPTIONS
    * NOT_FOUND = 1
    * OTHERS = 2
    .
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    
    ENDIF.
    WRITE : / W_MSG.
    ENDLOOP.
    refresh i_BDCMSGCOLL.
    ENDLOOP .
    

    REgards,

    Naimesh Patel

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.