Application Development 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: 

Bdc

Former Member
0 Kudos

hi,

pls tell me how to do bdc for a table control

8 REPLIES 8

Former Member
0 Kudos

hi,

<b>Table control in BDC</b>

http://www.sap-img.com/abap/bdc-example-using-table-control-in-bdc.htm

<b>BDC</b>

http://www.sap-img.com/bdc.htm

Please Mark Helpful Answers

Message was edited by: Manoj Gupta

Former Member
0 Kudos

HI PRAKASH,

TRY THIS CODE.

TABLES: LFA1,LFBK,lfb1.

&----


*& internal table declaration

**&----


data: BEGIN OF it_vendor occurs 0,

LIFNR LIKE LFA1-LIFNR,

bukrs like lfb1-bukrs,

END OF it_vendor.

DATA: BEGIN OF IT_BANK occurs 0,

LIFNR LIKE LFA1-LIFNR,

BANKS LIKE LFBK-BANKS,

BANKL LIKE LFBK-BANKL,

BANKN LIKE LFBK-BANKN,

koinh like lfbk-koinh,

END OF IT_BANK.

data: it_bdcdata like bdcdata occurs 0 with header line.

data: it_messages like bdcmsgcoll occurs 0 with header line.

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

*selection screen.

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

selection-screen: begin of block b1 with frame.

parameters: p_file like rlgrap-filename default 'c:/vendor.txt'

obligatory.

parameters: p_file1 like rlgrap-filename default 'c:/xyz.txt'

obligatory.

selection-screen: end of block b1.

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

*at selection screen.

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

at selection-screen on value-request for p_file.

perform f4_help using p_file.

at selection-screen on value-request for p_file1.

perform f4_help1 using p_file1.

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

*start of selection

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

start-of-selection.

*******uploading file

perform upload_file using p_file P_FILE1.

******open session.

perform populate_data.

&----


*& Form f4_help

&----


  • text

----


  • -->P_P_FILE text

----


form f4_help using p_p_file.

data: l_file type ibipparms-path.

call function 'F4_FILENAME'

importing

file_name = l_file.

p_file = l_file.

endform. " f4_help

&----


*& Form POPULATE_DATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form populate_data .

DATA: L_STRING TYPE STRing.

DATA: L_COUNTER(2) TYPE n.

loop at it_vendor.

perform bdc_dynpro using 'SAPMF02K' '0106'.

perform bdc_field using 'BDC_CURSOR'

'RF02K-D0130'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RF02K-LIFNR'

it_vendor-lifnr.

perform bdc_field using 'RF02K-BUKRS'

it_vendor-bukrs.

perform bdc_field using 'RF02K-D0130'

'X'.

perform bdc_dynpro using 'SAPMF02K' '0130'.

perform bdc_field using 'BDC_CURSOR'

'LFBK-bankn(03)'.

perform bdc_field using 'BDC_OKCODE'

'=UPDA'.

*********bank details

CLEAR l_COUNTER.

LOOP AT IT_BANK WHERE LIFNR = IT_VENDOR-LIFNR.

l_COUNTER = l_COUNTER + 1.

clear l_string.

CONCATENATE 'lfbk-banks(' l_counter ')' into l_string.

perform bdc_field using l_string

it_bank-banks.

clear l_string.

CONCATENATE 'lfbk-bankl(' l_counter ')' into l_string.

perform bdc_field using l_string

it_bank-bankl.

clear l_string.

CONCATENATE 'lfbk-bankn(' l_counter ')' into l_string.

perform bdc_field using l_string

it_bank-bankn.

endloop.

******CALL TRANSACTION.

call transaction 'FK02' using it_bdcdata mode 'A'

messages into it_messages.

write:/ sy-subrc.

perform format_messages.

clear it_bdcdata.

refresh it_bdcdata.

endloop.

endform. " POPULATE_DATA

&----


*& Form FORMAT_MESSAGES

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form format_messages .

data: l_msg(100).

loop at it_messages.

call function 'FORMAT_MESSAGE'

exporting

id = it_messages-msgid

lang = sy-langu

no = it_messages-msgnr

v1 = it_messages-msgv1

v2 = it_messages-msgv2

v3 = it_messages-msgv3

v4 = it_messages-msgv4

importing

msg = l_msg

exceptions

not_found = 1

others = 2

.

write:/ l_msg.

endloop.

endform. " FORMAT_MESSAGES

&----


*& Form bdc_dynpro

&----


  • text

----


  • -->P_0173 text

  • -->P_0174 text

----


form bdc_dynpro using value(p_program)

value(p_screen).

it_bdcdata-program = p_program.

it_bdcdata-dynpro = p_screen.

it_bdcdata-dynbegin = 'X'.

append it_bdcdata.

clear it_bdcdata.

