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 to Change the BOM Matetial

Former Member
0 Kudos

Hi experts,

I am working on a bdc to change BOM Material tcode CS02.

here some custom fields are added into the standard transaction CS02.

I need to upload data into these custom fields through CS02.

My problem is to capture the line items.

for the first line item there is no problem.

to select the item the field is 'RC29P-AUSKZ(01)' (check box) for the first line item (POSNR = 10).

we need to pass 'X' to this field to select the first line item.

to select the second line item (POSNR = 20) we need to pass 'X' to 'RC29P-AUSKZ(02)'.

for the third line item (POSNR = 30).

we dont know how many item are there,

and also we dont the sequence.

Can any body help to solve the issue.

Thanks in advance,

Sudheer.

10 REPLIES 10

Former Member
0 Kudos

Hi Sudheer,

Well in this case, your code will be in the loop at item level table. So, before looping, you can use describe table to check how many line items you will have to insert.

Then, while writing code for BDC, insert first record, then scroll down by one line. By this way, you will not have to changes the

position of your line item i.e. 'RC29P-AUSKZ(02)'. You can just write a code for single line item 'RC29P-AUSKZ(01)' and sroll down code within a loop at your item level table.

Means every time you scroll down, your position will be set to 1 and same code will fill out as many line items you want and you need not hard code the position.

Hope it helps.

Thanks,

Archana

0 Kudos

Hi Archana,

Thanks for ur reply.

I am doing the same thing as u have mentioned.

but unfortunately it is not working,

can u tell me in detail how to achieve this.

Thanks,

Sudheer

0 Kudos

Hi,

Is your scroll working properly in your code?

Check in foreground if scroll is working fine. i Think it is working in your case. If it is not working then check, which value it is updating in first line item. It must be the last value in your item table.

Is there any position button available for your table control? Check it is available at the end of the table control. It becomes easy to set position using that button.

Thanks,

Archana

0 Kudos

Hi Sudheer,

first you need to do the reocrding through SHDB using Default size.

loop the item internal table.

in the initial screen you can see four line items ( depends on your screen resolution), after updating the custom fields for first four line items, press the page down.

Now the fourth item item will become the fist line item after the page down. Like this you need to proceed.

Cheers,

Sriram.

0 Kudos

Hi,

Just I am testing with only 2 line items.

till now I didnt go for page down.

even for 2 line items also it is working for only first line item.

im not able select the second line item through BDC.

if we hard code as below it is working, but only for second line item

perform bdc_field using 'BDC_CURSOR'

'RC29P-AUSKZ(02)'.

perform bdc_field using 'BDC_OKCODE'

'=PALL'.

perform bdc_field using 'RC29P-AUSKZ(02)'

'X'.

I need pass 'X to 'RC29P-AUSKZ(01)' in case of first line item.

or else to 'RC29P-AUSKZ(02)' in case of second line item.

or else 'RC29P-AUSKZ(02)' in case of third line item to select the line item and go to next screen and there in the next screen

we need enter the data into the custom fields.

can you give any suggestion.

Thanks,

Sudheer

Edited by: sudheer kumar on Mar 11, 2010 8:03 AM

Former Member
0 Kudos

Hi Sudheer,

Take the count of no.of item compoenents and loop at item level table.

Then, in BDC the cursor position for each and every item shold be concatenate manually in ur code.

Eg.

Loop at Item_table.

g_Count1 = '10'.

LOOP AT G_T_LIPS WHERE VBELN = S_DELIV.

CONCATENATE 'LIPS-POSNR' '(' G_COUNT1 ')' INTO G_LIPS-POSNR.

CONCATENATE 'RV50A-LIPS_SELKZ' '(' G_COUNT1 ')' INTO G_RV50A-LIPS_SELKZ.

  • CONCATENATE 'LIPS-LFIMG' '(' G_COUNT1 ')' INTO G_LIPS-LFIMG1.

CONCATENATE 'LIPSD-G_LFIMG' '(' G_COUNT1 ')' INTO G_LIPS-LFIMG2.

CONCATENATE 'LIPS-VRKME' '(' G_COUNT1 ')' INTO G_LIPS-VRKME1.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

