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: 

Batch Input HELP!!!

former_member184029
Participant
0 Kudos

Hello

I'm working in SD and I'm doing my first Batch Input called from a program, the problem is when I execute it in mode 'A' or 'E' changes are made, but if I execute it in mode 'N' no changes.

The batch input execute MM01, but exactly when is selecting the views I have to drop down the scroll to select two check box more data is loose (no show on screen) and the action is not completed.

Hope you could give me some ideas because it's urgent.

P.D. The language is 'ES' (Spanish - Español).

Thanks in adavance.

Tokio

1 ACCEPTED SOLUTION

ferry_lianto
Active Contributor
0 Kudos

Hi Tokio,

BAPI_MATERIAL_SAVEDATA is not available in 4.0B.

You need to use BDC to create material. For selecting views, you can use this tables as references to find out the sequence number prior to code the BDC program.

<b>T133A

T133B

T133*</b>

Hope this will help.

Regards,

Ferry Lianto

Please reward points if helpful.

9 REPLIES 9

former_member181962
Active Contributor
0 Kudos

Instead of doing a bdc for mm01 try using the bapi

BAPI_MATERIAL_SAVEDATA.

See the link

http://www.sap-img.com/abap/bapi-to-copy-materials-from-one-plant-to-another.htm

for how to pass the data to the bapi.

This way you can be relieved of handling the scrolling up and down in the screens dynamically.

Regards,

Ravi

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

BDC over MM01 is tough. You will never get it to work 100% evertime. I would strongly suggest using BAPI_MATERIAL_SAVEDATA. Here is a sample program which creates a material with the least amount of data.



report zrich_0003 .

data: headdata type bapimathead.
data: clientdata type bapi_mara.
data: clientdatax type bapi_marax.
data: descdata type table of BAPI_MAKT with header line.
data: return type  bapiret2 .
data: returnm type table of bapi_matreturn2 with header line.
data: xmara type mara.


parameters: p_matnr type mara-matnr.


headdata-material        = p_matnr.
headdata-ind_sector      = 'M'.
headdata-matl_type       = 'FERT'.
headdata-basic_view = 'X'.


clientdata-BASE_UOM   = 'EA'.
clientdatax-BASE_UOM   = 'X'.
clientdata-old_mat_no = 'Old Material'.
clientdatax-old_mat_no = 'X'.
clientdata-division = '00'.
clientdatax-division = 'X'.

descdata-LANGU = sy-langu.
descdata-MATL_DESC = 'This is the description'.
append descdata.

call function 'BAPI_MATERIAL_SAVEDATA'
  exporting
    headdata                   = headdata
    clientdata                 = clientdata
    clientdatax                = clientdatax
*   PLANTDATA                  =
*   PLANTDATAX                 =
*   FORECASTPARAMETERS         =
*   FORECASTPARAMETERSX        =
*   PLANNINGDATA               =
*   PLANNINGDATAX              =
*   STORAGELOCATIONDATA        =
*   STORAGELOCATIONDATAX       =
*   VALUATIONDATA              =
*   VALUATIONDATAX             =
*   WAREHOUSENUMBERDATA        =
*   WAREHOUSENUMBERDATAX       =
*   SALESDATA                  =
*   SALESDATAX                 =
*   STORAGETYPEDATA            =
*   STORAGETYPEDATAX           =
 importing
   return                     = return
  tables
    MATERIALDESCRIPTION        = descdata
*   UNITSOFMEASURE             =
*   UNITSOFMEASUREX            =
*   INTERNATIONALARTNOS        =
*   MATERIALLONGTEXT           =
*   TAXCLASSIFICATIONS         =
    returnmessages             = returnm
*   PRTDATA                    =
*   PRTDATAX                   =
*   EXTENSIONIN                =
*   EXTENSIONINX               =
          .

check sy-subrc  = 0.


Regards,

Rich Heilman

Former Member
0 Kudos

HI CHANG,

CHECK THIS LINK

WHICH HAS SOME BDC CODE FOR MM01

HOPE THIS HELPS,

PRIYA.

0 Kudos

Thanks to all of you... but I apologize for answering ... Does 'BAPI_MATERIAL_SAVEDATA' works for v 4.0B?

Tokio

Former Member
0 Kudos

Hi,

Its better to use the BAPI FM 'BAPI_MATERIAL_SAVEDATA'.

BDC is not preferable for MM01 transaction where as the standard BAPI FM is available for the same.

Regards,

Sampath.

Former Member
0 Kudos

Hi,

I hope it works.

Regards,

Sampath

ferry_lianto
Active Contributor
0 Kudos

Hi Tokio,

BAPI_MATERIAL_SAVEDATA is not available in 4.0B.

You need to use BDC to create material. For selecting views, you can use this tables as references to find out the sequence number prior to code the BDC program.

<b>T133A

T133B

T133*</b>

Hope this will help.

Regards,

Ferry Lianto

Please reward points if helpful.

0 Kudos

I have to solve this problem checking the Batch Input which I created, code lines and views selected.

It was a very hard and slow job but I learned, that's the way you get knowlodgement.

Thanks to all of you too, because you're always there, helping people like me (beginner).

Tokio.

Former Member
0 Kudos

Hai Takio Franco

Try with the following Code

include bdcrecx1.

tables : mara.

data : begin of it_mara occurs 0,

matnr like mara-matnr,

mbrsh like mara-mbrsh,

mtart like mara-mtart,

maktx like makt-maktx,

meins like mara-meins,

end of it_mara.

start-of-selection.

perform upload_data.

perform open_group.

loop at it_mara.

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_mara-matnr.

perform bdc_field using 'RMMG1-MBRSH'

it_mara-mbrsh.

perform bdc_field using 'RMMG1-MTART'

it_mara-mtart.

perform bdc_dynpro using 'SAPLMGMM' '0070'.

perform bdc_field using 'BDC_CURSOR'

'MSICHTAUSW-DYTXT(02)'.

perform bdc_field using 'BDC_OKCODE'

'=ENTR'.

perform bdc_field using 'MSICHTAUSW-KZSEL(01)'

'X'.

perform bdc_field using 'MSICHTAUSW-KZSEL(02)'

'X'.

perform bdc_dynpro using 'SAPLMGMM' '4004'.

perform bdc_field using 'BDC_OKCODE'

'=BU'.

perform bdc_field using 'MAKT-MAKTX'

it_mara-maktx.

perform bdc_field using 'BDC_CURSOR'

'MARA-MEINS'.

perform bdc_field using 'MARA-MEINS'

it_mara-meins.

perform bdc_field using 'MARA-MTPOS_MARA'

'NORM'.

perform bdc_transaction using 'MM01'.

endloop.

perform close_group.

&----


*& Form upload_data

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM upload_data .

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

FILENAME = 'c:\mat_bdc.txt'

FILETYPE = 'ASC'

TABLES

DATA_TAB = it_mara.

IF SY-SUBRC = 0.

SORT IT_MARA BY MATNR.

ENDIF.

ENDFORM. " upload_data

flat file structure is

PRANIT_011 CCOUP This is Testing material kg

PRANIT_012 CCOUP This is Testing material kg

PRANIT_013 CCOUP This is Testing material kg

PRANIT_014 CCOUP This is Testing material kg

PRANIT_015 CCOUP This is Testing material kg

Thanks & regards

Sreenivasulu P