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

BDC

ravi_sirigiri
Participant
0 Likes
1,233

1) While creating BDC for Transaction code : <b>AS91 ( Asset Master and Legacy value upload )</b> , Master data is uploaded successfully but there is a problem while

uploading the Legacy data, Values are not uploaded in the corresponding fileds. when i am executing the program i am getting a msg as :

" Field RACT_DYNP_STRUC_ANBTR01(08) INPUT VALUE IS LONGER THAN SCREEN FIELD ".

<b>THE CODE WHICH I HAVE WRITTEN IS:</b>

DATA : BDCDATA LIKE BDCDATA OCCURS 10 WITH HEADER LINE.

DATA : BEGIN OF ITAB OCCURS 10,

ANLKL LIKE ANLA-ANLKL,

BUKRS LIKE ANLA-BUKRS,

TXT50 LIKE ANLA-TXT50,

ANLHTXT LIKE ANLH-ANLHTXT,

INVNR LIKE ANLA-INVNR,

XHIST LIKE RA02S-XHIST,

INKEN LIKE ANLA-INKEN,

AKTIV(10),

GPLAB(10),

KOSTL LIKE ANLZ-KOSTL,

LIFNR LIKE ANLA-LIFNR,

HERST LIKE ANLA-HERST,

XNEU_AM LIKE RA02S-XNEU_AM,

XGBR_AM LIKE RA02S-XGBR_AM,

LAND1 LIKE ANLA-LAND1,

VSART LIKE ANLV-VSART,

VSGES LIKE ANLV-VSGES,

VSSTX LIKE ANLV-VSSTX,

VSZTX LIKE ANLV-VSZTX,

VRSBG(10),

VSTAR LIKE ANLV-VSTAR,

AFASL LIKE ANLB-AFASL,

NDJAR LIKE ANLB-NDJAR,

NDPER LIKE ANLB-NDPER,

AFABG(10),

NDABJ LIKE ANLC-NDABJ,

NDABP LIKE ANLC-NDABP,

<b> ANBTR01 LIKE RALT_DYNP_STRUC-ANBTR01,

ANBTR01_06 LIKE RALT_DYNP_STRUC-ANBTR06,

ANBTR01_08 LIKE RALT_DYNP_STRUC-ANBTR08,</b> END OF ITAB.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

FILENAME = 'C:/AS91.TXT'

FILETYPE = 'DAT'

TABLES

data_tab = ITAB.

CALL FUNCTION 'BDC_OPEN_GROUP'

EXPORTING

CLIENT = SY-MANDT

GROUP = 'RAVI'

KEEP = 'X'

USER = SY-UNAME.

LOOP AT ITAB.

PERFORM FILL_BDCDATA.

CALL FUNCTION 'BDC_INSERT'

EXPORTING

TCODE = 'AS91'

TABLES

dynprotab = BDCDATA.

REFRESH BDCDATA.

ENDLOOP.

CALL FUNCTION 'BDC_CLOSE_GROUP'.

&----


*& Form FILL_BDCDATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM FILL_BDCDATA.

  • include bdcrecx1.

*

  • start-of-selection.

*

  • perform open_group.

perform bdc_dynpro using 'SAPLAIST' '0105'.

perform bdc_field using 'BDC_CURSOR'

'ANLA-ANLKL'.

perform bdc_field using 'BDC_OKCODE'

'=MAST'.

perform bdc_field using 'ANLA-ANLKL'

ITAB-ANLKL.

perform bdc_field using 'ANLA-BUKRS'

ITAB-BUKRS.

perform bdc_dynpro using 'SAPLAIST' '1000'.

perform bdc_field using 'BDC_OKCODE'

'=TAB02'.

perform bdc_field using 'ANLA-TXT50'

ITAB-TXT50.

perform bdc_field using 'ANLH-ANLHTXT'

ITAB-ANLHTXT.

perform bdc_field using 'ANLA-INVNR'

ITAB-INVNR.

perform bdc_field using 'RA02S-XHIST'

ITAB-XHIST.

perform bdc_field using 'ANLA-INKEN'

ITAB-INKEN.

perform bdc_field using 'BDC_CURSOR'

'ANLA-GPLAB'.

perform bdc_field using 'ANLA-AKTIV'