endform. " bdc_dynpro

&----


*& Form bdc_field

&----


  • text

----


  • -->P_0178 text

  • -->P_0179 text

----


form bdc_field using value(p_fnam)

value(p_fval).

it_bdcdata-fnam = p_fnam.

it_bdcdata-fval = p_fval.

append it_bdcdata.

clear it_bdcdata.

endform. " bdc_field

&----


*& Form upload_file

&----


  • text

----


  • -->P_P_FILE text

  • -->P_P_FILE1 text

----


form upload_file using p_p_file

p_p_file1.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = P_P_FILE

FILETYPE = 'DAT'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • DAT_D_FORMAT = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = IT_VENDOR

  • 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 I000(ZZ) WITH 'UNABLE TO UPLOAD'.

STOP.

ENDIF.

*******UPLOADING BANK DETAILS

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = P_P_FILE1

FILETYPE = 'DAT'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • DAT_D_FORMAT = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = IT_BANK

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 I000(ZZ) WITH 'UNABLE TO UPLOAD'.

STOP.

ENDIF.

endform. " upload_file

&----


*& Form f4_help1

&----


  • text

----


  • -->P_P_FILE1 text

----


form f4_help1 using p_p_file1.

data:l_file1 type ibipparms-path.

CALL FUNCTION 'F4_FILENAME'

IMPORTING

FILE_NAME = l_file1.

p_file1 = l_file1.

endform. " f4_help1

Message was edited by: Priya

Former Member
0 Kudos

Hi prakash,

1. The main difference in accessing fields

in table control,

is using suffix.

2. Eg. the field name is BUKRS

then for 1st row, we access it using

BUKRS(1)

then for 2nd row, we access it using

BUKRS(2)

... and so on.

regards,

amit m.

0 Kudos

Hello Amit,

But why do we need to use whose suffixes. Is that for populate the records along the pages and left/right?

ty

sy

0 Kudos

hi suresh,

The suffixes stand for the row number,

suppose the table control has three fields, F1 F2 F3 then the first row in the table is accessed by

F1(1) F2(1) F3(1) similarly row 2 is accessed by

F1(2) F2(2) F3(2) and so on.

Hope this helps.

Former Member
0 Kudos

Hi Prakash,

Please read through this excellent example on BDC Table Control i got from the net.

How to deal with table control / step loop in BDC

Steploop and table contol is inevitable in certain transactions. When we run BDC for such transactions, we will face the situation: how many visible lines of steploop/tablecontrol are on the screen? Although we can always find certain method to deal with it, such as function code 'NP', 'POPO', considering some extreme situation: there is only one line visible one the screen, our BDC program should display an error message. (See transaction 'ME21', we you resize your screen to let only one row visible, you can not enter mutiple lines on this screen even you use 'NP')

Now with the help of Poonam on sapfans.com developement forum, I find a method with which we can determine the number of visible lines on Transaction Screen from our Calling BDC program. Maybe it is useless to you, but I think it will give your some idea.

Demo ABAP code has two purposes:

1. how to determine number of visible lines and how to calculte page number;

(the 'calpage' routine has been modify to meet general purpose usage)

2. using field symbol in BDC program, please pay special attention to the difference in Static ASSIGN and Dynamic ASSIGN.

Now I begin to describe the step to implement my method:

(I use transaction 'ME21', screen 121 for sample,

the method using is Call Transation Using..)

Step1: go to screen painter to display the screen 121, then we can count the fixed line on this screen, there is 7 lines above the steploop and 2 lines below the steploop, so there are total 9 fixed lines on this screen. This means except these 9 lines, all the other line is for step loop. Then have a look at steploop itselp, one entry of it will occupy two lines.

(Be careful, for table control, the head and the bottom scroll bar will possess another two fixed lines, and there is a maximum number for table line)

Now we have : FixedLine = 9

LoopLine = 2(for table control, LoopLine is always equal to 1)

Step2: go to transaction itself(ME21) to see how it roll page, in ME21, the first line of new page is always occupied by the last line of last page, so it begin with index '02', but in some other case, fisrt line is empty and ready for input.

Now we have: FirstLine = 0

or FirstLine = 1 ( in our case, FirstLine is 1 because the first line of new page is fulfilled)

Step3: write a subroutine calcalculating number of pages

(here, the name of actual parameter is the same as formal parameter)

global data: FixedLine type i, " number of fixed line on a certain screen

LoopLine type i, " the number of lines occupied by one steploop item

FirstLine type i, " possbile value 0 or 1, 0 stand for the first line of new " scrolling screen is empty, otherwise is 1

Dataline type i, " number of items you will use in BDC, using DESCRIBE to get

pageno type i, " you need to scroll screen how many times.

line type i, " number of lines appears on the screen.

index(2) type N, " the screen index for certain item

