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

Problem in the BDC Table Control for the T.Code VA01

Former Member
0 Likes
955

Hi,

I faced probelm in the BDC of the VA01. In the Table Control

the records are entered upto 12 line items. after 13th line item overwrites the first record. How to solve the Problem.

Please help me.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
859

Hi,

In BDC probably only 12 lines are visible, so give a 'P+' command after each 12 lines.

Regards,

John.

Hi,

I faced probelm in the BDC of the VA01. In the Table Control

the records are entered upto 12 line items. after 13th line item overwrites the first record. How to solve the Problem.

Please help me.

5 REPLIES 5
Read only

Former Member
0 Likes
860

Hi,

In BDC probably only 12 lines are visible, so give a 'P+' command after each 12 lines.

Regards,

John.

Read only

0 Likes
859

Hi,

Please give how to write the Code. Please send any code with you.

bye

Mohan

Read only

0 Likes
859

&----


*& Report ZSD_R_SALESORDER

&----


report zsd_r_salesorder line-size 132 message-id zmmbapi .

&----


*& Created By : shailaja

*& Created on : 13.10.2007

*& Requested By : vardhman

*& Description of program :

&----


----


  • Internal table definition *

----


data: gt_order_header_in like bapisdhead occurs 0 with header line,

gt_return like bapireturn1 occurs 0 with header line, " Return Messages

gt_order_items_in like bapiitemin occurs 0 with header line, " Item Data

gt_order_schedule_ex like bapisdhedu occurs 0 with header line,

gt_order_items_out like bapiitemex occurs 0 with header line,

*gt_ORDER_SCHEDULE_EX like BAPISDHEDU occurs 0 with header line,

gt_salesdocument like bapivbeln-vbeln , "Number of Generated Document

gt_order_partners like bapiparnr occurs 0 with header line, "Document Partner

gt_return1 like bapiret2 occurs 0 with header line.

----


  • Data definition *

----


types: begin of ty_gt_ft_sales ,

partn_numb(10) type n ,"Customer Number 1

partn_role(2) ,"Partner function

sales_org(4) , "Sales Organization

distr_chan(2) , "Distribution Channel

division(002), "DIVISION

doc_type(4) , "Sales Document Type

purch_no(020), "Purchase order

material(18), "MATERIAL

targetquantity(020),"Target quantity

reqqty(020), "Req quantity

reqdate(010), "req date

*REQ_DATE_H(010),

ref_1(012), "Ref

unload_pt(025),

*PARTN_ROLE(2) ,"Partner function

*PARTN_NUMB(10) ,"Customer Number 1

end of ty_gt_ft_sales,

begin of ty_header ,

partn_numb(10) ,"Customer Number 1

partn_role(2) ,"Partner function

sales_org(4) , "Sales Organization

distr_chan(2) , "Distribution Channel

division(002), "DIVISION

doc_type(4) , "Sales Document Type

purch_no(020), "Purchase order

unload_pt(025),

*REQ_DATE_H(010),

end of ty_header,

begin of ty_item,

material(18), "MATERIAL

targetquantity(020),"Target quantity

reqqty(020), "Req quantity

reqdate(010), "req date

ref_1(012), "Ref

*UNLOAD(025),

end of ty_item.

data : msg(240) type c, " Return Message

e_rec(8) type c, " Error Records Counter

rec_no(8) type c, " Records Number Indicator

s_rec(8) type c, " Successful Records Counter

t_rec(8) type c, " Total Records Counter

v_matnr like mara-matnr,

count type n,

v_parvw type parvw.

data : gt_ft_sales type standard table of ty_gt_ft_sales with header line.

data : wa_gt_ft_sales type ty_gt_ft_sales,

wa_order_items_in like gt_order_items_in,

wa_gt_ft_sales1 type ty_gt_ft_sales,

wa_header type ty_header,

salesdocument like bapivbeln-vbeln.

    • selection block for EXCEL UPLOAD FILE

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

parameters file type ibipparms-path obligatory.

selection-screen end of block b1.

*<<<<AT SELECTION-SCREEN ON VALUE-REQUEST FOR FILE .

at selection-screen on value-request for file .

perform getname.

form getname.

call function 'F4_FILENAME'

exporting

program_name = syst-cprog

dynpro_number = syst-dynnr

