2020-06-04 migo 收貨過賬后更新mseg 里面的批次

業(yè)務(wù)要求migo產(chǎn)生批次后?再進(jìn)行該憑證得批次更新 蕴潦,難度很大

前臺(tái)操作時(shí)migo收獲操作









···
DATA:lv_mblnr?TYPE?mblnr,?????lv_mjahr?TYPE?mjahr.*?????ls_mkpf??TYPE?mkpf,*?????lt_mseg??TYPE?TABLE?OF?mseg.DATA:?g_classname??TYPE?rzlli_apcl,???"Server?Group?Name??????g_applserver?TYPE?rzllitab-applserver.?"RFC?Serve?Group

DATA?:?gname???LIKE?seqg3-gname?VALUE?'MKPF',???????garg????LIKE??seqg3-garg,???????raw_enq?LIKE??seqg7?OCCURS?0?WITH?HEADER?LINE,???????guname??LIKE??seqg3-guname.

CALL?'C_SAPGPARAM'?????????ID?'NAME'??FIELD?'rdisp/myname'?????????ID?'VALUE'??FIELD?g_applserver.SELECT?SINGLE?classname

????????????FROM???rzllitab

????????????INTO???g_classname???"Server?Group?Name???????????WHERE???applserver?=?g_applserver

?????????????AND???grouptype?=?'S'.???"S:服務(wù)器組,空:登陸組

READ?TABLE?doc_head_tab?INTO?DATA(ls_bkpf)?INDEX?1.CHECK?ls_bkpf-awkey?IS?NOT?INITIAL.CLEAR:lv_mblnr,lv_mjahr.

lv_mblnr

?=?ls_bkpf-awkey+0(10).

lv_mjahr

?=?ls_bkpf-awkey+10(4).

IF?sy-tcode?=?'MIGO'.??CALL?FUNCTION?'ZFM_MM_CREATE_BATCH_DEST'?STARTING?NEW?TASK?lv_mblnr

????DESTINATION?IN?GROUP?g_classname

????PERFORMING?frm_batch_upload?ON?END?OF?TASK????EXPORTING??????iv_mblnr?=?lv_mblnr

??????iv_mjahr?=?lv_mjahr.ENDIF.



FORM?frm_batch_upload?USING?lv_mblnr.??RECEIVE?RESULTS?FROM?FUNCTION?'ZFM_MM_CREATE_BATCH_DEST'.ENDFORM.



Rfc內(nèi)容

FUNCTION?zfm_mm_create_batch_dest.*"----------------------------------------------------------------------*"*"本地接口:*"??IMPORTING*"?????VALUE(IV_MBLNR)?TYPE??MBLNR?OPTIONAL*"?????VALUE(IV_MJAHR)?TYPE??MJAHR?OPTIONAL*"----------------------------------------------------------------------??DATA:iv_matnr??TYPE?matnr,???????iv_werks??TYPE?werks_d,???????iv_charg??TYPE?charg_d,???????e_objek???TYPE?cuobn,???????e_obtab???TYPE?tabelle,???????e_klart???TYPE?klassenart,???????e_class???TYPE?klasse_d,???????lt_num????TYPE?TABLE?OF?bapi1003_alloc_values_num,???????lt_char???TYPE?TABLE?OF?bapi1003_alloc_values_char,???????lt_curr???TYPE?TABLE?OF?bapi1003_alloc_values_curr,???????it_mseg???TYPE?TABLE?OF?mseg,???????is_mkpf???TYPE?mkpf,???????lt_return?TYPE?TABLE?OF?bapiret2.

??CLEAR:is_mkpf,it_mseg[].??DO?10?TIMES.????SELECT?SINGLE?*?INTO?CORRESPONDING?FIELDS?OF?is_mkpf?FROM?mkpf?WHERE?mblnr?=?iv_mblnr?AND?mjahr?=?iv_mjahr.????IF?sy-subrc?=?0.??????EXIT.????ELSE.??????WAIT?UP?TO?1?SECONDS.????ENDIF.??ENDDO.

??IF?is_mkpf?IS??INITIAL.????EXIT.??ENDIF.

??SELECT?*?INTO?CORRESPONDING?FIELDS?OF?TABLE?it_mseg?FROM?mseg?WHERE?mblnr?=?iv_mblnr?AND?mjahr?=?iv_mjahr.

