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 if condition problem for tcode mm02

Former Member
0 Likes
1,494

Hi,

I am working on bdc in which i have to insert the data for the tcode hainvg Quality View . In this i am facing a problem that when the material id is copied during execution the view of some materials having Quality View at 11 or 13 position of screen. i want to write code for the both so that uploading can be done for it.the BDC field is 'MSICHTAUSW-DYTXT(11)' and 'MSICHTAUSW-DYTXT(13)'.

Plzz provide me guidelines for it to solve this problem.

here's d code:-

report ZBDC_MM02_QM_VIEW

no standard page heading line-size 255.

include bdcrecx1.

data: begin of record OCCURS 0,

MATNR_001(018),

WERKS_002(004),

ART_003(008),

APA_004(001),

AKTIV_005(001),

end of record.

PARAMETERS : P_FILNAM LIKE RLGRAP-FILENAME.

initialization.

CTUMODE = 'A'.

CUPDATE = 'A'.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILNAM.

CALL FUNCTION 'WS_FILENAME_GET'

EXPORTING

MASK = ',.'

MODE = 'O'

IMPORTING

FILENAME = P_FILNAM

EXCEPTIONS

INV_WINSYS = 1

NO_BATCH = 2

SELECTION_CANCEL = 3

SELECTION_ERROR = 4

OTHERS = 5.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

start-of-selection.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

FILENAME = P_FILNAM

FILETYPE = 'DAT'

TABLES

DATA_TAB = RECORD

EXCEPTIONS

CONVERSION_ERROR = 1

FILE_OPEN_ERROR = 2

FILE_READ_ERROR = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

NO_AUTHORITY = 10

OTHERS = 11.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

LOOP AT RECORD.

ON CHANGE OF RECORD-MATNR_001.

perform bdc_dynpro using 'SAPLMGMM' '0060'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MATNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RMMG1-MATNR'

record-MATNR_001.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(11)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'MSICHTAUSW-KZSEL(11)'

'X'.

perform bdc_dynpro using 'SAPLMGMM' '0080'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-WERKS'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'RMMG1-WERKS'

record-WERKS_002.

perform bdc_dynpro using 'SAPLMGMM' '4000'.

perform bdc_field using 'BDC_OKCODE'

'=PB01'.

perform bdc_dynpro using 'SAPLQPLS' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RMQAM-ARGUMENT'.

perform bdc_field using 'BDC_OKCODE'

'=NEU'.

perform bdc_field using 'RMQAM-INSMK'

'X'.

perform bdc_field using 'RMQAM-QKZVERF'

'06'.

perform bdc_field using 'RMQAM-PPL'

'X'.

perform bdc_field using 'RMQAM-APP'

'X'.

perform bdc_field using 'RMQAM-DYN'

'X'.

perform bdc_field using 'RMQAM-MER'

'X'.

perform bdc_field using 'RMQAM-AVE'

'X'.

perform bdc_dynpro using 'SAPLQPLS' '0100'.

perform bdc_field using 'BDC_CURSOR'

'RMQAM-AKTIV(01)'.

perform bdc_field using 'BDC_OKCODE'

'=WEIT'.

perform bdc_field using 'RMQAM-ART(01)'

record-ART_003.

perform bdc_field using 'RMQAM-AKTIV(01)'

'X'.

perform bdc_transaction using 'MM02'.

ENDON.

ENDLOOP.

Edited by: ricx .s on Apr 16, 2009 10:49 AM

9 REPLIES 9
Read only

shahid_malayil1
Explorer
0 Likes
1,174

Hi,

In the above code you are not enter data in MSICHTAUSW-DYTXT(11) or MSICHTAUSW-DYTXT(13).

You are only placing the Cursor on the first, do the record again by entering the data or add the Code for putting the data.

Best regards,

Shahid Malayil

Read only

0 Likes
1,174

hi,

but i want to write code for it only bcoz as i told that there are some items whose quality view is present at screen position no.13 or 11. Moreover if i do perform new recording, only 1 material view will be selected.

i simply want to have a idea that when ever the materail is uploaded it automatically select its view irrespective to the quality view (11 or 13).

plzz provide me guidelines for solving this problem.

Edited by: ricx .s on Apr 16, 2009 11:08 AM

Read only

0 Likes
1,174

Hi,

I got u r problem. u r going to change the data in quality view which is already uploaded in mm01.

now pass matnr mat type , status q, tcode mm02 to function module it will give u the position number of