importing

file_name = file.

endform.

*TOP-OF-PAGE.

top-of-page.

skip 3.

format color col_heading inverse on.

write 40 text-001.

format color col_heading inverse off.

skip 1.

format color col_negative inverse on.

write 😕 text-002, 13 sy-mandt , 104 text-003, 121 sy-uname,

/ text-004, 13 sy-datum , 104 text-005, 121 sy-uzeit.

format color col_negative inverse off.

skip 3.

*START-OF-SELECTION.

start-of-selection.

perform get_data.

perform bapi.

*end-of-page.

perform result.

form result.

t_rec = e_rec + s_rec.

skip 3.

format color col_total inverse on.

write: /38 text-007, t_rec.

format color col_total inverse off.

format color col_negative inverse on.

write: /38 text-008, e_rec.

format color col_negative inverse off.

format color col_total inverse on.

write: /38 text-009, s_rec.

format color col_total inverse off.

endform.

&----


*& Form get_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form get_data .

call function 'WS_UPLOAD' "#EC *

exporting

filename = file

filetype = 'DAT'

tables

data_tab = gt_ft_sales

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

endif.

endform. " get_data

&----


*& Form BAPI

&----


form bapi .

loop at gt_ft_sales into wa_gt_ft_sales.

wa_gt_ft_sales1 = wa_gt_ft_sales.

at new partn_numb.

wa_header-doc_type = wa_gt_ft_sales1-doc_type..

wa_header-sales_org = wa_gt_ft_sales1-sales_org . "'0001'

wa_header-distr_chan = wa_gt_ft_sales1-distr_chan. "'01'

wa_header-division = wa_gt_ft_sales1-division. " '01'

wa_header-purch_no = wa_gt_ft_sales1-purch_no.

*WA_HEADER-REQ_DATE_H = WA_GT_FT_SALES1-REQ_DATE_H.

call function 'CONVERSION_EXIT_PARVW_INPUT'

exporting

input = wa_gt_ft_sales1-partn_role

importing

output = v_parvw.

wa_header-partn_role = v_parvw.

wa_header-partn_numb = wa_gt_ft_sales1-partn_numb.

wa_header-unload_pt = wa_gt_ft_sales1-unload_pt.

move-corresponding wa_header to gt_order_partners.

move-corresponding wa_header to gt_order_header_in.

append gt_order_header_in.

append gt_order_partners.

endat.

call function 'CONVERSION_EXIT_CCMAT_INPUT'

exporting

input = wa_gt_ft_sales1-material

importing

output = v_matnr.

.

count = count + 1.

gt_order_items_in-material = v_matnr .

gt_order_items_in-target_qty = wa_gt_ft_sales1-targetquantity . "'1000'

gt_order_items_in-req_qty = wa_gt_ft_sales1-reqqty.

gt_order_items_in-req_date = wa_gt_ft_sales1-reqdate.

*GT_ORDER_ITEMS_IN-BILL_DATE = wa_GT_FT_SALES1-REQDATE.

gt_order_schedule_ex-req_date = wa_gt_ft_sales1-reqdate.

gt_order_items_in-ref_1 = wa_gt_ft_sales1-ref_1.

append gt_order_items_in.

gt_order_items_out-itm_number = count.

gt_order_items_out-po_itm_no = wa_gt_ft_sales1-purch_no.

gt_order_items_out-material = v_matnr.

gt_order_items_out-dlv_date = wa_gt_ft_sales1-reqdate.

clear : wa_gt_ft_sales1,wa_header.

gt_order_schedule_ex-req_date = wa_gt_ft_sales1-reqdate.

at end of partn_numb.

call function 'BAPI_SALESORDER_CREATEFROMDAT1'

exporting

order_header_in = gt_order_header_in

  • WITHOUT_COMMIT = ' '

  • CONVERT_PARVW_AUART = 'X'

importing

salesdocument = salesdocument

return = gt_return

tables

order_items_in = gt_order_items_in

order_partners = gt_order_partners

order_schedule_ex = gt_order_schedule_ex

order_items_out = gt_order_items_out.

*ORDER_SCHEDULE_EX = gt_ORDER_SCHEDULE_EX.

if gt_return-type eq 'E' .

e_rec = e_rec + 1.

read table gt_return with key id = 'V1'.