*???????ls_catt???TYPE?bapibatchatt.??"產(chǎn)地?生產(chǎn)廠家編碼?生產(chǎn)產(chǎn)家??SELECT?FROM?ekpo?AS?a

??INNER?JOIN?ztcqm002?AS?b

??ON?a~werks?=?b~werks?AND?????a~matnr?=?b~matnr?AND?????a~idnlf?=?b~zid

??FIELDS??a~ebeln,a~ebelp,a~matnr,a~idnlf,??b~zid,b~zscsmc,b~zchandi

??FOR?ALL?ENTRIES?IN?@it_mseg[]

??WHERE?ebeln?=?@it_mseg-ebeln

????AND?ebelp?=?@it_mseg-ebelp

????AND?zdel?=?''???INTO?TABLE?@DATA(lt_ekpo).??SORT?lt_ekpo?BY?ebeln?ebelp?matnr.??DELETE?ADJACENT?DUPLICATES?FROM?lt_ekpo?COMPARING?ebeln?ebelp?matnr.*?上市許可持有人:證書類型Z032*?第二類醫(yī)療器械經(jīng)營備案憑證:證書類型Z015*?醫(yī)療器械經(jīng)營許可證:證書類型Z017??SELECT?FROM?ztgsp_lic_mas?AS?a

????INNER?JOIN?t001k?AS?b

????ON?a~bukrs?=?b~bukrs

????INNER?JOIN?ztgsp_bukrs?AS?c????ON?a~bukrs?=?c~bukrs

????FIELDS????a~zzlicid,b~bwkey?AS?werks,a~bukrs,a~matnr,a~zzholder,a~zzlictyp,a~zzlicno

????FOR?ALL?ENTRIES?IN?@it_mseg

????WHERE?matnr?=?@it_mseg-matnr

??????AND?zzlictyp?IN?('Z032','Z015','Z017')??????AND?zzvalto?>?@sy-datum

??????AND?b~bwkey?=?@it_mseg-werks

?????INTO?TABLE?@DATA(lt_lic_mas).??SORT?lt_lic_mas?BY?werks?matnr?zzlictyp.??DELETE?ADJACENT?DUPLICATES?FROM?lt_lic_mas?COMPARING?werks?matnr?zzlictyp.*注冊證/備案號(hào)取數(shù)邏輯:??SELECT?FROM?ztmm_master_bas

????FIELDS????matnr,????zzcba

????FOR?ALL?ENTRIES?IN?@it_mseg

????WHERE?matnr?=?@it_mseg-matnr

????INTO?TABLE?@DATA(lt_master_bas).??SORT?lt_master_bas?BY?matnr.??LOOP?AT?it_mseg?ASSIGNING?FIELD-SYMBOL(<fs_mseg>)?WHERE?bwart?=?'101'??????????????????????????????????????????????????????AND??kzbew?=?'B'?AND?charg?IS?NOT?INITIAL.????CLEAR:???????iv_matnr,???????iv_werks,???????iv_charg,???????e_objek,???????e_obtab,???????e_klart,???????e_class,*???????ls_catt,???????lt_num[],???????lt_char[],???????lt_curr[],???????lt_return[].????iv_matnr?=?<fs_mseg>-matnr.????iv_werks?=?<fs_mseg>-werks.????iv_charg?=?<fs_mseg>-charg.????CALL?FUNCTION?'VB_BATCH_2_CLASS_OBJECT'??????EXPORTING????????i_matnr?=?iv_matnr

????????i_charg?=?iv_charg

????????i_werks?=?iv_werks

??????IMPORTING????????e_objek?=?e_objek

????????e_obtab?=?e_obtab

????????e_klart?=?e_klart

????????e_class?=?e_class.????CALL?FUNCTION?'BAPI_OBJCL_GETDETAIL'??????EXPORTING*???????OBJECTKEY???????=????????objecttable?????=?e_obtab

????????classnum????????=?e_class

????????classtype???????=?e_klart

*???????KEYDATE?????????=?SY-DATUM*???????UNVALUATED_CHARS???????=?'?'*???????LANGUAGE????????=?SY-LANGU????????objectkey_long??=?e_objek

