Batch Input for MB1C Transaction (Enter Other Good Receipts)

Question: Hello,

Have you ever coded batch input for MB1C transaction ?

This is my code :

*&---------------------------------------------------------------------*
*& Report ZMMB_STOK_561_HRK_BATCH *
*& *
*&---------------------------------------------------------------------*
*& Author : Tanju Lise *
*& Date : 05.11.2004 *
*&---------------------------------------------------------------------*

REPORT MMB_STOK_561_HRK_BATCH NO STANDARD PAGE HEADING
LINE-SIZE 170 MESSAGE-ID ZZ.

* Tables

TABLES : MARA .

* Internal table definiton
DATA: BDCDATA LIKE BDCDATA OCCURS 0 WITH HEADER LINE.

* Internal table for batch input
DATA: BEGIN OF BDCTAB OCCURS 100 .
INCLUDE STRUCTURE BDCDATA .
DATA: END OF BDCTAB .

* Internal table for reading messages
DATA BEGIN OF MESSTAB OCCURS 10 .
INCLUDE STRUCTURE BDCMSGCOLL.
DATA END OF MESSTAB .

DATA: MSGNO LIKE SY-MSGNO ,
MESSAGE LIKE MESSAGE .

* Parameters

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

PARAMETERS : FILENAME(128) DEFAULT
'C:\Documents and Settings\help user\Desktop\stok561.txt',
* '\\Uranus\MeyRoot\MeySap\calismalar\CO\merkez.txt' ,
MODE(1) DEFAULT 'A' .
SELECTION-SCREEN END OF BLOCK BLOCK1 .

