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

BDC code for modify mode

Former Member
0 Likes
2,162

All,

I have specific problem with BDC session.

i am using following code to create record in SAP for creating notifications(IQS1). This is working fine in create mode for as many as records. Becuase after every 2 lines, using =PEND for pagedown. The same code is working fine in modify mode also if number of records are same.But If user has already created (lets say 5 records) and want to add 2 more records. Then in modify mode there are total 7 records i.e.passing all previous 5 and plus 2 new records. That time it is not working fine. It is creating total 10 records.What special should i do for modify mode?

I have variable p_mode going into this form and have values CREATE or MOIDFY. i can use the same if i want to do something special for modify mode. please help.

DATA: wt_bdc TYPE STANDARD TABLE OF bdcdata,

wa_bdc LIKE LINE OF wt_bdc.

FORM ITEM_DATA USING VALUE(p_qmfe) LIKE wt_qmfe

p_mode LIKE wm_mode

CHANGING P_RETURN LIKE return.

SORT p_qmfe BY fenum posnr.

LOOP AT p_qmfe INTO wa_qmfe.

IF wa_qmfe_cntr > 2.

wa_qmfe_cntr = 2.

perform bdc_dynpro using 'SAPLIQS0' '7204'.

perform bdc_field using 'BDC_OKCODE' '=PEND'.

ENDIF.

ENDIF.

CONCATENATE 'VIQMFE-POSNR(' wa_qmfe_cntr ')' INTO wm_qmfe_posnr.

CONCATENATE 'VIQMFE-OTGRP(' wa_qmfe_cntr ')' INTO wm_qmfe_otgrp.

CONCATENATE 'VIQMFE-OTEIL(' wa_qmfe_cntr ')' INTO wm_qmfe_oteil.

CONCATENATE 'VIQMFE-FETXT(' wa_qmfe_cntr ')' INTO wm_qmfe_fetxt.

perform bdc_field using wm_qmfe_posnr wa_qmfe-posnr.

perform bdc_field using wm_qmfe_otgrp wa_qmfe-otgrp.

perform bdc_field using wm_qmfe_oteil wa_qmfe-oteil.

perform bdc_field using wm_qmfe_fetxt wa_qmfe-fetxt.

wa_qmfe_cntr = wa_qmfe_cntr + 01.

ENDLOOP.

CLEAR P_MESSTAB.

CALL TRANSACTION 'IQS2' USING wt_bdc

MODE 'N'

UPDATE 'S'

MESSAGES INTO P_MESSTAB.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,914

If you cannot absolutely determine the maximum rows on the screen, you are going to find the modify pretty tough. I would not try to deal with any existing rows as you will find getting to the correct row quite problematic. I would look to see if there is a way to get past those existing rows.

Is the a "P++" (last page) button or a position (find) button?

You might look to see if you can find a function module (bapi).

Cheers

John

14 REPLIES 14
Read only

Former Member
0 Likes
1,915

If you cannot absolutely determine the maximum rows on the screen, you are going to find the modify pretty tough. I would not try to deal with any existing rows as you will find getting to the correct row quite problematic. I would look to see if there is a way to get past those existing rows.

Is the a "P++" (last page) button or a position (find) button?

You might look to see if you can find a function module (bapi).

Cheers

John

Read only

0 Likes
1,914

Thanks john for reply.

We can not ignore existing rows as there might change in existing columns. I have also tried P++ but it is not working.

Any other suggestion please......

Read only

0 Likes
1,914

Hi,

If your problem is with page down then try below option. In my case it worked fine.

While doing the recording, select the option POSITION instead of pagedown.

for any table control you have an option at the botton called POSITION, using which you can be able to locate a record the table control

these can be captured in the recording, which will ease your BDC for handling optios like pagedown.

Thansk,

Archana

Read only

0 Likes
1,914

Hi Archana,

Could you please explain in detail one more time.. please.

All,

Any other option

Edited by: Rob Burbank on Feb 8, 2010 3:49 PM

Read only

0 Likes
1,914

Maybe standard SAP program RIIBIP00 would be a better choice. See its documentation and also note 38300.

Rob

Read only

0 Likes
1,914

Hi Yogesh,

I was working on BDC for TK11, in which i had to enter 34 entries. There was button available at the end of the table called line, which indicates position of the table entry. As page down was not working in my case, i used that position button, and moved to new entry using that button. This option is possible only if 'Position' button is available. Part BDC code for position button is given below.