qm view . pass this position number in 'MSICHTAUSW-DYTXT(' pos number ')'.

it will automatically select the qm view.

and one more thing u had to use page down option in the pop up window to capture page down ok code.

check this sample code for qm view change.

REPORT ZMM02_QM_PTYE

NO STANDARD PAGE HEADING LINE-SIZE 255.

INCLUDE BDCRECX1.

DATA: IT_MARC LIKE MARC OCCURS 0 WITH HEADER LINE.

DATA: BEGIN OF IT_UPLOAD OCCURS 0,

MATNR LIKE RMMG1-MATNR, " Material Number

WERKS LIKE RMMG1-WERKS, " Plant

  • ART(2), " LIKE RMQAM-ART(01),

  • AKTIV(1), " LIKE RMQAM-AKTIV(01),

  • EIN(1), " LIKE RMQAM-EIN,

END OF IT_UPLOAD.

DATA: BEGIN OF IT_HEADER OCCURS 0,

MATNR LIKE RMMG1-MATNR, " Material Number

WERKS LIKE RMMG1-WERKS, " Plant

  • ART(2), " LIKE RMQAM-ART(01),

  • AKTIV(1), " LIKE RMQAM-AKTIV(01),

  • EIN(1), " LIKE RMQAM-EIN,

END OF IT_HEADER.

DATA: BEGIN OF IT_UPLOAD_ERR OCCURS 0,

MATNR LIKE RMMG1-MATNR, " Material Number

WERKS LIKE RMMG1-WERKS, " Plant

  • ART(2), " LIKE RMQAM-ART(01),

  • AKTIV(1), " LIKE RMQAM-AKTIV(01),

  • EIN(1), " LIKE RMQAM-EIN,

END OF IT_UPLOAD_ERR.

START-OF-SELECTION.

PERFORM OPEN_GROUP.

DATA IT_QMAT LIKE QMAT OCCURS 0 WITH HEADER LINE.

DATA I(2) VALUE 1.

DATA : V_STRING TYPE STRING,

V_STRING1 TYPE STRING,

V_COUNT TYPE I.

DATA : V_PATH TYPE STRING.

DATA V_MTART LIKE MARA-MTART.

DATA V_SELECTION TYPE STRING. " For View Selection

FIELD-SYMBOLS : <FS> TYPE ANY.

DATA :VAR(2),

VAR1(30).

DATA : IT_BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE,

IT_BDCDATA_VIEW LIKE BDCDATA OCCURS 0 WITH HEADER LINE,

IT_DATA(3200) OCCURS 0 WITH HEADER LINE,

IT_FIELD(3200) OCCURS 0 WITH HEADER LINE,

IT_BDCMSG LIKE BDCMSGCOLL OCCURS 0 WITH HEADER LINE.

DATA : GI_MARA LIKE MARA OCCURS 0 WITH HEADER LINE.

DATA : BEGIN OF PLANT OCCURS 0 ,

WERKS LIKE MARC-WERKS,

END OF PLANT.

DATA : BEGIN OF MAT_TYP OCCURS 0,

MTART LIKE MARA-MTART,

END OF MAT_TYP.

*data it_header_main like it_header occurs 0 with header line.

----


  • Selection Screen *

----


SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.

SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN ULINE.

PARAMETERS : P_PATH LIKE RLGRAP-FILENAME OBLIGATORY

DEFAULT ' '.

SELECTION-SCREEN ULINE.

SELECTION-SCREEN SKIP 1.

SELECTION-SCREEN END OF BLOCK B1.

SELECTION-SCREEN BEGIN OF BLOCK B2 WITH FRAME TITLE TEXT-001.

PARAMETER : R1 RADIOBUTTON GROUP RADI, " C&A

R2 RADIOBUTTON GROUP RADI, " ESE

R3 RADIOBUTTON GROUP RADI. " ESP

SELECTION-SCREEN END OF BLOCK B2.

----


  • At Selection Screen *

----


AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_PATH.

CALL FUNCTION 'F4_FILENAME'

EXPORTING

PROGRAM_NAME = SYST-CPROG

DYNPRO_NUMBER = SYST-DYNNR

FIELD_NAME = ' '

IMPORTING

FILE_NAME = P_PATH.

----


  • Start of Selection *

----


START-OF-SELECTION.

V_PATH = P_PATH.

PERFORM UPLOAD_INTERNAL_TABLE.

SELECT * FROM MARC INTO TABLE IT_MARC

FOR ALL ENTRIES IN IT_UPLOAD