format color col_negative inverse on.

rec_no = e_rec + s_rec.

concatenate text-006 rec_no ':'

gt_return-message into msg separated by space .

condense msg.

write: / msg.

format color col_negative inverse off.

elseif gt_return-number = '000'.

s_rec = s_rec + 1.

format color col_positive inverse on.

msg = 'SUCCESS'.

condense msg.

write: / msg .

format color col_positive inverse off.

write 😕 salesdocument, 'Has been created'.

perform commit_mm.

endif.

clear: gt_return[], msg.

endat.

endloop.

endform. " SLALE_UPLOAD_DATA

&----


*& Form COMMIT_MM

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form commit_mm .

call function 'BAPI_TRANSACTION_COMMIT'

exporting

wait = 'X'

importing

return = gt_return1.

clear: gt_order_items_in[]."GT_ORDER_CONDITIONS_IN[],count.

endform. " COMMIT_MM

use this

Read only

0 Likes
859

or use this

----


  • Internal table definition *

----


data : begin of bdcdata occurs 0.

include structure bdcdata.

data : end of bdcdata.

data: begin of messtab occurs 0.

include structure bdcmsgcoll.

data: end of messtab.

data: v_chr_opengrp type c,

r_matnr like mara-matnr, "variable for material conversion

r_werks like marc-werks, "variable for plant

v_str_fname type string.

data: begin of count2,

inrec(9) type n, " input I_MATERIAL count

create(9) type n, " create count

error(9) type n, " error count

bdc(9) type n, " count of BDC creates

end of count2.

*

types: begin of ty_source,

partn_numb(10) type n ,"Customer Number 1

ref(035),

sales_org(4) , "Sales Organization

distr_chan(2) , "Distribution Channel

division(002), "DIVISION

doc_type(4) , "Sales Document Type

purch_no(020), "Purchase order

material like vbap-matnr,

reqqty(018),

reqdate(010),

end of ty_source,

begin of ty_header ,

partn_numb(10) ,"Customer Number 1

ref(035),

sales_org(4) , "Sales Organization

distr_chan(2) , "Distribution Channel

division(002), "DIVISION

doc_type(4) , "Sales Document Type

purch_no(020), "Purchase order

end of ty_header,

begin of ty_item,

partn_numb(10) ,"Customer Number 1

ref(035),

material like vbap-matnr,

reqqty(018),

reqdate(010),

end of ty_item.

data : msg(240) type c, " Return Message

e_rec(8) type c, " Error Records Counter

rec_no(8) type c, " Records Number Indicator

s_rec(8) type c, " Successful Records Counter

t_rec(8) type c, " Total Records Counter

v_matnr like mara-matnr.

data: val(2) type n value 01.

data : begin of bdc_itab occurs 0.

include structure bdcdata.

data : end of bdc_itab.

data : t_source type standard table of ty_source with header line,

t_header type standard table of ty_header initial size 1,

t_item type standard table of ty_item initial size 1,

t_target type standard table of bdcdata initial size 1.

data : w_source type ty_source,

w_source1 type ty_source,

w_header type ty_header,

w_item type ty_item,

w_target type bdcdata,

count type i,

count1 type n.

*&----


  • Variable Declaration

*&----


data: w_fname type string,

fnam(20),

date1(10),

i(2) type n,

v_count type i,

v_group type apqi-groupid.

&----


*& selection screen

&----


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

parameters : p_fname type rlgrap-filename, "Input file

p_update(1) default 'N', "Input for update mode

p_bdcgrp(12) default 'SD_ORDERS'. "Input for session name

selection-screen end of block bl1.

*&----


**&

**&SELECTION SCREEN VALIDATIONS

*&----


at selection-screen on value-request for p_fname.

call function 'KD_GET_FILENAME_ON_F4'

exporting

program_name = 'ZMATERIAL'

dynpro_number = '1000'

field_name = 'P_FNAME'

changing

file_name = p_fname.

&----


*& Start of selection

&----


start-of-selection.

if p_fname is initial.

message i016(rp) with 'Please enter a file name'.

leave list-processing.

else.

move p_fname to v_str_fname.

endif.

call function 'GUI_UPLOAD'

exporting

filetype = 'ASC'

filename = v_str_fname

has_field_separator = 'X'