*?IMPORTING*???????STATUS??????????=*???????STANDARDCLASS???=??????TABLES????????allocvaluesnum??=?lt_num

????????allocvalueschar?=?lt_char

????????allocvaluescurr?=?lt_curr

????????return??????????=?lt_return.????READ?TABLE?lt_ekpo?ASSIGNING?FIELD-SYMBOL(<fs_ekpo>)?WITH?KEY?ebeln?=?<fs_mseg>-ebeln

??????????????????????????????????????????????????????????????????ebelp?=?<fs_mseg>-ebelp

??????????????????????????????????????????????????????????????????matnr?=?<fs_mseg>-matnr

??????????????????????????????????????????????????????????????????BINARY?SEARCH.????IF?sy-subrc?=?0.??????IF?e_class?=?'Z_BATCH01'.????????"?生產(chǎn)廠家編號(hào)????????IF?<fs_ekpo>-zid?IS?NOT?INITIAL.??????????READ?TABLE?lt_char?ASSIGNING?FIELD-SYMBOL(<fs_char>)?WITH?KEY?charact?=?'Z_DATA21'.??????????IF?sy-subrc?=?0.????????????<fs_char>-value_char?????=?<fs_ekpo>-zid.????????????<fs_char>-value_neutral??=?<fs_ekpo>-zid.??????????ELSE.????????????APPEND?INITIAL?LINE?TO?lt_char?ASSIGNING?<fs_char>.????????????<fs_char>-charact????????=?'Z_DATA21'.????????????<fs_char>-value_char?????=?<fs_ekpo>-zid.????????????<fs_char>-value_neutral??=?<fs_ekpo>-zid.??????????ENDIF.????????ENDIF.????????"生產(chǎn)廠家????????IF?<fs_ekpo>-zscsmc?IS?NOT?INITIAL.??????????IF?<fs_char>?IS?ASSIGNED.????????????UNASSIGN?<fs_char>.??????????ENDIF.??????????READ?TABLE?lt_char?ASSIGNING?<fs_char>?WITH?KEY?charact?=?'Z_DATA05'.??????????IF?sy-subrc?=?0.????????????<fs_char>-value_char?????=?<fs_ekpo>-zscsmc.????????????<fs_char>-value_neutral??=?<fs_ekpo>-zscsmc.??????????ELSE.????????????APPEND?INITIAL?LINE?TO?lt_char?ASSIGNING?<fs_char>.????????????<fs_char>-charact????????=?'Z_DATA05'.????????????<fs_char>-value_char?????=?<fs_ekpo>-zscsmc.????????????<fs_char>-value_neutral??=?<fs_ekpo>-zscsmc.??????????ENDIF.????????ENDIF.????????"產(chǎn)地????????IF?<fs_ekpo>-zchandi?IS?NOT?INITIAL.??????????IF?<fs_char>?IS?ASSIGNED.????????????UNASSIGN?<fs_char>.??????????ENDIF.??????????READ?TABLE?lt_char?ASSIGNING?<fs_char>?WITH?KEY?charact?=?'Z_DATA23'.??????????IF?sy-subrc?=?0.????????????<fs_char>-value_char?????=?<fs_ekpo>-zchandi.????????????<fs_char>-value_neutral??=?<fs_ekpo>-zchandi.??????????ELSE.????????????APPEND?INITIAL?LINE?TO?lt_char?ASSIGNING?<fs_char>.????????????<fs_char>-charact????????=?'Z_DATA23'.????????????<fs_char>-value_char?????=?<fs_ekpo>-zchandi.????????????<fs_char>-value_neutral??=?<fs_ekpo>-zchandi.??????????ENDIF.????????ENDIF.??????ENDIF.????ENDIF.????IF?e_class?=?'Z_BATCH03'.??????READ?TABLE?lt_lic_mas?ASSIGNING?FIELD-SYMBOL(<fs_lic_mas>)?WITH?KEY?werks?=?<fs_mseg>-werks"4.2.6??上市許可持有人??????????????????????????????????????????????????????????????????????????matnr?=?<fs_mseg>-matnr