begin type i, " from parameter of loop

end type i. " to parameter of loop

*in code sample, the DataTable-linindex stands for the table index number of this line



form calpage using FixedLine type i (see step 1)
                   LoopLine  type i (see step 1)
                   FirstLine type i (see step 2)
                   DataLine  type i ( this is the item number you will enter in transaction)
          changing pageno    type i (return the number of page, depends on run-time visible                                                                             line in table control/ Step Loop)
          changing line      type i.(visible lines one the screen)
data: midd type i,
      vline type i, "visible lines
if DataLine eq 0.
   Message eXXX.
endif.

vline = ( sy-srows - FixedLine ) div LoopLine.
*for table control, you should compare vline with maximum line of
*table control, then take the small one that is min(vline, maximum)
*here only illustrate step loop

if FirstLine eq 0.
        pageno = DataLine div vline.

        if pageno eq 0.
           pageno = pageno + 1.
        endif.
elseif FirstLine eq 1.
        pageno = ( DataLine - 1 ) div ( vline - 1 ) + 1.
        midd = ( DataLine - 1 ) mod ( vline - 1).
        if midd = 0 and DataLine gt 1.
                pageno = pageno - 1.
        endif.
endif.

line = vline.

endform.

Step4 write a subroutine to calculate the line index for each item.

form calindex using Line type i (visible lines on the screen)
                    FirstLine type i(see step 2)
                    LineIndex type i(item index)
          changing  Index type n.    (index on the screen)

  if  FirstLine = 0.
        index = LineIndex mod Line.
        if index = '00'.
                index = Line.
        endif.
  elseif FirstLine = 1.
        index = LineIndex mod ( Line - 1 ).
        if ( index between 1 and 0 ) and LineIndex gt 1.
                index = index + Line - 1.
        endif.
        if Line = 2.
                index = index + Line - 1.
        endif.
 endif.

endform.

Step5 write a subroutine to calculate the loop range.

form calrange using Line type i ( visible lines on the screen)
                    DataLine type i
                    FirstLine type i
                    loopindex like sy-index
        changing    begin type i
                    end type i.

If FirstLine = 0.
   if loopindex = 1.
        begin = 1.
        if DataLine <= Line.
                end = DataLine.
        else.
                end = Line.
        endif.
   elseif loopindex gt 1.
        begin = Line * ( loopindex - 1 ) + 1.
        end   = Line * loopindex.
        if end gt DataLine.
           end = DataLine.
        endif.
   endif.

elseif FirstLine = 1.

  if loopindex = 1.
        begin = 1.
        if DataLine <= Line.
                end = DataLine.
        else.
                end = Line.
        endif.
  elseif loop index gt 1.
        begin = ( Line - 1 ) * ( loopindex - 1 ) + 2.
        end =   ( Line - 1 ) * ( loopindex - 1 ) + Line.
        if end gt DataLine.
                end = DataLine.
        endif.
  endif.

endif.

endform.


Step6 using field sysbol in your BDC, for example: in ME21, but you should calculate each item will correponding to which index in steploop/Table Control

form creat_bdc.

field-symbols: <material>, <quan>, <indicator>.

data: name1(14) value 'EKPO-EMATN(XX)',
      name2(14) value 'EKPO-MENGE(XX)',
      name3(15) value 'RM06E-SELKZ(XX)'.
assign:         name1 to <material>,
                name2 to <quan>,
                name3 to <indicator>.
              .
do pageno times.

if sy-index gt 1

*insert scroll page ok_code"

endif.
              .
              .
        perform calrange using Line DataLine FirstLine sy-index
                         changing begin end.
              .
              .
loop at DataTable from begin to end.
        perform calindex using Line FirstLine DataTable-LineIndex changing Index.
        name1+11(2) = Index.
        name2+11(2) = Index.
        name3+12(2) = Index.
              .
              .
        perform bdcfield using <material> DataTable-matnr.
        perform bdcfield using <quan>     DataTable-menge.
        perform bdcfield using <indicator> DataTable-indicator.
              .
              .
              .

endloop.

enddo.

Regards,

Arun S.

Message was edited by: Arun Sambargi

Former Member
0 Kudos

Hi Prakash,

REPORT ZXX_CALLTRANSCATIONEX5 .

*----


internal table for uploading data

data:begin of itab occurs 0,

lifnr like lfa1-lifnr,

bukrs type lfb1-bukrs,

  • anred like lfb1-anred,

name1 like lfa1-name1,

sortl like lfa1-sortl,

land1 like lfa1-land1,

spras like lfa1-spras,

ktokk like lfa1-ktokk,

end of itab.

data:flag type c.

*----


Internal Table for uploadind bank details

data:begin of it_bank occurs 0,

lifnr like lfa1-lifnr,

banks like lfbk-banks,