* Uploaded PC File
DATA: BEGIN OF ITAB OCCURS 100 ,
*-- Mal Giriş Kaydı
BLDAT(0 , "belge tarihi
BUDAT(0 , "kayıt tarihi
WERKS(04) , "üretim yeri
LGORT(04) , "depo yeri
* Yeni Kalemler
* GSBER(04) , "iş alanı
MATNR(1 , "malzeme kodu
ERFMG(13) , "miktar
* Yeni Kaşem 0001
EXBWR(13) , "tutar
END OF ITAB .

* Main program
START-OF-SELECTION .

*-- Lotus Notes' dan gelen bilgi listesi
PERFORM FILE_UPLOAD.

* Process entries
PERFORM PROCESS-ENTRIES.

*&---------------------------------------------------------------------*
*& Form FILE_UPLOAD
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM FILE_UPLOAD .

CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = FILENAME
FILETYPE = 'DAT'
TABLES
DATA_TAB = ITAB.

* BREAK-POINT.
ENDFORM. " FILE_UPLOAD
*&---------------------------------------------------------------------*
*& Form PROCESS-ENTRIES
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM PROCESS-ENTRIES .

DATA : W-MATNR(1 TYPE C,
W-ERFME(03) TYPE C.

LOOP AT ITAB.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = ITAB-MATNR
IMPORTING
OUTPUT = W-MATNR .


SELECT SINGLE *
FROM MARA
WHERE MATNR EQ W-MATNR.

CHECK SY-SUBRC EQ 0.

IF MARA-MEINS eq 'ST' .
MOVE : 'ADT' TO W-ERFME.
ENDIF.

REFRESH : BDCTAB .

PERFORM FILL_SCREEN USING :

'SAPMM07M' '0400' 'X' SPACE SPACE ,
SPACE SPACE SPACE 'MKPF-BLDAT' ITAB-BLDAT ,
SPACE SPACE SPACE 'MKPF-BUDAT' ITAB-BUDAT ,
SPACE SPACE SPACE 'RM07M-BWARTWA' '561' ,
SPACE SPACE SPACE 'RM07M-WERKS' ITAB-WERKS ,
SPACE SPACE SPACE 'RM07M-LGORT' ITAB-LGORT ,
SPACE SPACE SPACE 'BDC_OKCODE' '/00' ,

'SAPMM07M' '0421' 'X' SPACE SPACE ,
SPACE SPACE SPACE 'MSEG-MATNR(01)' ITAB-MATNR ,
SPACE SPACE SPACE 'MSEG-ERFMG(01)' ITAB-ERFMG ,
* SPACE SPACE SPACE 'MSEG-ERFME(01)' 'KG' ,
SPACE SPACE SPACE 'BDC_OKCODE' '/00' ,

'SAPLKACB' '0002' 'X' SPACE SPACE ,
SPACE SPACE SPACE 'COBL-GSBER' ITAB-WERKS ,
SPACE SPACE SPACE 'BDC_OKCODE' '=ENTE' ,

'SAPMM07M' '0410' 'X' SPACE SPACE ,
SPACE SPACE SPACE 'MSEG-EXBWR' ITAB-EXBWR ,
SPACE SPACE SPACE 'BDC_OKCODE' '/00' .

* break-point.

CLEAR MESSTAB .
REFRESH : MESSTAB .
CALL TRANSACTION 'MB1C'
USING BDCTAB
MODE MODE
UPDATE 'S'
MESSAGES INTO MESSTAB .


ENDLOOP.


ENDFORM. " PROCESS-ENTRIES
*&---------------------------------------------------------------------*
*& Form FILL_SCREEN
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_0143 text
* -->P_0144 text
* -->P_0145 text
* -->P_SPACE text
* -->P_SPACE text
*----------------------------------------------------------------------*
FORM FILL_SCREEN USING I_PROGRAM
I_DYNPRO
I_DYNBEGIN
I_FNAM
I_FVAL .

MOVE:I_PROGRAM TO BDCTAB-PROGRAM ,
I_DYNPRO TO BDCTAB-DYNPRO ,
I_DYNBEGIN TO BDCTAB-DYNBEGIN ,
I_FNAM TO BDCTAB-FNAM ,
I_FVAL TO BDCTAB-FVAL .
APPEND BDCTAB .

ENDFORM. " FILL_SCREEN

In this code please check this line :

'SAPMM07M' '0410' 'X' SPACE SPACE ,
SPACE SPACE SPACE 'MSEG-EXBWR' ITAB-EXBWR ,
SPACE SPACE SPACE 'BDC_OKCODE' '/00' .

When I run the code, the program says "Make an entry in all required fields". But infact I send it a record for this area . I did not find my problem ?

If you write this batch code, please help me ?

K&#305;ng Regards,

Tanju

Answer:
I would do this task via BAPI_GOODSMVT_CREATE.
Or:
I see movement type is to load initial balances, why not use SXDB, the standard SAP tool?

DK

Answer:
Hello DK,

I do not know about SXDB. After your mail, I run the SXDB. But asking lots of question. And I do not know the answers.
You say me use BAPI_GOODSMVT_CREATE. Right ?

If is it possible, Would you please send me a example how can I use it ?

King Regards,

Tanju

Answer:
What version of SAP???
SXDB would be the best way, choose object '110' and proceed. There is documentation then.

DK

Answer:
We are using 4.7 version.

I run the wizard. I have choosen BUS2012.

Load Data -> I saw these under 3 sentences.

LOA DINP RM06EEI0
LOA DINP RM06EEI1
LOA DINP RSTXLITF

Which one I must choose ? Is that right from beginning to here ?

Regards,

Tanju

Answer:
Sorry,

I'm on 4.6 so it appears that SXDB has changed quite a lot. Maybe someone with 4.7 system can be of more help.

DK

Answer:
Try replacing this


PERFORM FILL_SCREEN USING :

*etc

SPACE SPACE SPACE 'BDC_OKCODE' '/00' ,


with


PERFORM FILL_SCREEN USING :

*etc

SPACE SPACE SPACE 'BDC_OKCODE' '=NPE' ,


And Program for filling One Line Item at a time.

KRK

Answer:
Thank you very much indeed Kumar,

It is OK.

King Regards,

Tanju

PS. Sorry for the late reply.

Answer:
Do not use batch input any more in 4.7! There is BAPIS, and std. methods and so on!

QB
Copyright ?2007 - 2008 www.jt77.com