SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Пакетный ввод в транзакции migo



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
Kirill
Участник
Участник



Joined: 01 Feb 2010
Posts: 6

PostPosted: Mon Feb 01, 2010 2:19 pm    Post subject: Пакетный ввод в транзакции migo Reply with quote

Здравствуйте!
Проблема состоит в следующем: необходимо заполнить все поля проводки переноса программно. При этом не получается заполнить поле GODYNPRO-CHARG. Вылазит ошибка: "Недопустимый ввод".

Код с вызовом транзакции следующий:

DEFINE MBDTab.
clear migo_bdc_tab.
migo_bdc_tab-program = &1.
migo_bdc_tab-dynpro = &2.
migo_bdc_tab-dynbegin = &3.
migo_bdc_tab-fnam = &4.
migo_bdc_tab-fval = &5.
append migo_bdc_tab.
END-OF-DEFINITION.

****************alv_user_command*********************
form alv_user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
when 'WROUT'.
refresh migo_bdc_tab.

MBDTab 'SAPLMIGO' '0001' 'X' '' ''.

MBDTab '' '' '' 'BDC_CURSOR' 'GODYNPRO-REFDOC'.
MBDTab '' '' '' 'GODYNPRO-REFDOC' 'R10'.
MBDTab '' '' '' 'BDC_CURSOR' 'GODYNPRO-ACTION'.
MBDTab '' '' '' 'GODYNPRO-ACTION' 'A09'.
loop at ListTab.
if ( ListTab-check = 'X' ).
perform make_batch_for_transaction using ListTab.
endif.
endloop.
perform make_charg.
call transaction 'MIGO' using migo_bdc_tab mode 'E'.
endcase.

endform.

****************make_batch_for_transaction*********************
form make_batch_for_transaction using line like ListTab.

DATA: tmp_clabs like mseg-erfmg,
tmp_lgort like mseg-lgort,
tmp(5) type i.

MBDTab 'SAPLMIGO' '0001' 'X' '' ''.

MBDTab '' '' '' 'BDC_CURSOR' 'GODYNPRO-MAKTX'.
MBDTab '' '' '' 'GODYNPRO-MAKTX' line-maktx.

MBDTab '' '' '' 'BDC_CURSOR' 'GOITEM-MAKTX'.
MBDTab '' '' '' 'GOITEM-MAKTX' line-matnr.

MBDTab '' '' '' 'BDC_CURSOR' 'GODYNPRO-ERFMG'.
* tmp = line-erfmg.

clear migo_bdc_tab.
migo_bdc_tab-fnam = 'GODYNPRO-ERFMG'.
migo_bdc_tab-fval = line-clabs.
CONDENSE migo_bdc_tab-fval.
APPEND migo_bdc_tab.
* MBDTab '' '' '' 'GODYNPRO-ERFMG' line-erfmg.
* MBDTab '' '' '' 'BDC_CURSOR' 'GODYNPRO-ERFME'.
* MBDTab '' '' '' 'GODYNPRO-ERFME' line-erfme.

MBDTab '' '' '' 'BDC_CURSOR' 'GODYNPRO-NAME1'.
MBDTab '' '' '' 'GODYNPRO-NAME1' p_umwrk.

MBDTab '' '' '' 'BDC_CURSOR' 'GODYNPRO-LGOBE'.
MBDTab '' '' '' 'GODYNPRO-LGOBE' '0K00'.

MBDTab '' '' '' 'BDC_CURSOR' 'GOITEM-UMNAME1'.
MBDTab '' '' '' 'GOITEM-UMNAME1' 'KLCH'.
CONCATENATE p_umwrk+1(3) 'I' into tmp_lgort.
MBDTab '' '' '' 'BDC_CURSOR' 'GOITEM-UMLGOBE'.
MBDTab '' '' '' 'GOITEM-UMLGOBE'tmp_lgort.

