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 - creating line items

Former Member
0 Kudos

All,

I have used SHDB to record transaction CJ02 . The code works fine until i try to load more than 14 lines then the 15 line is ovewritten. I am passing a next page statement but it is still ovewriting after 14 lines. Can someone please look at the code and advise what i need to do to get it to work please.

The following is the code that i am using :

perform open_group.

loop at i_mat into wa_mat.

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'

wa_mat-proj_pspid.

perform bdc_dynpro using 'SAPLCJWB' '0901'.

perform bdc_field using 'BDC_CURSOR'

'PROJ-POST1'.

perform bdc_field using 'BDC_OKCODE'

'=P+'.

perform bdc_dynpro using 'SAPLCJWB' '0901'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

perform bdc_field using 'BDC_CURSOR'

'PRPS-POST1(02)'.

perform bdc_field using 'PRPS-STUFE(02)'

wa_mat-proj_hr_level.

perform bdc_field using 'RCWBS-IDENT(02)'

wa_mat-proj_element.

perform bdc_field using 'PRPS-POST1(02)'

wa_mat-proj_description.

perform bdc_transaction using 'CJ02'.

endloop.

perform close_group.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Use the "Add Line" button (at the bottom of the screen) to add lines (OK-CODE = NEET).

Rob

7 REPLIES 7

Former Member
0 Kudos

Use the "Add Line" button (at the bottom of the screen) to add lines (OK-CODE = NEET).

Rob

0 Kudos

Hi Rob

At the point i load the WBS elements no other WBS element Lines exist.

So can i still use the add line code?. If i try to manually create a WBS line that has not lines it errors.

thanks for your help

Former Member
0 Kudos

I think you have table control in that screen i guess rite?

so to add more number of records into the table control after these 14 lines added which you are seeing initially you have to write some increment logic

like if it reaches 15 then u have to increment once line in the table control so that it goes to the next line....

0 Kudos

Hi

Yes it has 14 liens i think, using my code as an example can you tell me what logic i need to apply ?

cheers

andy

Former Member
0 Kudos

Hi Rob

The add new line worked until I add 26 lines (each page has 13 lines) so after 2 pages it starts to ovewrite again

perform open_group.

loop at i_mat into wa_mat.

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'

wa_mat-proj_pspid.

perform bdc_dynpro using 'SAPLCJWB' '0901'.

perform bdc_field using 'BDC_CURSOR'

'PROJ-POST1'.

perform bdc_field using 'BDC_OKCODE'

'=P+'.

perform bdc_dynpro using 'SAPLCJWB' '0901'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

perform bdc_field using 'BDC_CURSOR'

'PRPS-POST1(13)'.

perform bdc_field using 'PRPS-STUFE(13)'

wa_mat-proj_hr_level.

perform bdc_field using 'RCWBS-IDENT(13)'

wa_mat-proj_element.

perform bdc_field using 'PRPS-POST1(13)'

wa_mat-proj_description.

perform bdc_field using 'BDC_OKCODE'

'=NEET'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

0 Kudos

Please see following code this ll help...call same screen after the total no of rows displayed in the table control...

use counter for this purpose..

perform bdc_screen using 'SAPMM07I' '0721' 'X'.

i = 1.

loop at itab_stock.

concatenate 'ISEG-MATNR(' i ')' into fnam.

perform bdc_field using fnam itab_stock-matnr.

if i = '12'.

perform bdc_field using 'BDC_OKCODE' '/00'.

perform bdc_screen using 'SAPMM07I' '0721' 'X'.

i = 0.

endif.

i = i + 1.

endloop.

perform bdc_field using 'BDC_OKCODE' '/00'.

perform bdc_screen using 'SAPMM07I' '0721' 'X'.

perform bdc_field using 'BDC_OKCODE' '=BU'.

call transaction 'MI01' using itab_bdcdata mode 'A' MESSAGES INTO

ITAB_msg.

0 Kudos

You can either keep track of how many items you have added and press "more items" each time you fill the page or just press "more items" each time you add an item. I prefer the second method because you don't have to take screen resolution into account.

Rob