ITAB-AKTIV.

perform bdc_field using 'ANLA-GPLAB'

ITAB-GPLAB.

perform bdc_dynpro using 'SAPLAIST' '1000'.

perform bdc_field using 'BDC_OKCODE'

'=TAB03'.

perform bdc_field using 'BDC_CURSOR'

'ANLZ-KOSTL'.

perform bdc_field using 'ANLZ-KOSTL'

ITAB-KOSTL.

perform bdc_dynpro using 'SAPLAIST' '1000'.

perform bdc_field using 'BDC_OKCODE'

'=TAB04'.

perform bdc_field using 'BDC_CURSOR'

'ANLA-ORD41'.

perform bdc_field using 'RA02S-EQANZ'

'1'.

perform bdc_dynpro using 'SAPLAIST' '1000'.

perform bdc_field using 'BDC_OKCODE'

'=TAB05'.

perform bdc_field using 'BDC_CURSOR'

'ANLA-LAND1'.

perform bdc_field using 'ANLA-LIFNR'

ITAB-LIFNR.

perform bdc_field using 'ANLA-HERST'

ITAB-HERST.

perform bdc_field using 'RA02S-XNEU_AM'

ITAB-XNEU_AM.

perform bdc_field using 'RA02S-XGBR_AM'

ITAB-XGBR_AM.

perform bdc_field using 'ANLA-LAND1'

ITAB-LAND1.

perform bdc_dynpro using 'SAPLAIST' '1000'.

perform bdc_field using 'BDC_OKCODE'

'=TAB06'.

perform bdc_field using 'BDC_CURSOR'

'ANLA-VMGLI'.

perform bdc_dynpro using 'SAPLAIST' '1000'.

perform bdc_field using 'BDC_OKCODE'

'=TAB08'.

perform bdc_field using 'BDC_CURSOR'

'ANLV-VSTAR'.

perform bdc_field using 'ANLV-VSART'

ITAB-VSART.

perform bdc_field using 'ANLV-VSGES'

ITAB-VSGES.

perform bdc_field using 'ANLV-VSSTX'

ITAB-VSSTX.

perform bdc_field using 'ANLV-VSZTX'

ITAB-VSZTX.

perform bdc_field using 'ANLV-VRSBG'

ITAB-VRSBG.

perform bdc_field using 'ANLV-VSTAR'

ITAB-VSTAR.

perform bdc_dynpro using 'SAPLAIST' '1000'.

perform bdc_field using 'BDC_OKCODE'

'=ALTD'.

perform bdc_field using 'BDC_CURSOR'

'ANLC-NDABJ(01)'.

perform bdc_field using 'ANLB-AFASL(01)'

ITAB-AFASL.

perform bdc_field using 'ANLB-NDJAR(01)'

ITAB-NDJAR.

perform bdc_field using 'ANLB-NDPER(01)'

ITAB-NDPER.

perform bdc_field using 'ANLB-AFABG(01)'

ITAB-AFABG.

perform bdc_field using 'ANLC-NDABJ(01)'

ITAB-NDABJ.

perform bdc_dynpro using 'SAPLALTD' '1100'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

<b> 'RALT_DYNP_STRUC-ANBTR01(08)'.

perform bdc_field using 'RALT_DYNP_STRUC-ANBTR01(01)'

ITAB-ANBTR01.

perform bdc_field using 'RALT_DYNP_STRUC-ANBTR01(06)'

ITAB-ANBTR01_06.

perform bdc_field using 'RALT_DYNP_STRUC-ANBTR01(08)'

ITAB-ANBTR01_08.</b> perform bdc_dynpro using 'SAPLALTD' '1100'.

perform bdc_field using 'BDC_CURSOR'

'ANLA-ANLN1'.

perform bdc_field using 'BDC_OKCODE'

'=SAVE'.

perform bdc_field using 'BDC_OKCODE'

'=BUCH'.

  • perform bdc_transaction using 'AS91'.

*

  • perform close_group.

ENDFORM. " FILL_BDCDATA

----


  • Start new screen *

----


FORM BDC_DYNPRO USING PROGRAM DYNPRO.

CLEAR BDCDATA.

BDCDATA-PROGRAM = PROGRAM.