WHERE MATNR = IT_UPLOAD-MATNR

AND WERKS = IT_UPLOAD-WERKS.

PERFORM PROCESS_DATA.

PERFORM FILL_BDCDATA.

&----


*& Form upload_internal_table

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM UPLOAD_INTERNAL_TABLE .

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = V_PATH

TABLES

DATA_TAB = IT_DATA.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

PERFORM FORMAT_FILE_READ.

ENDFORM. " upload_internal_table

&----


*& Form format_file_read

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM FORMAT_FILE_READ .

LOOP AT IT_DATA.

SPLIT IT_DATA AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB INTO

TABLE IT_FIELD.

LOOP AT IT_FIELD.

IF NOT IT_FIELD IS INITIAL.

ASSIGN COMPONENT SY-TABIX OF STRUCTURE IT_UPLOAD TO <FS>.

<FS> = IT_FIELD.

ENDIF.

ENDLOOP.

APPEND IT_UPLOAD.

CLEAR: IT_FIELD ,IT_UPLOAD .

REFRESH : IT_FIELD.

ENDLOOP.

ENDFORM. " format_file_read

&----


*& Form process_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM PROCESS_DATA .

LOOP AT IT_UPLOAD.

IF IT_UPLOAD IS NOT INITIAL.

MOVE-CORRESPONDING IT_UPLOAD TO IT_HEADER.

APPEND IT_HEADER.

ENDIF.

ENDLOOP.

ENDFORM. "process_data

&----


*& Form fill_bdcdata

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM FILL_BDCDATA .

LOOP AT IT_HEADER.

REFRESH IT_BDCDATA.

CLEAR V_MTART.

SELECT SINGLE MTART FROM MARA INTO V_MTART

WHERE MATNR = IT_HEADER-MATNR.

CALL FUNCTION 'MATERIAL_BTCI_SELECTION_NEW' " Function module for getting all view's for the particular material into internal table..

EXPORTING

MATERIAL = IT_HEADER-MATNR " Material number

MATERIALART = V_MTART " Material Type

SELECTION = 'Q' " PSTAT(maintenance status) value for Quality Managemant.

TCODE = 'MM02' " Tcode where view's are called.

TABLES

BTCI_D0070 = IT_BDCDATA_VIEW

EXCEPTIONS

MATERIAL_NOT_FOUND = 1

MATERIAL_NUMBER_MISSING = 2

MATERIAL_TYPE_MISSING = 3

MATERIAL_TYPE_NOT_FOUND = 4

NO_ACTIVE_DYNPRO_SELECTED = 5

NO_AUTHORITY = 6

OTHERS = 7.

READ TABLE IT_BDCDATA_VIEW WITH KEY FVAL = 'X'.

IF SY-SUBRC = 0.

V_SELECTION = IT_BDCDATA_VIEW-FNAM.

ENDIF.

VAR = IT_BDCDATA_VIEW-FNAM+17(2).

IF IT_HEADER IS NOT INITIAL.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0060'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'RMMG1-MATNR'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=AUSW'.

PERFORM BDC_FIELD USING 'RMMG1-MATNR'

IT_HEADER-MATNR. " 'ZMRPWQM4'.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0070'.

IF VAR > '17'.

VAR = VAR - 17.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=P+'.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0070'.

CONCATENATE 'MSICHTAUSW-DYTXT(' VAR ')' INTO VAR1.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

VAR1.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=ENTR'.

CLEAR VAR1.

CONCATENATE 'MSICHTAUSW-KZSEL(' VAR ')' INTO VAR1.

PERFORM BDC_FIELD USING VAR1

'X'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=ENTR'.

ELSE.

CONCATENATE 'MSICHTAUSW-DYTXT(' VAR ')' INTO VAR1.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

VAR1.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=ENTR'.

CLEAR VAR1.

CONCATENATE 'MSICHTAUSW-KZSEL(' VAR ')' INTO VAR1.

PERFORM BDC_FIELD USING VAR1

'X'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=ENTR'.

ENDIF.

ENDIF.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0080'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'RMMG1-WERKS'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=ENTR'.

PERFORM BDC_FIELD USING 'RMMG1-WERKS'

IT_HEADER-WERKS. " '3502'.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '4000'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=BU'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'MARC-SSQSS'.

PERFORM BDC_FIELD USING 'MARA-QMPUR'

'X'.

PERFORM BDC_FIELD USING 'MARC-SSQSS'

'0013'.

PERFORM BDC_FIELD USING 'MARC-QZGTP'