G_LIPS-POSNR.

Explanation

*For 1st item the value in G_LIPS-POSNR is as LIPS-POSNR(10).

G_RV50A-LIPS_SELKZ is as RV50A-LIPS_SELKZ(10)

*For 2nd item the value in G_LIPS-POSNR is as LIPS-POSNR(20).

G_RV50A-LIPS_SELKZ is as RV50A-LIPS_SELKZ(20)

PERFORM BDC_FIELD USING G_RV50A-LIPS_SELKZ

'X'.

G_count2 = G_Count2 + 10.

Endloop.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=SAVE'.

In ur case Count2 is '0010'.

Hope this helps you.

Regards,

Ravinder

0 Kudos

Hi Ravinder,

My problem is to select the check box field for each line item.

i tried with the below code but it is not working.

vl_idx = 1.

loop at it_item into wa_item where matnr = wa_header-matnr.

perform bdc_dynpro using 'SAPLCSDI' '0150'.

concatenate 'RC29P-AUSKZ(0' vl_idx ')' into vl_field.

perform bdc_field using 'BDC_CURSOR'

vl_field.

perform bdc_field using 'BDC_OKCODE'

'=PALL'.

perform bdc_field using vl_field

'X'.

perform bdc_dynpro using 'SAPLCSDI' '2130'.

perform bdc_field using 'BDC_OKCODE'

'=PDAT'.

perform bdc_field using 'BDC_CURSOR'

'RC29P-POSNR'.

perform bdc_field using 'RC29P-POSNR'

wa_item-posnr.

perform bdc_field using 'RC29P-IDNRK'

wa_item-idnrk.

i need to pass 'X' to check box field name is 'RC29P-AUSKZ(01)' for first item

and 'X' to 'RC29P-AUSKZ(02)' for second item.

how to do this

Thanks,

Sudheer

Edited by: sudheer kumar on Mar 11, 2010 8:16 AM

Edited by: sudheer kumar on Mar 11, 2010 8:26 AM

0 Kudos

Hi,

Debug and see what value VL_FIELD contians. See wether it has spaces.

Regards,

Shanmugavel chandrasekaran

0 Kudos

Hi Sudheer,

Yoiur code should be as follows:

loop at it_item into wa_item where matnr = wa_header-matnr.

perform bdc_dynpro using 'SAPLCSDI' '0150'.

concatenate 'RC29P-AUSKZ(0' vl_idx ')' into vl_field.

check the data type of Vl_IDX it should be only 1 char according to ur logic.

Check the value of vl_field in Debugging mode.It sholud be 'RC29P-AUSKZ(01)'.

perform bdc_field using 'BDC_CURSOR'

vl_field.

perform bdc_field using 'BDC_OKCODE'

'=PALL'.

perform bdc_field using vl_field

'X'.

perform bdc_dynpro using 'SAPLCSDI' '2130'.

perform bdc_field using 'BDC_OKCODE'

'=PDAT'.

What i understood from ur code is that your selecting the fistline item(main material) and you are going to some other screen (SAPLCSDI) to change the BOM component details.So to do this You need to do concatenation for the below fileds also.Because cocatenating only "'RC29P-AUSKZ(0' vl_idx ')' into vl_field:" will not resolve ur problem,you need to concatenate the POSNR idnrk fileds also.

Loop at BOMITEMS

VL_DX1 = 1.

concatenate 'RC29P-POSNR(0' vl_idx1 ')' into vl_field1.

concatenate 'RC29P-POSNR(0' vl_idx1 ')' into vl_field1.

perform bdc_field using 'BDC_CURSOR'

vl_field1.

perform bdc_field using vl_field1

wa_item-posnr.

perform bdc_field using 'RC29P-IDNRK'

wa_item-idnrk.

VLIDX1 = vLIDX1 + 1.

ENDLOOP.

vl_idx = vl_idx + 1.

Endloop.

Regards,

Ravinder

Former Member
0 Kudos

Hi,

Dont use Page down.

Instead position button is there select the postion button in the recording provide the Item number you want to change.

That particular item comes in the first line. So dont need to increment the table control row.

regrads,

shanumgavel chandrasekaran