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

Material Exclusion

Former Member
0 Likes
402

Hi Experts,

my requirement is uploading material exclusion data throuh bdc program to sap database.

i am getting an error is komgg-matnr doen't exist in loop for sapm13g screen 1001.

report ZMEXCLUSIONPGM

no standard page heading line-size 255.

include bdcrecx1.

tables:g000,komgg.

data:begin of itab occurs 0,

kschl like g000-kschl,

kunnr like komgg-kunnr,

datab like g000-datab,

datbi like g000-datbi,

matnr(150) type c,

end of itab.

DATA:BEGIN OF MATNR OCCURS 0,

MATNR LIKE MARA-MATNR,

END OF MATNR.

data:fld(20) type c,

cnt(2) type n,

x(2) type n,

n(2) type n.

DATA:VAR(10) TYPE C,

var1(10) type c.

start-of-selection.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'c:\mexclusion.txt'

FILETYPE = 'ASC'

HAS_FIELD_SEPARATOR = 'X'

TABLES

DATA_TAB = itab.

loop at itab.

split itab-MATNR AT ',' into table MATNR.

endloop.

n = 0.

loop at matnr.

n = n + 1.

endloop.

perform open_group.

loop at itab.

perform bdc_dynpro using 'SAPMV13G' '0100'.

perform bdc_field using 'BDC_CURSOR'

'G000-KSCHL'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'G000-KSCHL'

itab-kschl.

x = 1.

perform bdc_dynpro using 'SAPMV13G' '1001'.

*----


*perform bdc_field using 'BDC_CURSOR'

  • 'KOMGG-MATNR(01)'.

*perform bdc_field using 'BDC_OKCODE'

  • '/00'.

perform bdc_field using 'KOMGG-KUNNR'

itab-kunnr.

perform convert_date.

perform bdc_field using 'G000-DATAB'

var.

perform convert_date1.

perform bdc_field using 'G000-DATBI'

var1.

*perform bdc_field using 'KOMGG-MATNR(01)'

  • '1314'.

*perform bdc_dynpro using 'SAPMV13G' '1001'.

*perform bdc_field using 'BDC_CURSOR'

  • 'KOMGG-MATNR(02)'.

*perform bdc_field using 'BDC_OKCODE'

  • '/00'.

*perform bdc_field using 'KOMGG-MATNR(02)'

  • '1'.

*perform bdc_dynpro using 'SAPMV13G' '1001'.

*perform bdc_field using 'BDC_CURSOR'

  • 'KOMGG-MATNR(03)'.

cnt = 1.

do n times.

-


in this loop i am getting error

loop at MATNR from x to x.

perform bdc_dynpro using 'SAPMV13G' '1001'.

concatenate 'KOMGG-MATNR (' cnt ')' into fld.

perform bdc_field using fld MATNR-MATNR.

endloop.

cnt = cnt + 1.

x = x + 1.

enddo.

perform bdc_transaction using 'VB01'.

*perform bdc_field using 'BDC_OKCODE'

  • '=SICH'.

endloop.

perform close_group.

&----


*& Form convert_date

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM convert_date .

CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'

EXPORTING

INPUT = ITAB-DATAB

IMPORTING

OUTPUT = VAR.

ENDFORM. " convert_date

&----


*& Form convert_date1

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM convert_date1 .

CALL FUNCTION 'CONVERSION_EXIT_PDATE_OUTPUT'

EXPORTING

INPUT = ITAB-DATBI

IMPORTING

OUTPUT = VAR1.

ENDFORM. " convert_date1

1 REPLY 1
Read only

Former Member
0 Likes
343

Hi Friend,

Pleaes check the valye of cnt; is it 1 or 01?

It shoule be 01. I think it will solve your problem.

Regards

Krishnendu