tables

data_tab = t_source

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.

sort t_source by ref partn_numb.

loop at t_source into w_source.

add 1 to count2-inrec.

w_source1 = w_source.

  • AT NEW PARTN_NUMB. "10/31 KVB

at new ref.

w_header-doc_type = w_source1-doc_type..

w_header-sales_org = w_source1-sales_org . "'0001'

w_header-distr_chan = w_source1-distr_chan. "'01'

w_header-division = w_source1-division. " '01'

w_header-purch_no = w_source1-purch_no.

w_header-partn_numb = w_source1-partn_numb.

w_header-ref = w_source1-ref.

append w_header to t_header.

endat.

w_item-partn_numb = w_source1-partn_numb.

w_item-material = w_source1-material.

w_item-reqqty = w_source1-reqqty.

w_item-ref = w_source1-ref.

w_item-reqdate = w_source1-reqdate.

append w_item to t_item.

clear :w_item,w_header.

endloop.

loop at t_header into w_header.

perform bdc_dynpro using 'SAPMV45A' '0101' .

perform bdc_field using 'BDC_CURSOR' 'VBAK-SPART'.

perform bdc_field using 'BDC_OKCODE' '/00'.

perform bdc_field using 'VBAK-AUART' w_header-doc_type.

perform bdc_field using 'VBAK-VKORG' w_header-sales_org.

perform bdc_field using 'VBAK-VTWEG' w_header-distr_chan.

perform bdc_field using 'VBAK-SPART' w_header-division.

perform bdc_dynpro using 'SAPMV45A' '4001' .

perform bdc_field using 'BDC_OKCODE' '/00'.

perform bdc_field using 'BDC_CURSOR' 'VBKD-BSTKD'.

perform bdc_field using 'VBKD-BSTKD' w_header-purch_no.

perform bdc_field using 'KUWEV-KUNNR' w_header-partn_numb.

i = 1.

loop at t_item into w_item where partn_numb = w_header-partn_numb

and ref = w_header-ref.

at new partn_numb.

clear count1.

count = 0.

endat.

count = count + 1.

if count gt 5.

clear i.

i = 2.

perform bdc_dynpro using 'SAPMV45A' '4001' .

perform bdc_field using 'BDC_OKCODE' '=POAN'.

endif.

count1 = count1 + 1.

concatenate 'VBAP-POSNR(' i ')' into fnam.

perform bdc_field using fnam

count1.

concatenate 'RV45A-MABNR(' i ')' into fnam.

perform bdc_field using fnam w_item-material.

concatenate 'RV45A-KWMENG(' i ')' into fnam.

perform bdc_field using fnam w_item-reqqty..

concatenate 'RV45A-ETDAT(' i ')' into fnam.

perform bdc_field using fnam w_item-reqdate.

concatenate 'VBKD-BSTKD_E(' i ')' into fnam.

perform bdc_field using fnam w_item-ref.

i = i + 1.

clear: w_item.

endloop.

clear w_header.

perform bdc_dynpro using 'SAPMV45A' '4001'.

perform bdc_field using 'BDC_OKCODE'

'=SICH'.

perform post_transaction.

refresh bdc_itab.

clear bdc_itab.

endloop.

*endloop.

end-of-selection.

perform finalization.

----


  • Start new screen *

----


form bdc_dynpro using program dynpro.

clear bdc_itab.

bdc_itab-program = program.

bdc_itab-dynpro = dynpro.

bdc_itab-dynbegin = 'X'.

append bdc_itab.

endform. "bdc_dynpro

----


  • Insert field *

----


form bdc_field using fnam fval.

if fval <> ''.

clear bdc_itab.

bdc_itab-fnam = fnam.

bdc_itab-fval = fval.

append bdc_itab.

endif.

endform. "bdc_field

*&----


**& Form get_filename

*&----


    • text

*----


    • --> p1 text

    • <-- p2 text

*----


*form get_filename .

*call function 'WS_FILENAME_GET'

  • exporting

  • def_filename = space

  • def_path = file

  • mask = ',.,..'

  • mode = 'N'

  • title = text-015

  • importing

  • filename = file

  • exceptions

  • inv_winsys = 1

  • no_batch = 2

  • selection_cancel = 3

  • selection_error = 4

  • others = 5.