??????????????????????????????????????????????????????????????????????????zzlictyp?=?'Z032'??????????????????????????????????????????????????????????????????????????BINARY?SEARCH.??????IF?sy-subrc?=?0.????????READ?TABLE?lt_char?ASSIGNING?<fs_char>?WITH?KEY?charact?=?'Z_DATA43'.????????IF?sy-subrc?=?0.??????????<fs_char>-value_char?????=?<fs_lic_mas>-zzlicno.??????????<fs_char>-value_neutral??=?<fs_lic_mas>-zzlicno.????????ELSE.??????????APPEND?INITIAL?LINE?TO?lt_char?ASSIGNING?<fs_char>.??????????<fs_char>-charact????????=?'Z_DATA43'.??????????<fs_char>-value_char?????=?<fs_lic_mas>-zzlicno.??????????<fs_char>-value_neutral??=?<fs_lic_mas>-zzlicno.????????ENDIF.??????ENDIF.??????READ?TABLE?lt_lic_mas?ASSIGNING?<fs_lic_mas>?WITH?KEY?werks????=?<fs_mseg>-werks

????????????????????????????????????????????????????????????matnr????=?<fs_mseg>-matnr

????????????????????????????????????????????????????????????zzlictyp?=?'Z015'????????????????????????????????????????????????????????????BINARY?SEARCH.??????IF?sy-subrc?=?0.????????READ?TABLE?lt_char?ASSIGNING?<fs_char>?WITH?KEY?charact?=?'Z_DATA45'."4.2.8??醫(yī)療器械經(jīng)營許可證????????IF?sy-subrc?=?0.??????????<fs_char>-value_char?????=?<fs_lic_mas>-zzlicno.??????????<fs_char>-value_neutral??=?<fs_lic_mas>-zzlicno.????????ELSE.??????????APPEND?INITIAL?LINE?TO?lt_char?ASSIGNING?<fs_char>.??????????<fs_char>-charact????????=?'Z_DATA45'.??????????<fs_char>-value_char?????=?<fs_lic_mas>-zzlicno.??????????<fs_char>-value_neutral??=?<fs_lic_mas>-zzlicno.????????ENDIF.??????ENDIF.??????READ?TABLE?lt_lic_mas?ASSIGNING?<fs_lic_mas>?WITH?KEY?werks????=?<fs_mseg>-werks

????????????????????????????????????????????????????????????matnr????=?<fs_mseg>-matnr

????????????????????????????????????????????????????????????zzlictyp?=?'Z017'????????????????????????????????????????????????????????????BINARY?SEARCH.??????IF?sy-subrc?=?0.????????READ?TABLE?lt_char?ASSIGNING?<fs_char>?WITH?KEY?charact?=?'Z_DATA46'."4.2.8??醫(yī)療器械經(jīng)營許可證????????IF?sy-subrc?=?0.??????????<fs_char>-value_char?????=?<fs_lic_mas>-zzlicno.??????????<fs_char>-value_neutral??=?<fs_lic_mas>-zzlicno.????????ELSE.??????????APPEND?INITIAL?LINE?TO?lt_char?ASSIGNING?<fs_char>.??????????<fs_char>-charact????????=?'Z_DATA46'.??????????<fs_char>-value_char?????=?<fs_lic_mas>-zzlicno.??????????<fs_char>-value_neutral??=?<fs_lic_mas>-zzlicno.????????ENDIF.??????ENDIF.??????READ?TABLE?lt_master_bas?ASSIGNING?FIELD-SYMBOL(<fs_master_bas>)?WITH?KEY?matnr?=?<fs_mseg>-matnr?BINARY?SEARCH.??????IF?sy-subrc?=?0.????????READ?TABLE?lt_char?ASSIGNING?<fs_char>?WITH?KEY?charact?=?'Z_DATA44'.????????IF?sy-subrc?=?0.??????????<fs_char>-value_char?????=?<fs_master_bas>-zzcba.??????????<fs_char>-value_neutral??=?<fs_master_bas>-zzcba.????????ELSE.??????????APPEND?INITIAL?LINE?TO?lt_char?ASSIGNING?<fs_char>.??????????<fs_char>-charact????????=?'Z_DATA44'.??????????<fs_char>-value_char?????=?<fs_master_bas>-zzcba.??????????<fs_char>-value_neutral??=?<fs_master_bas>-zzcba.????????ENDIF.??????ENDIF.????ENDIF.????CALL?FUNCTION?'BAPI_OBJCL_CHANGE'?"對特性值進(jìn)行一次更改??????EXPORTING*???????OBJECTKEY??????????=?E_OBJEK????????objecttable????????=?e_obtab