BDCDATA-DYNPRO = DYNPRO.

BDCDATA-DYNBEGIN = 'X'.

APPEND BDCDATA.

ENDFORM.

----


  • Insert field *

----


FORM BDC_FIELD USING FNAM FVAL.

IF FVAL <> SPACE.

CLEAR BDCDATA.

BDCDATA-FNAM = FNAM.

BDCDATA-FVAL = FVAL.

APPEND BDCDATA.

ENDIF.

ENDFORM.

-


The values are not populated into these fields:

'RALT_DYNP_STRUC-ANBTR01(01)'

'RALT_DYNP_STRUC-ANBTR01(06)'

'RALT_DYNP_STRUC-ANBTR01(08)'

CAN ANYONE PLEASE GIVE ME THE SOLUTION FOR THIS.

Thanks and Regards,

Ravi

1 ACCEPTED SOLUTION
Read only

former_member186741
Active Contributor
0 Likes
1,022

I think the fields need to be char, try this in ITAB:

ANBTR01(16),

ANBTR01_06(16),

ANBTR01_08(16),

8 REPLIES 8
Read only

Former Member
0 Likes
1,022

HI Ravi,

hope you missed the

perform bdc_field  using..
  ITAB-NDABP

i hope this might be the poblem..

regards

satesh

Read only

0 Likes
1,022

Hi Satesh,

Even if i include

perform bdc_field  using..
  ITAB-NDABP

It is not solved.

Thanks and Regards,

Ravi

Read only

0 Likes
1,022

HI Ravi,

i think you can record once again ..

coz theprobelm is somewhere here..

this code is not in the same order as there are fields in your itab..

here you have ITAB-NDABJ ITAB-ANBTR01. ITAB-ANBTR01_06. ITAB-ANBTR01_08 and in ITAB you have..

ITAB-NDABJ ITAB-NDABP ITAB-ANBTR01. ITAB-ANBTR01_06. ITAB-ANBTR01_08..

the order is different..

perform bdc_field using 'ANLC-NDABJ(01)'

ITAB-NDABJ.

perform bdc_dynpro using 'SAPLALTD' '1100'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'BDC_CURSOR'

'RALT_DYNP_STRUC-ANBTR01(08)'.

perform bdc_field using 'RALT_DYNP_STRUC-ANBTR01(01)'

ITAB-ANBTR01.

perform bdc_field using 'RALT_DYNP_STRUC-ANBTR01(06)'

ITAB-ANBTR01_06.

perform bdc_field using 'RALT_DYNP_STRUC-ANBTR01(08)'

regards

satesh

Read only

0 Likes
1,022

Hi Satesh,

I had specified ITAB-NDABP in the program, while copying the program it was missed, actually i am executing with this code itself.


perform bdc_field using 'ANLC-NDABJ(01)'
ITAB-NDABJ.
perform bdc_field using 'ANLC-NDABP(01)'
ITAB-NDABP.
perform bdc_dynpro using 'SAPLALTD' '1100'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'BDC_CURSOR'
'RALT_DYNP_STRUC-ANBTR01(08)'.
perform bdc_field using 'RALT_DYNP_STRUC-ANBTR01(01)'
ITAB-ANBTR01.
perform bdc_field using 'RALT_DYNP_STRUC-ANBTR01(06)'
ITAB-ANBTR01_06.
perform bdc_field using 'RALT_DYNP_STRUC-ANBTR01(08)'

STILL THE SAME PROBLEM.

Thanks and Regards,

Ravi

Read only

Former Member
0 Likes
1,022

HI

A date is stored as eight characters (always YYYYMMDD), but the output length in the domain should be specified as 10 to enable two separators to be inserted. So please try with making the length as 10.

Regards

Anoop

Read only

0 Likes
1,022

Hi Anoop,

I did specify the output length as 10 ( AKTIV(10),GPLAB(10)) in the code.Even there is a problem.

Thanks and Regards,

Ravi

Read only

former_member186741
Active Contributor
0 Likes
1,023

I think the fields need to be char, try this in ITAB:

ANBTR01(16),

ANBTR01_06(16),

ANBTR01_08(16),

Read only

0 Likes
1,022

Hi Neil,

Thanks for the help.Its working.

Thanks and Regards,

Ravi