'Q003'.

PERFORM BDC_TRANSACTION USING 'MM02'.

PERFORM CLOSE_GROUP.

IF MESSTAB-MSGTYP = 'E'.

MOVE-CORRESPONDING IT_UPLOAD TO IT_UPLOAD_ERR.

APPEND IT_UPLOAD_ERR.

WRITE 😕 'Data is not uploaded for the material :', IT_UPLOAD-MATNR.

*--


RG-001--


Start.

  • ELSE.

  • WRITE 😕 'Data is uploaded sucessfully for the material :', it_upload-matnr.

*--


RG-001--


End.

ENDIF.

ENDLOOP.

IF IT_UPLOAD_ERR[] IS NOT INITIAL.

CALL FUNCTION 'DOWNLOAD'

EXPORTING

FILENAME = ' '

FILETYPE = 'DAT'

TABLES

DATA_TAB = IT_UPLOAD_ERR.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ELSE.

WRITE 😕 'Data is uploaded sucessfully for all materials.'.

ENDIF.

ENDFORM. " fill_bdcdata

Rgds

Siva

Read only

0 Likes
1,174

hi,

can u please display the mentioned above in more good way as i am not able to understand it.

why don't u publish on google doc's.

Read only

Former Member
0 Likes
1,174

Hi,

use this function module to find the postion number of the qm view in pop up screen. use scroll down

while recording for selecting qm view it will generate the ok coe of p+.

check below code for qm view in material master.

CALL FUNCTION 'MATERIAL_BTCI_SELECTION_NEW' " Function module for getting all view's for the particular material into internal table..

EXPORTING

MATERIAL = IT_HEADER-MATNR " Material number

MATERIALART = V_MTART " Material Type

SELECTION = 'Q' " PSTAT(maintenance status) value for Quality Managemant.

TCODE = 'MM02' " Tcode where view's are called.

TABLES

BTCI_D0070 = IT_BDCDATA_VIEW

EXCEPTIONS

MATERIAL_NOT_FOUND = 1

MATERIAL_NUMBER_MISSING = 2

MATERIAL_TYPE_MISSING = 3

MATERIAL_TYPE_NOT_FOUND = 4

NO_ACTIVE_DYNPRO_SELECTED = 5

NO_AUTHORITY = 6

OTHERS = 7.

READ TABLE IT_BDCDATA_VIEW WITH KEY FVAL = 'X'.

IF SY-SUBRC = 0.

V_SELECTION = IT_BDCDATA_VIEW-FNAM.

ENDIF.

VAR = IT_BDCDATA_VIEW-FNAM+17(2).

IF IT_HEADER IS NOT INITIAL.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0060'.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

'RMMG1-MATNR'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'/00'.

PERFORM BDC_FIELD USING 'RMMG1-MATNR'

IT_HEADER-MATNR.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0070'.

IF VAR > '17'.

VAR = VAR - 17.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=P+'.

PERFORM BDC_DYNPRO USING 'SAPLMGMM' '0070'.

CONCATENATE 'MSICHTAUSW-DYTXT(' VAR ')' INTO VAR1.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

VAR1.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=ENTR'.

CLEAR VAR1.

CONCATENATE 'MSICHTAUSW-KZSEL(' VAR ')' INTO VAR1.

PERFORM BDC_FIELD USING VAR1

'X'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=ENTR'.

ELSE.

CONCATENATE 'MSICHTAUSW-DYTXT(' VAR ')' INTO VAR1.

PERFORM BDC_FIELD USING 'BDC_CURSOR'

VAR1.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=ENTR'.

CLEAR VAR1.

CONCATENATE 'MSICHTAUSW-KZSEL(' VAR ')' INTO VAR1.

PERFORM BDC_FIELD USING VAR1

'X'.

PERFORM BDC_FIELD USING 'BDC_OKCODE'

'=ENTR'.

ENDIF.

ENDIF.

Rgds

Siva

Read only

Former Member
0 Likes
1,174

Hi

I think the best solution is to use the BAPI instead of a BDC: it's easier to manage a problema like yours.

Anyway if you want to use the BDC u should check the field MARA-PSTAT in order to know which view are open for the material u can try to use the fm MATERIAL_BTCI_SELECTION_NEW

Max

Read only

0 Likes
1,174

hi,

but i had never worked on BAPI and i dont know how to upload the data by using it. can please provide me guidelines by providing some example or the tutorial for it .

Edited by: ricx .s on Apr 16, 2009 11:31 AM

Read only

