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

re: control table VS bdc

Former Member
0 Likes
295

Hi,

I wirtten bdc code to enter the TASKS data into iw22 tcode which contains table control for this. I written the code and it is successfully executing if iam entering new items into tcode if there is no data. But if any data exits in the table control, when i try to change the values it is giving problem. problem si that table control contains 17 lines. So iam using pagedown every 17 lines. But it is skipping

line items after 17 and it is showing last line item in the table control. So what is the solution to see the 18 line item. I appreciate ur help.

Just check it out below code and run this code in ur system and enter the notification number.

rgds

p.kp

data: bdctab like bdcdata occurs 0 with header line,

bdcmsg like bdcmsgcoll occurs 0 with header line,

it_viqmsm like viqmsm occurs 0 with header line.

parameter: qmnum(12) type n.

DATA : I(2) TYPE n,

y(2) type n,

v_fnam(30) TYPE c,

vlines(2) type c value 17,

z type i,

z1 type i,

n type i.

field-symbols: <fs>.

start-of-selection.

do 1 times.

perform main.

call transaction 'IW22' using bdctab

mode 'A'

update 'S'

messages into bdcmsg.

if sy-subrc <> 0.

loop at bdcmsg.

CALL function 'MESSAGE_TEXT_BUILD'

exporting

msgid = bdcmsg-msgid

msgnr = bdcmsg-msgnr

IMPORTING

MESSAGE_TEXT_OUTPUT = bdcmsg-fldname.

modify bdcmsg transporting fldname.

endloop.

endif.

enddo.

loop at bdcmsg.

write: / bdcmsg-msgv1,bdcmsg-msgv2,bdcmsg-fldname.

endloop.

.

form main.

perform bdc_dynpro using 'SAPLIQS0' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RIWO00-QMNUM'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RIWO00-QMNUM'

qmnum.

perform bdc_dynpro using 'SAPLIQS0' '7200'.

perform bdc_field using 'BDC_OKCODE'

'=10\TAB11'.

select * from viqmsm into table it_viqmsm

where qmnum = qmnum.

describe table it_viqmsm lines y.

if y = 0.

  • assign n value for no of items

  • this is for change if already exits

  • suppose

n = 19.

else.

n = y.

endif.

DO n TIMES.

I = I + 1.

********after fill up one page************

IF I > vlines.

if y <> 0.

z1 = z1 + 1.

z = n - vlines * z1.

if z > 0.

I = 1.

else.

I = 2.

endif.

else.

i = 2.

endif.

perform bdc_dynpro using 'SAPLIQS0' '7204'.

perform bdc_field using 'BDC_CURSOR'

V_FNAM.

perform bdc_field using 'BDC_OKCODE'

'=PEND'.

ENDIF.

*******to enter the data*******************

clear: v_fnam.

CONCATENATE 'VIQMSM-MNGRP' '(' I ')' INTO V_FNAM.

perform bdc_dynpro using 'SAPLIQS0' '7204'.

perform bdc_field using 'BDC_CURSOR'

V_FNAM.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using V_FNAM

'm095'.

clear: v_fnam.

CONCATENATE 'VIQMSM-MNCOD' '(' I ')' INTO V_FNAM.

perform bdc_field using 'BDC_CURSOR'

V_FNAM.

perform bdc_field using V_FNAM

'M95B'.

*******end of enter data*********************

ENDDO.

perform bdc_dynpro using 'SAPLIQS0' '7204'.

perform bdc_field using 'BDC_CURSOR'

V_FNAM.

perform bdc_field using 'BDC_OKCODE'

'=BUCH'.

endform.

&----


*& Form bdc_dynpro

&----


  • text

----


  • -->P_0039 text

  • -->P_0040 text

----


form bdc_dynpro using value(p_0039)

value(p_0040).

bdctab-program = p_0039.

bdctab-dynbegin = 'X'.

bdctab-dynpro = p_0040.

append bdctab.

clear bdctab.

endform. " bdc_dynpro

&----


*& Form bdc_field

&----


  • text

----


  • -->P_0044 text

  • -->P_0045 text

----


form bdc_field using value(p_0044)

value(p_0045).

bdctab-fnam = p_0044.

bdctab-fval = p_0045.

append bdctab.

clear bdctab.

endform. " bdc_field

1 REPLY 1
Read only

Former Member
0 Likes
265

before doing the page down u have to check the Input values.

Regards

Prabhu