‎2006 Mar 19 10:04 AM
Hi All,
In following code, how can I change '02' with dynamic number.
perform bdc_field using 'BDC_CURSOR'
'RM06E-EVRTP(02)'.
Thanks,
Pratibha.
‎2006 Mar 19 1:24 PM
Hi Pratibha,
One way of doing is to use MACROs..
try this..
DEFINE bdc_field.
perform bdc_field using 'BDC_CURSOR'
'RM06E-EVRTP(&1)'.
END-OF-DEFINITION.
data w_cnt(2) type n.
do 10 times.
w_cnt = w_cnt + 1.
bdc_field w_cnt.
enddo.
This piece of code would generate 10 PERFORM BDC_FIELD statements from 'RM06E-EVRTP(01)' through 'RM06E-EVRTP(10)'.
Regards,
Suresh Datti
‎2006 Mar 19 2:45 PM
HI Pratiba,
try using FM GET_JOB_NUMBER..
which keeps giving the next number .. even without any input..it gives the next number even if you quit and run the program next time..
you can just cal this before.
perform bdc_field using 'BDC_CURSOR'
'RM06E-EVRTP(02)'.
regards
satesh
‎2006 Mar 19 7:41 PM
Try:
DATA: num(2),
field(20).
DO 15 TIMES.
WRITE sy-index TO num.
CONCATENATE 'RM06E-EVRTP(' num ')' INTO field.
PERFORM bdc_field USING 'BDC_CURSOR'
field.
ENDDO.
You can replace the 'DO 15 TIMES' with however many repetitions you need. It too can be dynamic.
Rob
‎2006 Mar 20 10:31 AM
hi prathiba,
this is the standard type for declaration of items
DATA: C LIKE BSID-MONAT.
*best move is declare the variables to which the population is taking place .
*into this variable we will pass the concatenated field.
DATA: W_LTAX1(18),
W_SLWID(18),
W_FLG_SEL(18),
W_USR00(18),
W_USR01(18),
W_USR02(18),
W_USR03(18),
W_KZYK1(18).
DATA : W_COUNT TYPE I.
if w_count = 1.
C = w_count.
CONCATENATE 'PLPOD-LTXA1(' C ')' INTO W_LTAX1.
CONCATENATE 'PLPOD-SLWID(' C ')' INTO W_SLWID.
CONCATENATE 'RC27X-FLG_SEL(' C ')' INTO W_FLG_SEL.
CONCATENATE 'PLPOD-USR00(' C ')' INTO W_USR00.
CONCATENATE 'PLPOD-USR01(' C ')' INTO W_USR01.
CONCATENATE 'PLPOD-USR02(' C ')' INTO W_USR02.
CONCATENATE 'PLPOD-USR03(' C ')' INTO W_USR03.
CONCATENATE 'RIEWP-KZYK1(' C ')' INTO W_KZYK1.
say c = 1 for header level .
4. now in here if u want to dynamically add the value in the item level what u need do do is
in the loop at itab.
w_count = 1. ( for header)
w_count = w_count + 1.(for item)
at end header.
clear: w_count, c.
endat.
endloop.
if any item is there then increment the w_count .
now suppose say for a header .
C = w_count.
w_count = w_count + 1.
CONCATENATE 'PLPOD-LTXA1(' C ')' INTO W_LTAX1.
CONCATENATE 'PLPOD-SLWID(' C ')' INTO W_SLWID.
CONCATENATE 'RC27X-FLG_SEL(' C ')' INTO W_FLG_SEL.
CONCATENATE 'PLPOD-USR00(' C ')' INTO W_USR00.
CONCATENATE 'PLPOD-USR01(' C ')' INTO W_USR01.
CONCATENATE 'PLPOD-USR02(' C ')' INTO W_USR02.
CONCATENATE 'PLPOD-USR03(' C ')' INTO W_USR03.
CONCATENATE 'RIEWP-KZYK1(' C ')' INTO W_KZYK1.
this dynamically places 01 , 02 , 03 and so on into C.
at end of header level clear the w_count or reset it .
this is the approach .
hope this helps ,
regards,
vikky.
so in here the perform structures will be like this .
perform bdc_dynpro using 'SAPLCPDI' '3400'.
perform bdc_field using W_FLG_SEL
' '.
perform bdc_field using 'BDC_CURSOR'
W_LTAX1.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using w_ltax1
IT_DATA1-LTXA1.
perform bdc_field using w_slwid
'0000001'.
perform bdc_dynpro using 'SAPLCPDI' '3400'.
perform bdc_field using 'BDC_CURSOR'
w_ltax1.
perform bdc_field using 'BDC_OKCODE'
'=WPLT'.
perform bdc_field using W_FLG_SEL
'X'.
perform bdc_field using W_USR00
IT_DATA1-USR00.
perform bdc_field using W_USR01
IT_DATA1-USR01.
perform bdc_field using W_USR02
IT_DATA1-USR02.
perform bdc_field using W_USR03
IT_DATA1-USR03.
imp note .
perform bdc_field using W_USR00
holds the value of 'PLPOD-USR00(' C ')'
and c varies from 01 02 03 04 etc ..
Message was edited by: Vikky
‎2006 Mar 20 11:12 AM
Hi pratibha,
1. perform bdc_field using 'BDC_CURSOR'
'RM06E-EVRTP(02)'.
The text <b>'RM06E-EVRTP(02)'</b>
is nothing but a character text.
2. hence, we can provide it as a VARIABLE
also,
and in that variable we can
dynamnically put anything we want.
perform bdc_field using 'BDC_CURSOR'
<b> myvariable</b>
where myvariable will contain (in a loop)
'RM06E-EVRTP(01)'
'RM06E-EVRTP(02)'
'RM06E-EVRTP(03)'
'RM06E-EVRTP(04)'
... and so on
3.
and we can consruct the myvariable like this :
CONCATENATE 'RM06E-EVRTP(' <b>mycounter </b> ')' INTO <b>myvariable</b>
regards,
amit m.