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: 

Concatenating sy-tabix with field name

Former Member
0 Kudos

While doing BDC I need to concatenate the sy-tabix with the field as the BDC is on item level.

 LOOP AT request INTO wa_request.
    PERFORM dynpro USING:
        'X'     'SAPMV50A'              '1000',
        ' '     'BDC_OKCODE'            '=CHSP_T',
        ' '     'BDC_CURSOR'            'LIPS-POSNR('& sy-tabix &')',
        ' '     'BDC_OKCODE'            '=CHSP_T',
        ' '     'BDC_CURSOR'            'LIPS-POSNR(01)',
 ENDLOOP.

As you can see I am trying to concatenate the sy-tabix so it will appear as LIPS-POSNR(01) and then LIPS-POSNR(02) .. How to accomplish this. Thank you

1 ACCEPTED SOLUTION

naimesh_patel
Active Contributor
0 Kudos

Try this one:

data l_tabix(2) type n,
l_field(30) type c.


 LOOP AT request INTO wa_request.
  l_tabix = sy-tabix. 
  CONCATENATE 'LIPS-POSNR(' l_tabix ')' INTO l_field.
    PERFORM dynpro USING:
        'X'     'SAPMV50A'              '1000',
        ' '     'BDC_OKCODE'            '=CHSP_T',
        ' '     'BDC_CURSOR'            l_field,
        ' '     'BDC_OKCODE'            '=CHSP_T',
        ' '     'BDC_CURSOR'            'LIPS-POSNR(01)',
 ENDLOOP.

Regards,

Naimesh Patel

5 REPLIES 5

Former Member
0 Kudos

Hi,

Define a variable as below

data lv_tabix(2) type n.

Now

lv_tabix = sy-tabix.

CONCATENATE 'LIPS-POSNR(' lv_tabix ')' INTO <some variable>

Regards,

Atish

Former Member
0 Kudos

Why don't you concatenate before the perform statement and pass the variable to the perform.

Thanks,

Srinivas

naimesh_patel
Active Contributor
0 Kudos

Try this one:

data l_tabix(2) type n,
l_field(30) type c.


 LOOP AT request INTO wa_request.
  l_tabix = sy-tabix. 
  CONCATENATE 'LIPS-POSNR(' l_tabix ')' INTO l_field.
    PERFORM dynpro USING:
        'X'     'SAPMV50A'              '1000',
        ' '     'BDC_OKCODE'            '=CHSP_T',
        ' '     'BDC_CURSOR'            l_field,
        ' '     'BDC_OKCODE'            '=CHSP_T',
        ' '     'BDC_CURSOR'            'LIPS-POSNR(01)',
 ENDLOOP.

Regards,

Naimesh Patel

Former Member
0 Kudos

Hi,

You need to use a specific field for that :

data : text_field(14) type c,

idx(2) type n.

idx = sy-tabix.

concatenate 'LIPS-POSNR(' idx ')' into text_field.

and then you can use it in your BDC coding :

PERFORM dynpro USING:

'X' 'SAPMV50A' '1000',

' ' 'BDC_OKCODE' '=CHSP_T',

' ' 'BDC_CURSOR' text_field,

' ' 'BDC_OKCODE' '=CHSP_T',

' ' 'BDC_CURSOR' 'LIPS-POSNR(01)',

Regards,

Nicolas.

ferry_lianto
Active Contributor
0 Kudos

Hi,

Please try this.


DATA: v_bdccur(30) type c,
                    
LOOP AT request INTO wa_request.
  clear v_bdccur.
  v_bdccur = 'LIPS-POSNR(' sy-tabix ')'.
  condense v_bdccur no-gaps.

   PERFORM dynpro USING:
        'X'     'SAPMV50A'              '1000',
        ' '     'BDC_OKCODE'            '=CHSP_T',
        ' '     'BDC_CURSOR'            v_bdccur,
        ' '     'BDC_OKCODE'            '=CHSP_T',
        ' '     'BDC_CURSOR'            'LIPS-POSNR(01)',
 ENDLOOP. 

Regards,

Ferry Lianto