PERFORM bdc_dynpro      USING 'SAPLWMMB' '0200'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                'Y_CHAR_VAL'.
      PERFORM bdc_field       USING 'Y_CHAR_VAL'
                                l_v_position.               
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                '=ENTR'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                '/00'.
      PERFORM bdc_dynpro      USING 'SAPLWMMB' '6000'.
      PERFORM bdc_field       USING 'BDC_OKCODE'
                                '=POSI'.
      PERFORM bdc_field       USING 'BDC_SUBSCR'
                                'SAPLV57S                                0100HEADER'.
      PERFORM bdc_field       USING 'BDC_SUBSCR'
                                'SAPLV57S                                0101SHEET'.
      PERFORM bdc_field       USING 'BDC_SUBSCR'
                                'SAPLWMMB                                2101MTX_SUBSC'.
      PERFORM bdc_field       USING 'BDC_CURSOR'
                                'VL01(01)'.

Thanks,

Archana

Edited by: Archana Pawar on Feb 9, 2010 4:38 AM

Read only

0 Likes
1,914

Hi Yogesh,

I think in your case 'Position' button is not available. So, during BDC recording check if sroll is getting recorded. So, after entering 1 record you can scroll down, enter another record, again scoll down and so on.

Just try it out, if it works.

Also, refer to below thread for more suggestion on page down.

[;

Thanks,

Archana

Read only

0 Likes
1,914

Thanks archana for reply.

You are right. position button is not available and the other way u have mentioned, i am already doing it. see code pasted in question. Below part is doing that.scroll down after entring every record. PEND for pagedown. This is working fine for create mode. But not for modify mode as i have few modified rows plus few new new rows.

IF wa_qmfe_cntr > 2.

wa_qmfe_cntr = 2.

perform bdc_dynpro using 'SAPLIQS0' '7204'.

perform bdc_field using 'BDC_OKCODE' '=PEND'.

ENDIF.

ENDIF.

Btw,link given in above post is of my question only.......

Read only

0 Likes
1,914

Hi Yogesh,

Sorry for the link. I intended to give you other link. Please refer below link.

[;

Thanks,

Archana

Read only

0 Likes
1,914

This message was moderated.

Read only

0 Likes
1,914

Hi Yogesh,

Ok. So, you had last page button available for your table.

Another most important part is using following call transaction statement which is always is taking default screen size. That means no of lines are fixed for every user and easy to identify when to do next page and last page.

DATA:wa_opt TYPE ctu_params.
wa_opt-dismode = 'N'.
wa_opt-updmode = 'S'.
wa_opt-defsize = 'X'.
CALL TRANSACTION 'IQS2' USING wt_bdc
OPTIONS FROM wa_opt
MESSAGES INTO P_MESSTAB.

Sometimes this also does not work, as in my case happened. I was able to display only 19 records here and at client side they were able to see 22 records at a time. So, it was not working in my case.

Also, mark the thread as answered .

And in btw, u guessed it right. Me pan marathi aahe, pan mumbaikar nahi.

Thanks,

Archana

Edited by: Archana Pawar on Feb 10, 2010 1:32 PM

Edited by: Archana Pawar on Feb 10, 2010 1:33 PM

Edited by: Rob Burbank on Feb 10, 2010 9:02 AM

Read only

0 Likes
1,914

Hi Archana,

Even i noticed the same that different users can see different number of records. so, did u try using default size in CALL TRANSACTION as i mentioned above?

This always set no. of line to 9, that is what i noticed and then doing next page on that basis for existing rows. It is working for me. For new record addition always using last page and then addition.

For next page - perform bdc_field using 'BDC_OKCODE' '=PNPG'.

For last page - perform bdc_field using 'BDC_OKCODE' '=PEND'.

Yeah.. giving full rewards.Thanks.

hummmmm.....mag kadachit punekar. jst another wild guess.:-)

Regards,

Yogesh

Read only

0 Likes
1,914

Yes,

I tried that option also. But it was not working at all in my case. Actually i was working on BDC table control of TK11 tcode. Only position button helped me in my BDC data upload.

Thanks,

Archana

Read only

Former Member
0 Likes
1,914

Hello,

In the modify mode write a select query in to the correponding table and find how many records are existing. Based on that determine the counter and use it accordngly to update the new reocrds

Vikranth Reddy