*endform. " get_filename

&----


*& Form post_transaction

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form post_transaction .

refresh messtab.

clear messtab.

call transaction 'VA01' using bdc_itab

mode p_update

update 'S'

messages into messtab.

read table messtab with key msgtyp = 'E'.

if sy-subrc eq 0.

perform process_error_messages.

add 1 to count2-bdc.

if v_chr_opengrp is initial.

perform bdc_open_group.

endif.

call function 'BDC_INSERT'

exporting

tcode = 'VA01'

tables

dynprotab = bdc_itab

exceptions

internal_error = 1

not_open = 2

queue_error = 3

tcode_invalid = 4

others = 5.

if sy-subrc <> 0.

case sy-subrc.

when 1.

write: / 'Internal error'.

when 2.

write: / 'Not open error'.

when 3.

write: / 'queue error'.

when 4.

write: / 'tcode invalid error'.

when others.

write: / 'other error'.

endcase.

endif.

else.

add +1 to count2-create.

format intensified off.

format color col_normal.

format color col_normal off.

endif.

clear bdc_itab.

refresh bdc_itab.

endform. " post_transaction

&----


*& Form finalization

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form finalization .

if v_chr_opengrp = 'X'.

call function 'BDC_CLOSE_GROUP'

exceptions

not_open = 1

queue_error = 2

others = 3.

endif.

get time.

skip 2.

write: / 'Time', sy-uzeit.

skip.

format color col_total on.

write: / 'Total Records: ', 40 count2-inrec.

write: / 'PERNR not of Emp Group 6 ', 40 count2-error.

write: / 'Records Created: ', 40 count2-create.

write: / 'BDC Create in group: ', 40 count2-bdc.

if v_chr_opengrp = 'X'.

skip 1.

format intensified on.

format color col_negative on.

write: / 'PLEASE USE TRANSACTION "SM35" ',

'TO PROCESS THE GENERATED BDC SESSION ... ',

p_bdcgrp.

endif.

endform. " finalization

&----


*& Form bdc_open_group

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form bdc_open_group .

call function 'BDC_OPEN_GROUP'

exporting

client = sy-mandt

group = p_bdcgrp

holddate = sy-datum

keep = 'X'

user = sy-uname

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 eq 0.

v_chr_opengrp = 'X'.

endif.

endform. " bdc_open_group

&----


*& Form process_error_messages

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form process_error_messages .

data: begin of loc_aux_message.

include structure message.

data: end of loc_aux_message.

data : msgno type sy-msgno.

loop at messtab.

move messtab-msgnr to msgno.

call function 'WRITE_MESSAGE'

exporting

msgid = messtab-msgid

msgno = msgno

msgty = messtab-msgtyp

msgv1 = messtab-msgv1

msgv2 = messtab-msgv2

msgv3 = messtab-msgv3

msgv4 = messtab-msgv4

importing

messg = loc_aux_message

exceptions

others = 1.

if sy-subrc eq 0.

format color col_negative on.

write: /10 loc_aux_message.

format color col_negative off.

else.

format color col_negative on.

write: /10 t_source-partn_numb.

write: / 'Error creating message'.

format color col_negative off.

exit.

endif.

endloop.

endform. " process_error_messages

Read only

Former Member
0 Likes
859

Hi,

LOOP AT it_rec1.

CLEAR l_indx.

CALL FUNCTION 'CONVERSION_EXIT_ABPSN_INPUT'

EXPORTING

input = it_rec1-pspid

IMPORTING

output = it_rec1-pspid.

PERFORM bdc_dynpro USING 'SAPLCJWB' '0100'.

PERFORM bdc_field USING 'BDC_CURSOR'

'*PROJ-PSPID'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=LETB'.

PERFORM bdc_field USING '*PROJ-PSPID'

it_rec1-pspid.

PERFORM bdc_field USING '*PRPS-POSID'

''.

*--


table control--


LOOP AT it_rec WHERE pspid = it_rec1-pspid.

l_indx = l_indx + 1.

IF l_indx EQ 14 .

l_indx = l_indx MOD 12.

PERFORM bdc_dynpro USING 'SAPLCJWB' '0901'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=P+'.

ENDIF.

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

PERFORM bdc_dynpro USING 'SAPLCJWB' '0901'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=PICK'.