0 Likes
1,174

Hi Rick

The BAPI is BAPI_MATERIAL_SAVEDATA and it's easy to use it: u need to fill the structure linked to the table where the data has to be updated are.

Just as the other BAPI u've 2 structure: the structure for the data and the structure for the flag,

- in the first structure u need to transfer the value;

- in this last staructure u need to insert the flag in the field u need to change.

This is a sample to update the ean code:

LOOP AT t_material INTO w_record.
    /afs/bapi_mean-unit        = w_record-meins.
    /afs/bapi_mean-ean_cat     = 'ZH'.
    /afs/bapi_mean-grid_value  = w_record-sku.
    APPEND /afs/bapi_mean TO t_ean.

    AT END OF matnr.

      /afs/bapimathead-material   = w_record-matnr.
      /afs/bapimathead-matl_type  = w_record-mtart.
      /afs/bapimathead-basic_view = 'X'.

      CALL FUNCTION '/AFS/BAPI_MATERIAL_SAVEDATA'
        EXPORTING
          headdata            = /afs/bapimathead
        IMPORTING
          return              = bapiret2
        TABLES
          internationalartnos = t_ean
          returnmessages      = t_messages.

      IF bapiret2-type <> 'E' AND bapiret2-type <> 'A'.
        LOOP AT t_messages TRANSPORTING NO FIELDS WHERE type = 'E'
        OR type = 'A'.
        ENDLOOP.
        IF sy-subrc <> 0.
          CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
* Materiale aggiornato
          bapiret2-type    = 'S'.
          bapiret2-message = 'Codici EAN aggiornati con successo'(010).
        ENDIF.
      ENDIF.

      WRITE: /3 sy-vline, w_record-matnr,
      sy-vline, bapiret2-type,
      sy-vline, bapiret2-message(100),
      sy-vline.

      REFRESH: t_ean, t_messages.
      CLEAR  : /afs/bapimathead,  bapiret2.

    ENDAT.
  ENDLOOP.

Here i used a BAPI for AFS, but the logic is the same for the "nornal" BAPI

Max

Read only

Former Member
0 Likes
1,174

report ZMM02 no standard page heading line-size 255.

include bdcrecx1.

DATA: BEGIN OF ZVBM OCCURS 0,

MATNR(18) TYPE C,

BRGEW(16) TYPE C,

NTGEW(16) TYPE C,

END OF ZVBM.

start-of-selection.

CALL FUNCTION 'WS_UPLOAD'

EXPORTING

  • CODEPAGE = ' '

FILENAME = 'c:\vijay.txt'

FILETYPE = 'DAT'

  • HEADLEN = ' '

  • LINE_EXIT = ' '

  • TRUNCLEN = ' '

  • USER_FORM = ' '

  • USER_PROG = ' '

  • DAT_D_FORMAT = ' '

  • IMPORTING

  • FILELENGTH =

TABLES

DATA_TAB = ZVBM

  • EXCEPTIONS

  • CONVERSION_ERROR = 1

  • FILE_OPEN_ERROR = 2

  • FILE_READ_ERROR = 3

  • INVALID_TYPE = 4

  • NO_BATCH = 5

  • UNKNOWN_ERROR = 6

  • INVALID_TABLE_WIDTH = 7

  • GUI_REFUSE_FILETRANSFER = 8

  • CUSTOMER_ERROR = 9

  • OTHERS = 10

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

perform open_group.

LOOP AT ZVBM.

perform bdc_dynpro using 'SAPLMGMM' '0060'.

perform bdc_field using 'BDC_CURSOR'

'RMMG1-MATNR'.

perform bdc_field using 'BDC_OKCODE'

'/00'.

perform bdc_field using 'RMMG1-MATNR'

zvbm-matnr.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(01)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'MSICHTAUSW-KZSEL(01)'

'X'.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

perform bdc_field using 'MAKT-MAKTX'

'VIJAY3'.

perform bdc_field using 'MARA-MEINS'

'KG'.

perform bdc_field using 'MARA-MATKL'

'01'.

perform bdc_field using 'MARA-SPART'

'01'.

perform bdc_field using 'BDC_CURSOR'

'MARA-NTGEW'.

perform bdc_field using 'MARA-BRGEW'

zvbm-brgew.

perform bdc_field using 'MARA-GEWEI'

'KG'.

perform bdc_field using 'MARA-NTGEW'

zvbm-ntgew.

perform bdc_transaction using 'MM02'.

ENDLOOP.

perform close_group.