bankl like lfbk-bankl,

bankn like lfbk-bankn,

end of it_bank.

data:it_bdc type bdcdata occurs 0 with header line,

it_msg type bdcmsgcoll occurs 0 with header line.

*----


selection screen

selection-screen begin of block b1 with frame title text-001.

parameters:p_file type rlgrap-filename ,

p_file1 type rlgrap-filename.

selection-screen end of block b1.

*---- at selection-screen

at selection-screen on value-request for p_file.

perform get_help using p_file.

at selection-screen on value-request for p_file1.

perform get_help using p_file1.

start-of-selection.

perform upload_file using p_file p_file1.

perform populate_bdc.

&----


*& Form get_help

&----


  • text

----


  • -->P_P_FILE text

----


form get_help using p_p_file.

data:l_file type ibipparms-path.

CALL FUNCTION 'F4_FILENAME'

IMPORTING

FILE_NAME = l_file.

p_p_file = l_file.

endform. " get_help

&----


*& Form upload_file

&----


  • text

----


  • -->P_P_FILE text

  • -->P_P_FILE1 text

----


form upload_file using p_p_file

p_p_file1.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = p_p_file

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.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = p_p_file1

FILETYPE = 'ASC'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • DAT_D_FORMAT = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

data_tab = it_bank

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

&----


*& Form populate_bdc

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form populate_bdc .

data:l_counter type n,

l_string type string.

loop at itab.

perform bdc_dynpro using 'SAPMF02K' '0105'.

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-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-ANRED'

  • itab-anred.

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

perform bdc_dynpro using 'SAPMF02K' '0130'.

perform bdc_field using 'BDC_CURSOR'

'LFBK-XEZER(01)'.

perform bdc_field using 'BDC_OKCODE'

'=UPDA'.

clear l_counter.

loop at it_bank where lifnr = itab-lifnr.

l_counter = l_counter + 1.

clear l_string.

concatenate 'lfbk-banks(' l_counter ')' into l_string.

perform bdc_field using l_string

it_bank-banks.

clear l_string.

concatenate 'lfbk-bankl(' l_counter ')' into l_string.

perform bdc_field using l_string

it_bank-bankl.

clear l_string.

concatenate 'lfbk-bankn(' l_counter ')' into l_string.

perform bdc_field using l_string

it_bank-bankn.

clear l_string.

endloop.

call transaction 'FK01' using it_bdc mode 'A' messages into it_msg.

*write:/ sy-subrc.

if sy-subrc ne 0.

perform create_session.

endif.

clear it_bdc.

refresh it_bdc.

endloop.

if flag = 'X'.

perform close_group.

endif.

endform.

" populate_bdc

&----


*& Form bdc_dynpro

&----


  • text

----


  • -->P_0253 text

  • -->P_0254 text

----


form bdc_dynpro using value(p_0253)

value(p_0254).

it_bdc-program = p_0253.

it_bdc-dynpro = p_0254.

it_bdc-dynbegin = 'X'.

append it_bdc.

clear it_bdc.

endform. " bdc_dynpro

&----


*& Form bdc_field

&----


  • text

----


  • -->P_0338 text

  • -->P_0339 text

----


form bdc_field using value(p_0338)

value(p_0339).

it_bdc-fnam = p_0338.

it_bdc-fval = p_0339.

it_bdc-dynbegin = 'X'.

append it_bdc.

clear it_bdc.

endform. " bdc_field

&----


*& Form create_session

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form create_session .

if flag = ' '.

perform bdc_open.

flag = 'X'.

endif.

perform bdc_insert.

endform. " create_session

&----


*& Form bdc_open

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form bdc_open .

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

  • DEST = FILLER8

GROUP = 'zsita'

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

endform. " bdc_open

&----


*& Form close_group

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


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_insert

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form bdc_insert .

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'FK01'

  • POST_LOCAL = NOVBLOCAL

  • PRINTING = NOPRINT

  • SIMUBATCH = ' '

  • CTUPARAMS = ' '

TABLES

dynprotab = it_bdc

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.

perform format_messages.

clear: it_bdc,it_msg.

refresh: it_bdc,it_msg.

endform. " bdc_insert

&----


*& Form format_messages

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form format_messages .

DATA: v_msg TYPE string.

LOOP AT it_msg WHERE msgtyp = 'S' OR

msgtyp = 'E'.

CLEAR v_msg.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = it_msg-msgid

LANG = sy-langu

  • NO = SY-MSGNO

  • V1 = SY-MSGV1

  • V2 = SY-MSGV2

  • V3 = SY-MSGV3

  • V4 = SY-MSGV4

IMPORTING

MSG = v_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.

endloop.

write:/ itab-lifnr,v_msg.

endform. " format_messages

Plz reward if it helps,

Laxmi