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

Dynamic Number

Former Member
0 Likes
792

Dear All,

In my BDC I have

perform bdc_field using 'ESLL-SRVPOS<b>(01)</b>'

RECORD-SRVPOS.

I would like to make (01) dynamic so that I can enter many service items.

How can I introduce variable in place of 01.

Thanks,

Pratibha

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
716

Try this.

data: bdc_index(2) type n.
data: bdc_field(30) type c.

bdc_index = 1.

concatenate 'ESLL-SRVPOS(' bdc_index ')'
      into bdc_field.
condense bdc_field no-gaps.


perform bdc_field using bdc_field
RECORD-SRVPOS.

Regards,

Rich Heilman

4 REPLIES 4
Read only

Manohar2u
Active Contributor
0 Likes
716

<b>concatenate</b> ESLL-SRVPOS with count

Regds

Manohar

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
717

Try this.

data: bdc_index(2) type n.
data: bdc_field(30) type c.

bdc_index = 1.

concatenate 'ESLL-SRVPOS(' bdc_index ')'
      into bdc_field.
condense bdc_field no-gaps.


perform bdc_field using bdc_field
RECORD-SRVPOS.

Regards,

Rich Heilman

Read only

guillaume-hrc
Active Contributor
0 Likes
716

Hi,

Simply use a variable to hold the entire string that you pass to the 'BDC_FIELD' subroutine or yours.

For instance :

DATA: w_index(2)      TYPE n VALUE '03'.
DATA: w_fieldname(30) TYPE c.

*... change value of w_index here

CONCATENATE 'ESLL-SRVPOS(' w_index ')' INTO w_fieldname.

perform bdc_field using w_fieldname RECORD-SRVPOS.

Best regards,

Guillaume

PS : Sorry Rich, almost the same solution, you are too fast

Message was edited by: Guillaume Garcia

Read only

Former Member
0 Likes
716

Hi

You can use a variable to count the lines and then create the index concatenating that counter to field name, something like this:

DATA: INDEX(2) TYPE N,

FIELD(10).

LOOP AT RECORD.

MOVE SY-TABIX TO INDEX.

or

INDEX = INDEX + 1.

CONCATENATE 'ESLL-SRVPOS(' INDEX ')' INTO FIELD.

perform bdc_field using FIELD

RECORD-SRVPOS.

ENDLOOP.

Max