CONCATENATE 'RCWBS-IDENT(' l_indx ')' INTO g_fieldname.

PERFORM bdc_field USING 'BDC_CURSOR'

g_fieldname.

CONCATENATE 'PRPS-STUFE(' l_indx ')' INTO g_fieldname.

PERFORM bdc_field USING g_fieldname

it_rec-stufe.

CONCATENATE 'RCWBS-IDENT(' l_indx ')' INTO g_fieldname.

PERFORM bdc_field USING g_fieldname

it_rec-ident.

                                    • VALUE OF THE WBS ELEMENT EQ 1****************

IF ( it_rec-stufe = '1' ).

CONCATENATE 'PRPS-PLAKZ(' l_indx ')' INTO g_fieldname.

PERFORM bdc_field USING g_fieldname

it_rec-plakz.

CONCATENATE 'PRPS-BELKZ(' l_indx ')' INTO g_fieldname.

PERFORM bdc_field USING g_fieldname

it_rec-belkz.

CONCATENATE 'PRPS-FAKKZ(' l_indx ')' INTO g_fieldname.

PERFORM bdc_field USING g_fieldname

it_rec-fakkz.

PERFORM bdc_dynpro USING 'SAPLCJWB' '0999'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=GRND'.

PERFORM bdc_field USING 'BDC_CURSOR'

'PRPS-POSID'.

PERFORM bdc_field USING 'PRPS-POST1'

it_rec-post1.

PERFORM bdc_dynpro USING 'SAPLCJWB' '0999'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=USR1'.

PERFORM bdc_field USING 'PRPS-POST1'

it_rec-post1.

PERFORM bdc_dynpro USING 'SAPLCJWB' '0999'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=GRND'.

PERFORM bdc_field USING 'PRPS-USR01'

it_rec-usr01.

PERFORM bdc_dynpro USING 'SAPLCJWB' '0999'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/EBCK'.

ELSE.

CONCATENATE 'PRPS-BELKZ(' l_indx ')' INTO g_fieldname.

PERFORM bdc_field USING g_fieldname

it_rec-belkz.

PERFORM bdc_dynpro USING 'SAPLCJWB' '0999'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=GRND'.

PERFORM bdc_field USING 'BDC_CURSOR'

'PRPS-POSID'.

PERFORM bdc_field USING 'PRPS-POST1'

it_rec-post1.

PERFORM bdc_dynpro USING 'SAPLCJWB' '0999'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=USR1'.

PERFORM bdc_field USING 'PRPS-POST1'

it_rec-post1.

PERFORM bdc_dynpro USING 'SAPLCJWB' '0999'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=GRND'.

PERFORM bdc_field USING 'PRPS-USR01'

it_rec-usr01.

PERFORM bdc_dynpro USING 'SAPLCJWB' '0999'.

PERFORM bdc_field USING 'BDC_OKCODE'

'/EBCK'.

ENDIF. "IT_REC-STUFE

ENDLOOP. "it_rec

***********coding for deriving structure

PERFORM bdc_dynpro USING 'SAPLCJWB' '0901'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=SRTE'.

******************end of coding

PERFORM bdc_dynpro USING 'SAPLCJWB' '0901'.

PERFORM bdc_field USING 'BDC_OKCODE'

'=BU'.

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

REFRESH messtab.

CLEAR messtab.

CALL TRANSACTION 'CJ02' USING bdcdata

OPTIONS FROM opt MESSAGES INTO messtab.

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

*********MESSAGE TYPE TABLE

LOOP AT messtab WHERE ( msgtyp = 'E' ).

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = messtab-msgid

lang = '-D'

no = messtab-msgnr

v1 = messtab-msgv1

v2 = messtab-msgv2

v3 = messtab-msgv3

v4 = messtab-msgv4

IMPORTING

msg = l_string

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.

ELSE.

it_msg-msgnr = it_rec-pspid.

it_msg-msgtyp = messtab-msgtyp.

it_msg-message = l_string.

APPEND it_msg.

CLEAR it_msg.

CLEAR l_string.

CLEAR messtab.

ENDIF.

ENDLOOP. "IT_REC

REFRESH bdcdata.

CLEAR bdcdata.

ENDLOOP. "IT_REC1

reward points if heloful,

regards,

ravi shankar reddy