MBDTab '' '' '' 'BDC_CURSOR' 'GODEFAULT_TV-BWART'.
MBDTab '' '' '' 'GODEFAULT_TV-BWART' '961'.
MBDTab '' '' '' 'BDC_CURSOR' 'GOITEM-BWART'.
MBDTab '' '' '' 'GOITEM-BWART' '961'.

MBDTab '' '' '' 'BDC_OKCODE' '=OK_GO'.
MBDTab '' '' '' 'BDC_CURSOR' 'GODYNPRO-CHARG'.
MBDTab '' '' '' 'GODYNPRO-CHARG' line-charg.
MBDTab '' '' '' 'BDC_OKCODE' '=OK_NEXT_IT'.
endform.
Back to top
View user's profile Send private message
John Doe
Модератор
Модератор


Age: 46
Joined: 05 Nov 2007
Posts: 725
Location: КраснАдар

PostPosted: Mon Feb 01, 2010 2:33 pm    Post subject: Reply with quote

Может лучше ФМ BAPI_GOODSMVT_CREATE использовать?
Back to top
View user's profile Send private message Blog
Kirill
Участник
Участник



Joined: 01 Feb 2010
Posts: 6

PostPosted: Mon Feb 01, 2010 3:01 pm    Post subject: Reply with quote

Спасибо, надо попробывать!
Back to top
View user's profile Send private message
Kirill
Участник
Участник



Joined: 01 Feb 2010
Posts: 6

PostPosted: Tue Feb 02, 2010 9:11 am    Post subject: Reply with quote

Попробывал использовать BAPI_GOODSMVT_CREATE, тоже не получается. Пишет, что движения материала с видом движения 961 невозможно. Код следующий:

BHeader type BAPI2017_GM_HEAD_01,
BHeaderR type BAPI2017_GM_HEAD_RET,
BItems type BAPI2017_GM_ITEM_CREATE occurs 10 WITH HEADER LINE,
BReturn type BAPIRET2 occurs 10 WITH HEADER LINE.

****************alv_user_command*********************
form alv_user_command using r_ucomm like sy-ucomm
rs_selfield type slis_selfield.
case r_ucomm.
when 'WROUT'.
perform make_movement.
endcase.

endform.

****************make_movement*********************
form make_movement.
perform make_header.
perform make_items.

call function 'BAPI_GOODSMVT_CREATE'
EXPORTING
GOODSMVT_HEADER = BHeader
GOODSMVT_CODE = '03'
TESTRUN = ' '
IMPORTING
GOODSMVT_HEADRET = BHeaderR
TABLES
GOODSMVT_ITEM = BItems
RETURN = BReturn.

loop at BReturn.
if BReturn-TYPE = 'E'.
MESSAGE ID BRETURN-ID type BRETURN-TYPE number BRETURN-NUMBER
WITH BRETURN-MESSAGE_V1 BRETURN-MESSAGE_V2
BRETURN-MESSAGE_V3 BRETURN-MESSAGE_V4.
endif.
endloop.
endform.

****************make_header*********************
form make_header.
clear BHeader.
BHeader-PSTNG_DATE = sy-datum.
BHeader-DOC_DATE = sy-datum.
BHeader-PR_UNAME = sy-uname.
BHeader-HEADER_TXT = 'Перенос зап.инс. на заб.'.
endform.

****************make_items*********************
form make_items.
DATA: tmp_lgort like mseg-lgort.
refresh BItems.
loop at ListTab.
if ( ListTab-check = 'X' ).
BItems-MATERIAL = ListTab-matnr.
BItems-PLANT = p_umwrk.
BItems-STGE_LOC = '0K00'.
BItems-BATCH = ListTab-charg.
BItems-MOVE_TYPE = '961'.
BItems-VAL_TYPE = ListTab-bwtar.
BItems-ENTRY_QNT = ListTab-erfmg.
BItems-ENTRY_UOM = ListTab-erfme.
BItems-MOVE_MAT = ListTab-matnr.
BItems-MOVE_PLANT = 'KLCH'.
CONCATENATE p_umwrk+1(3) 'I' into tmp_lgort.
BItems-MOVE_STLOC = tmp_lgort.
append BItems.
endif.
endloop.
endform.

