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

Call Transaction using BDC data

Former Member
0 Likes
1,336

Hi,

I have recorded BDC data using transaction SHDB and now i am calling the same BDC data by using call transaction, but i am not able to capture the error messages in the transaction. My code is as follows:

-


perform bdc_dynpro using 'SAPLKAZB' '1000'.

perform bdc_field using 'BDC_CURSOR' 'RKAUF-TEST'.

perform bdc_field using 'BDC_OKCODE'

'=RUN'.

perform bdc_field using 'RKAUF-TEST' ''.

perform bdc_field using 'LKP74-PSPID' 'Z/050-11'.

perform bdc_field using 'RPSCO_X-VERSN_CTC' '110'.

perform bdc_dynpro using 'SAPLOBJ1_PROCESSING_LOG' '2000'.

perform bdc_field using 'BDC_OKCODE' '=ENDE'.

opt-racommit = 'X'.

opt-updmode = 'S'.

opt-dismode = 'E'.

CALL TRANSACTION 'CJ9L' USING bdcdata_tab OPTIONS FROM opt MESSAGES INTO messtab.

Now i check for sy-subrc ie always ' 0 ' :-(..

can some one help me how to capture the error messages here as messagetab is also empty.

Good reward points ensured for helpful answers :-).

Thanks and Regards,

Harsh

7 REPLIES 7
Read only

Former Member
0 Likes
1,040

See what happens if you change it to:

opt-dismode = 'A'.

Rob

Read only

0 Likes
1,040

popup comes and i am asked to check all the poups and the new transaction screen appers in background for few seconds and then the sucess message appears even when i have locked the object :-(.

With Regards,

Harsh

Read only

Former Member
0 Likes
1,040

Just create an internal table of type BDCMSGCOL, lets say imessages.

after call transaction ... messages into messtab,

loop at messtab into w_messtab.

if messtab-MSGTYP eq 'E'.

append w_messtab to imessages.

endif.

endloop.

if you want to capture all the messages then immediately after call transaction

append messtab to imessages.

refresh messtab.

Reward points if possible.

Thanks and regards,

Veerendranath .

Read only

0 Likes
1,040

Hi Veerendranath,

The messtab in my code is always comming empty.

Can you Please check if the calling is correct as i am new to BDC.

Thanks and Regards,

Harsh

Read only

0 Likes
1,040

Not all transactions fill MESSTAB with error messages...That's why you to process it using the A mode...You can maybe debug the popup window by using this file....


[System]
Name=R/3
Client=
Description=
[User]
Name=
Language=
Password=
[Function]
Command=/H
Title=Title
Type=SystemCommand

Copy it on a text file and save it a Debug.txt, when the popup comes out, simply drag the file into it to get to the Debugger...Maybe you can check whats going on...

Greetings,

Blag.

Read only

0 Likes
1,040

Still the problem is not solved can some one suggest a way in which i should call this BDC data so that i can handel all the error messages.

The problem is see here is that the mess tab is always empty.

Thanks and Regards,

Harsh

Read only

Former Member
0 Likes
1,040

Hi

this is the BDC program with session and call transaction in one program

you can check here how the error mess will be handeled

reward if usefull

REPORT ZNNR_BDC .

DATA : BEGIN OF ITAB OCCURS 0,

EMPID LIKE ZNNR-EMPID,

EMPNAME LIKE ZNNR-EMPNAME,

EMPADR LIKE ZNNR-EMPADR,

END OF ITAB.

DATA : BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'C:\NARESH\NARESH.TXT'

  • FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

  • HEADER_LENGTH = 0

  • READ_BY_LINE = 'X'

  • DAT_MODE = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • CHECK_BOM = ' '

  • VIRUS_SCAN_PROFILE =

  • NO_AUTH_CHECK = ' '

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

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

  • DEST = FILLER8

GROUP = 'NARESH'

  • HOLDDATE = FILLER8

KEEP = 'X'

USER = SY-UNAME

  • RECORD = FILLER1

  • PROG = SY-CPROG

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

LOOP AT ITAB.

REFRESH BDCDATA.

PERFORM BDC_DYNPRO USING 'ZNNR_MODULE' '0100'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'ZNNR-EMPADR'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=CRT'.

PERFORM BDC_FIELD USING 'ZNNR-EMPID'

ITAB-EMPID.

PERFORM BDC_FIELD USING 'ZNNR-EMPNAME'

ITAB-EMPNAME.

PERFORM BDC_FIELD USING 'ZNNR-EMPADR'

ITAB-EMPADR.

  • PERFORM BDC_TRANSACTION USING 'ZNNC'.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'ZNNC'

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

ENDLOOP.

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.

WRITE 😕 'SESSION CREATED SUCCESSFULLY'.

FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR BDCDATA.

BDCDATA-PROGRAM = PROGRAM.

BDCDATA-DYNPRO = DYNPRO.

BDCDATA-DYNBEGIN = 'X'.

APPEND BDCDATA.

ENDFORM.

FORM BDC_FIELD USING FNAM FVAL.

  • IF FVAL <> NODATA.

CLEAR BDCDATA.

BDCDATA-FNAM = FNAM.

BDCDATA-FVAL = FVAL.

APPEND BDCDATA.

  • ENDIF.

ENDFORM.