????????classnum???????????=?e_class

????????classtype??????????=?e_klart

????????objectkey_long?????=?e_objek

*??????IMPORTING*???????CLASSIF_STATUS?????=?V_STATUS??????TABLES????????allocvaluesnumnew??=?lt_num

????????allocvaluescharnew?=?lt_char

????????allocvaluescurrnew?=?lt_curr

????????return?????????????=?lt_return

??????EXCEPTIONS????????OTHERS?????????????=?01.

????DATA:lv_check?TYPE?c.????CLEAR:lv_check.????LOOP?AT?lt_return?ASSIGNING?FIELD-SYMBOL(<lfs_rettab>)?WHERE?type?CA?'AEX'.??????ROLLBACK?WORK.??????lv_check?=?'X'.??????EXIT.????ENDLOOP.

????IF?lv_check?=?''.??????COMMIT?WORK?.????ENDIF.??ENDLOOP.ENDFUNCTION.

···

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個(gè)濱河市钧排,隨后出現(xiàn)的幾起案子栅组,更是在濱河造成了極大的恐慌瑟俭,老刑警劉巖障斋,帶你破解...
    沈念sama閱讀 212,383評論 6 493
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異泪掀,居然都是意外死亡听绳,警方通過查閱死者的電腦和手機(jī),發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,522評論 3 385
  • 文/潘曉璐 我一進(jìn)店門异赫,熙熙樓的掌柜王于貴愁眉苦臉地迎上來椅挣,“玉大人,你說我怎么就攤上這事塔拳∈笾ぃ” “怎么了?”我有些...
    開封第一講書人閱讀 157,852評論 0 348
  • 文/不壞的土叔 我叫張陵靠抑,是天一觀的道長量九。 經(jīng)常有香客問我,道長,這世上最難降的妖魔是什么荠列? 我笑而不...
    開封第一講書人閱讀 56,621評論 1 284
  • 正文 為了忘掉前任类浪,我火速辦了婚禮,結(jié)果婚禮上弯予,老公的妹妹穿的比我還像新娘戚宦。我一直安慰自己个曙,他們只是感情好锈嫩,可當(dāng)我...
    茶點(diǎn)故事閱讀 65,741評論 6 386
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著垦搬,像睡著了一般呼寸。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上猴贰,一...
    開封第一講書人閱讀 49,929評論 1 290
  • 那天对雪,我揣著相機(jī)與錄音,去河邊找鬼米绕。 笑死瑟捣,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的栅干。 我是一名探鬼主播迈套,決...
    沈念sama閱讀 39,076評論 3 410
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼碱鳞!你這毒婦竟也來了桑李?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 37,803評論 0 268
  • 序言:老撾萬榮一對情侶失蹤窿给,失蹤者是張志新(化名)和其女友劉穎贵白,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體崩泡,經(jīng)...
    沈念sama閱讀 44,265評論 1 303
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡禁荒,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 36,582評論 2 327
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了角撞。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片呛伴。...
    茶點(diǎn)故事閱讀 38,716評論 1 341
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖靴寂,靈堂內(nèi)的尸體忽然破棺而出磷蜀,到底是詐尸還是另有隱情,我是刑警寧澤百炬,帶...
    沈念sama閱讀 34,395評論 4 333
  • 正文 年R本政府宣布褐隆,位于F島的核電站,受9級特大地震影響剖踊,放射性物質(zhì)發(fā)生泄漏庶弃。R本人自食惡果不足惜衫贬,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 40,039評論 3 316
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望歇攻。 院中可真熱鬧固惯,春花似錦、人聲如沸缴守。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,798評論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽屡穗。三九已至贴捡,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間村砂,已是汗流浹背烂斋。 一陣腳步聲響...
    開封第一講書人閱讀 32,027評論 1 266
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留础废,地道東北人汛骂。 一個(gè)月前我還...
    沈念sama閱讀 46,488評論 2 361
  • 正文 我出身青樓,卻偏偏與公主長得像评腺,于是被迫代替她去往敵國和親帘瞭。 傳聞我的和親對象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 43,612評論 2 350