И еще маленький вопрос - на что влияет GOODSMVT_CODE??
Back to top
View user's profile Send private message
John Doe
Модератор
Модератор


Age: 46
Joined: 05 Nov 2007
Posts: 725
Location: КраснАдар

PostPosted: Tue Feb 02, 2010 9:38 am    Post subject: Reply with quote

http://www.sapnet.ru/viewtopic.php?t=3552&highlight=goodsmvtcode
Back to top
View user's profile Send private message Blog
Kirill
Участник
Участник



Joined: 01 Feb 2010
Posts: 6

PostPosted: Tue Feb 02, 2010 11:16 am    Post subject: Reply with quote

С помощью BAPI_GOODSMVT_CREATE невозможно провести 961 движение. Не одна из транзакций, используемых в BAPI_GOODSMVT_CREATE, не поддерживает этот вид движения.
Back to top
View user's profile Send private message
John Doe
Модератор
Модератор


Age: 46
Joined: 05 Nov 2007
Posts: 725
Location: КраснАдар

PostPosted: Tue Feb 02, 2010 12:23 pm    Post subject: Reply with quote

У меня формируется документ по 04 типу.
Code:
TABLES: mara, mseg.

PARAMETERS: p_matnr TYPE matnr OBLIGATORY,
            p_werks TYPE werks_d OBLIGATORY,
            p_lgort TYPE lgort_d OBLIGATORY,
            p_aufnr TYPE aufnr,
            p_test AS CHECKBOX,
            p_code TYPE gm_code DEFAULT '04'.

DATA: gs_code TYPE bapi2017_gm_code,
      header TYPE bapi2017_gm_head_01,
      items TYPE TABLE OF bapi2017_gm_item_create,
      item TYPE bapi2017_gm_item_create,
      return TYPE TABLE OF bapiret2.

START-OF-SELECTION.
  SELECT SINGLE * FROM mara WHERE matnr = p_matnr.
  SELECT SINGLE * FROM mseg WHERE matnr = p_matnr
                            AND   werks = p_werks
                            AND   lgort = p_lgort.

END-OF-SELECTION.
  gs_code-gm_code = p_code.

  header-pstng_date = sy-datum.
  header-doc_date   = sy-datum.
  header-pr_uname   = sy-uname.
  header-header_txt = '961 movement'.

  item-material  = p_matnr.
  item-plant     = p_werks.
  item-stge_loc  = p_lgort.
  item-batch     = mseg-charg.
  item-move_type = '961'.
  item-entry_qnt = '1'.
  item-quantity  = '1'.
  item-entry_uom = mara-meins.
  item-orderid   = p_aufnr.
  APPEND item TO items.

  CALL FUNCTION 'BAPI_GOODSMVT_CREATE'
    EXPORTING
      goodsmvt_header = header
      goodsmvt_code   = gs_code
      testrun         = p_test
    TABLES
      goodsmvt_item   = items
      return          = return.

  CALL FUNCTION 'C14ALD_BAPIRET2_SHOW'
    TABLES
      i_bapiret2_tab = return.

  IF p_test IS INITIAL.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
  ENDIF.
Back to top
View user's profile Send private message Blog
Kirill
Участник
Участник



Joined: 01 Feb 2010
Posts: 6

PostPosted: Tue Feb 02, 2010 1:12 pm    Post subject: Reply with quote

Не - не рубит((( Опять пишет, что вид движения не поддерживается!
Back to top
View user's profile Send private message
Kirill
Участник
Участник



Joined: 01 Feb 2010
Posts: 6

PostPosted: Tue Feb 02, 2010 2:55 pm    Post subject: Reply with quote

Нашел решение через пакетный ввод транзакции migo. Ссылка:
http://www.grupos.com.br/group/abap-sap/Messages.html?action=message&id=1195561656135626&year=07&month=11&prev=1
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.