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

/AFS/BAPI_MATERIAL_SAVEDATA



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ММ
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1636

PostPosted: Sat Sep 22, 2007 4:33 pm    Post subject: /AFS/BAPI_MATERIAL_SAVEDATA Reply with quote

Code:
*&---------------------------------------------------------------------*
*& Modification Log : *
*& Date Developer Correction Description *
*& -------- ------------- --------------- ----------------------------
*& Author: Tanju
*&---------------------------------------------------------------------*
REPORT zsd_b_liste_psf_update NO STANDARD PAGE HEADING
LINE-SIZE 255 MESSAGE-ID zz .

* type-Pools
TYPE-POOLS: slis.

* --------------------------- Tables -----------------------------
TABLES: mara ,
makt ,
a501 , "Satış org./Malzeme
konp , "Koşullar (kalem)
keko , "Ürün maliyet hesaplaması - Başlık bilgileri
zsd_fiyat_copy. "SD Fiyat Copy Tablosu

* BAPI
TABLES: bapicstgva ,
bapimateri ,
bapiplant ,
bapivalidi ,
bapicstgst ,
bapicostingversion.

* ---------------------- Internal Tables ---------------------------
DATA: BEGIN OF i_main OCCURS 0,
anagrup LIKE mara-anagrup,
marka LIKE mara-marka,
yil LIKE mara-yil,
sezon LIKE mara-sezon,
grup LIKE mara-grup,
matnr LIKE mara-matnr,
maktx LIKE makt-maktx,
listepsf LIKE mara-zzlstpsf,
lparabir LIKE t001-waers,
zzcins LIKE mara-zzcins,
kbetr LIKE konp-kbetr,
psf_kbetr LIKE konp-kbetr,
maliyet LIKE konp-kbetr,
mparabir LIKE t001-waers,
END OF i_main.

DATA: i_selected_table LIKE i_main OCCURS 0 WITH HEADER LINE.

* BAPI için Malzeme Bilgisini içeren internal table yaratıldı.
DATA: BEGIN OF stabmara OCCURS 0,
sign(01) ,
option(02) ,
low LIKE mara-matnr,
high LIKE mara-matnr,
END OF stabmara.

*---------------------------- Variables ------------------------
DATA: ok_code LIKE sy-ucomm,
save_ok_code LIKE sy-ucomm,
flag(01) ,
l_box(01) .
DATA: index LIKE sy-index,
w_count LIKE sy-index.
DATA: filename LIKE rlgrap-filename,
filetype LIKE rlgrap-filetype,
filelength(5) ,
w_canc(04) .

* ALV
DATA: tb_fieldcat TYPE slis_t_fieldcat_alv,
st_fieldcat_line TYPE slis_fieldcat_alv,
st_layout TYPE slis_layout_alv,
st_print TYPE slis_print_alv,
tb_list_top_of_page TYPE slis_t_listheader,
tb_events TYPE slis_t_event,
tb_sort TYPE slis_t_sortinfo_alv,
tb_header TYPE slis_t_listheader,
st_header_line TYPE slis_listheader.

* BAPI
DATA: returndetail LIKE bapireturn.
DATA: cost_components LIKE bapisplitt OCCURS 0 WITH HEADER LINE.

DATA: returnlist LIKE bapireturn,
cost_estimate_header LIKE bapiheader,
costestimate_list LIKE TABLE OF bapicolist WITH HEADER LINE.
DATA: cost_components_list LIKE cost_estimate_header.
*DATA: BEGIN OF cost_components_list OCCURS 0,
* localprice LIKE mara-zzorfyt.
* INCLUDE STRUCTURE zpc_cost_components_list.
*DATA: END OF cost_components_list.

* Report Selections
SELECTION-SCREEN BEGIN OF BLOCK 0 WITH FRAME TITLE text-0h1.
SELECT-OPTIONS: so_marka FOR mara-marka NO INTERVALS
NO-EXTENSION OBLIGATORY,
so_yil FOR mara-yil NO INTERVALS
NO-EXTENSION OBLIGATORY,
so_sezon FOR mara-sezon NO INTERVALS
NO-EXTENSION OBLIGATORY,
so_grup FOR mara-grup NO INTERVALS
NO-EXTENSION ,
so_matnr FOR bapimateri-low MATCHCODE OBJECT mat1.
SELECTION-SCREEN END OF BLOCK 0.

SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
SELECT-OPTIONS: so_werks FOR bapiplant-low NO-DISPLAY,
so_klvar FOR bapicstgva-low NO-DISPLAY,
so_tvers FOR bapicostingversion-low NO-DISPLAY,
so_date FOR bapivalidi-low NO-DISPLAY,
so_stat FOR bapicstgst-low NO-DISPLAY.
* No Display
PARAMETERS: coststat LIKE bapicostes-cosestimat DEFAULT 3
MODIF ID hid NO-DISPLAY.
PARAMETERS: view LIKE bapicostes-view
DEFAULT '01' NO-DISPLAY.
PARAMETERS: p_curr LIKE bapicostes-currency DEFAULT '01'
MODIF ID hid NO-DISPLAY.
* Para Birimi 01 için TRY, 02 için EUR değerini vermektedir.
SELECTION-SCREEN: END OF BLOCK b2.

*------------------------- START-OF-SELECTION -------------------------*
START-OF-SELECTION.
PERFORM initial_condition.
PERFORM fill_i_main.

END-OF-SELECTION.
*------------------------- End-of-Selection -----------------------
END-OF-SELECTION.
* Events
PERFORM eventtab_build CHANGING tb_events.
* Display
PERFORM write_i_main_for_alv.

* ----------------------------- Event Bilgileri --------------------- *

*&---------------------------------------------------------------------*
*& Form initial_condition
*&---------------------------------------------------------------------*
* Initial
*----------------------------------------------------------------------*
FORM initial_condition .
REFRESH: i_main.
CLEAR : i_main.

* Mara Bilgisi Ana Kaydı
SELECT * APPENDING CORRESPONDING FIELDS OF TABLE i_main
FROM mara
WHERE marka EQ so_marka-low
AND yil EQ so_yil-low
AND sezon EQ so_sezon-low
AND grup IN so_grup
AND matnr IN so_matnr .
break tlise.

ENDFORM. " initial_condition

*&---------------------------------------------------------------------*
*& Form fill_i_main
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM fill_i_main .
CLEAR : i_main.
break tlise.
LOOP AT i_main.
SELECT SINGLE * FROM makt WHERE matnr EQ i_main-matnr
AND spras EQ sy-langu .
IF sy-subrc EQ 0.
i_main-maktx = makt-maktx.
* Kar Marjı
SELECT SINGLE * FROM a501 WHERE matnr EQ i_main-matnr
AND kschl EQ 'BKM'
AND vkorg EQ '2000'
AND datbi EQ '99991231'.
IF sy-subrc EQ 0.
SELECT SINGLE * FROM konp WHERE knumh EQ a501-knumh.
IF sy-subrc EQ 0.
i_main-kbetr = -1 * ( konp-kbetr ) / 10.
ENDIF.
ENDIF.
* PSF
SELECT SINGLE * FROM a501 WHERE matnr EQ i_main-matnr
AND kschl EQ 'PSF1'
AND vkorg EQ '2000'
AND datbi EQ '99991231'.
IF sy-subrc EQ 0.
SELECT SINGLE * FROM konp WHERE knumh EQ a501-knumh.
IF sy-subrc EQ 0.
i_main-psf_kbetr = konp-kbetr.
ENDIF.
ENDIF.
* Mara-Anagrup = 1 => EUR ; Mara-Anagrup = 2 veya 3 => USD
CASE i_main-anagrup.
WHEN '1'.
i_main-lparabir = 'EUR'.
WHEN '2'.
i_main-lparabir = 'USD'.
WHEN '3'.
i_main-lparabir = 'USD'.
ENDCASE.

* Maliyet Bilgisinin Bulunması (BAPI den)
PERFORM find_cost_estimate_values.

MODIFY i_main.
CLEAR: i_main.
ENDIF.
ENDLOOP.
ENDFORM. " fill_i_main

*&---------------------------------------------------------------------*
*& Module USER_COMMAND_0100 INPUT
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
MODULE user_command_0100 INPUT.
IF ok_code EQ 'BACK' OR ok_code EQ '%EX' OR ok_code EQ 'RW'.
LEAVE PROGRAM.
ENDIF.

ENDMODULE. " USER_COMMAND_0100 INPUT

*&---------------------------------------------------------------------*
*& Form write_i_main_for_alv
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM write_i_main_for_alv .
*-----------------------------------------------------------------------
* Instead of statement 'INCLUDE <icon>.', please use
* statement 'TYPE-POOLS: icon.' directly.
*-----------------------------------------------------------------------
TYPE-POOLS: icon.

DATA: gt_fieldcat TYPE slis_fieldcat_alv OCCURS 1 WITH HEADER LINE.
DATA: col_pos LIKE gt_fieldcat-col_pos.
DATA: lt_events TYPE slis_t_event.
DATA: ls_layout TYPE slis_layout_alv.
DATA: lt_event_exit TYPE slis_t_event_exit.
DATA: ls_event_exit TYPE slis_event_exit.
DATA: sortitab TYPE slis_t_sortinfo_alv WITH HEADER LINE.
DATA: handle_style TYPE lvc_t_styl.

CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'ZTMPTLSD_B_LISTE_PSF_UPDATE02'
i_internal_tabname = 'I_MAIN'
i_inclname = 'ZTMPTLSD_B_LISTE_PSF_UPDATE02'
CHANGING
ct_fieldcat = gt_fieldcat[].
*
LOOP AT gt_fieldcat.
CASE gt_fieldcat-fieldname.

WHEN 'ANAGRUP'.
gt_fieldcat-no_out = 'X'.

WHEN 'LISTEPSF'.
gt_fieldcat-qtabname = 'I_MAIN'.
gt_fieldcat-datatype = 'CURR'.
gt_fieldcat-reptext_ddic = 'Liste Psf'.
gt_fieldcat-seltext_l = 'Liste Psf'.
gt_fieldcat-seltext_m = 'Liste Psf'.
gt_fieldcat-seltext_s = 'Liste Psf'.
gt_fieldcat-edit = 'X'.
* gt_fieldcat-do_sum = 'X'.

WHEN 'LPARABIR'.
gt_fieldcat-qtabname = 'I_MAIN'.
gt_fieldcat-qfieldname = 'WAERS'.
gt_fieldcat-datatype = 'CURR'.
gt_fieldcat-reptext_ddic = 'Para Birimi'.
gt_fieldcat-seltext_l = 'Para Birimi'.
gt_fieldcat-seltext_m = 'Para Birimi'.
gt_fieldcat-seltext_s = 'Para Birimi'.

WHEN 'KBETR'.
gt_fieldcat-qtabname = 'I_MAIN'.
gt_fieldcat-qfieldname = 'KONWA'.
gt_fieldcat-datatype = 'CURR'.
gt_fieldcat-reptext_ddic = 'Kar Marjı'.
gt_fieldcat-seltext_l = 'Kar Marjı'.
gt_fieldcat-seltext_m = 'Kar Marjı'.
gt_fieldcat-seltext_s = 'Kar Marjı'.

WHEN 'PSF_KBETR'.
gt_fieldcat-qtabname = 'I_MAIN'.
gt_fieldcat-qfieldname = 'KONWA'.
gt_fieldcat-datatype = 'CURR'.
gt_fieldcat-reptext_ddic = 'PSF'.
gt_fieldcat-seltext_l = 'PSF'.
gt_fieldcat-seltext_m = 'PSF'.
gt_fieldcat-seltext_s = 'PSF'.

WHEN 'MALIYET'.
gt_fieldcat-qtabname = 'I_MAIN'.
gt_fieldcat-qfieldname = 'KONWA'.
gt_fieldcat-datatype = 'CURR'.
gt_fieldcat-reptext_ddic = 'Maliyet'.
gt_fieldcat-seltext_l = 'Maliyet'.
gt_fieldcat-seltext_m = 'Maliyet'.
gt_fieldcat-seltext_s = 'Maliyet'.

WHEN 'MPARABIR'.
gt_fieldcat-qtabname = 'I_MAIN'.
gt_fieldcat-qfieldname = 'WAERS'.
gt_fieldcat-datatype = 'CURR'.
gt_fieldcat-reptext_ddic = 'Para Birimi'.
gt_fieldcat-seltext_l = 'Para Birimi'.
gt_fieldcat-seltext_m = 'Para Birimi'.
gt_fieldcat-seltext_s = 'Para Birimi'.

ENDCASE.
MODIFY gt_fieldcat.
ENDLOOP.
*
ls_event_exit-ucomm = '&REFRESH'.
ls_event_exit-before = space.
ls_event_exit-after = 'X'.
APPEND ls_event_exit TO lt_event_exit.

ls_layout-colwidth_optimize = 'X'.
ls_layout-zebra = 'X'.
* ls_layout-totals_text = 'X'.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = 'ZTMPTLSD_B_LISTE_PSF_UPDATE02'
is_layout = ls_layout
it_fieldcat = gt_fieldcat[]
i_callback_user_command = 'USER_COMMAND'
it_events = tb_events[]
it_event_exit = lt_event_exit
it_sort = sortitab[]
TABLES
t_outtab = i_main
EXCEPTIONS
program_error = 1
OTHERS = 2.


ENDFORM. " write_i_main_for_alv

*&---------------------------------------------------------------------*
*& Form eventtab_build
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* <--P_TB_EVENTS text
*----------------------------------------------------------------------*
FORM eventtab_build CHANGING lt_events TYPE slis_t_event.
CONSTANTS:
gc_formname_top_of_page TYPE slis_formname VALUE 'ALV_TOP_OF_PAGE',
gc_formname_pf_status_set TYPE slis_formname VALUE 'PF_STATUS_SET',
gc_formname_user_command TYPE slis_formname VALUE 'USER_COMMAND'.

DATA: ls_event TYPE slis_alv_event.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = lt_events.

* Define TOP_OF_PAGE
READ TABLE lt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE gc_formname_top_of_page TO ls_event-form.
APPEND ls_event TO lt_events.
ENDIF.

* Define PF_STATUS_SET event
READ TABLE lt_events WITH KEY name = slis_ev_pf_status_set
INTO ls_event.
IF sy-subrc = 0.
MOVE gc_formname_pf_status_set TO ls_event-form.
APPEND ls_event TO lt_events.
ENDIF.

* Define USER_COMMAND event
READ TABLE lt_events WITH KEY name = slis_ev_user_command
INTO ls_event.
IF sy-subrc = 0.
MOVE gc_formname_user_command TO ls_event-form.
APPEND ls_event TO lt_events.
ENDIF.

ENDFORM. " eventtab_build

*&---------------------------------------------------------------------*
*& Form pf_status_set
*&---------------------------------------------------------------------*
FORM pf_status_set USING rt_extab TYPE slis_t_extab .
SET PF-STATUS 'GUI100'.
ENDFORM. "set_status

*&---------------------------------------------------------------------*
*& Form user_command
*&---------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
break tlise.
CASE r_ucomm.
WHEN 'AKTAR'.
PERFORM update_liste_psf.
* WHEN OTHERS.
* SET SCREEN 0.
ENDCASE.
* rs_selfield-refresh = 'X'.

ENDFORM. "user_command

*&---------------------------------------------------------------------*
*& Form alv_top_of_page
*&---------------------------------------------------------------------*
FORM alv_top_of_page.
DATA : vi_str(200).
CLEAR: st_header_line.
FREE : tb_header.

st_header_line-typ = 'H'.
st_header_line-info = text-t01.
APPEND st_header_line TO tb_header .

CLEAR: st_header_line.
* st_header_line-typ = 'S'.
** st_header_line-key = text-t02.
** concatenate pa_bukrs ' ' t001-butxt into st_header_line-info.
* APPEND st_header_line TO tb_header .
*
* CLEAR: st_header_line.
* st_header_line-typ = 'S'.
** st_header_line-key = text-t03.
** write pa_valut to st_header_line-info .
* APPEND st_header_line TO tb_header .
*
* CLEAR: st_header_line.
* st_header_line-typ = 'S'.
* APPEND st_header_line TO tb_header .

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
i_logo = 'LOGO1'
it_list_commentary = tb_header.

ENDFORM. " aalv_top_of_page.
*&---------------------------------------------------------------------*
*& Form find_cost_estimate_values
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM find_cost_estimate_values .

* BAPI' nin okuyabilmesi için internal table yapıldı.
REFRESH stabmara.
CLEAR stabmara.
MOVE : 'I' TO stabmara-sign,
'EQ' TO stabmara-option,
i_main-matnr TO stabmara-low.
APPEND stabmara.

* Call BAPI
CALL FUNCTION 'BAPI_COSTESTIMATE_GETLIST'
EXPORTING
cost_estimate = coststat
IMPORTING
return = returnlist
TABLES
costing_variant = so_klvar
material = stabmara
plant = so_werks
validity_from = so_date
costing_version = so_tvers
costing_status = so_stat
cost_estimate_list = costestimate_list.

* Sort sırası çok önemli.. KPM4 doluysa Maliyet olarak BBP4' ü alacak.
* Eğer KPM4 ve BBP4 yoksa KPM3 ve BBP3' e bakacak. Bu sıra KPM2 ve BBP2;
* KPM1 ve BBP1 şeklinde devam edecek. KPM1 yoksa BBP1 maliyet olarak
* alınacak.
* SORT costestimate_list BY cstg_num ASCENDING cstg_type DESCENDING.
SORT costestimate_list BY cstg_num ASCENDING cstg_type ASCENDING.
break tlise.

LOOP AT costestimate_list.
CALL FUNCTION 'BAPI_COSTESTIMATE_GETDETAIL'
EXPORTING
referenceobject = costestimate_list-ref_object
costingnumber = costestimate_list-cstg_num
costingtype = costestimate_list-cstg_type
costingdate = costestimate_list-cstg_date
costingversion = costestimate_list-version
valuationvariant = costestimate_list-vltn_vrnt
enteredmanually = costestimate_list-enter_man
cost_component_view = view
currency_org_unit = p_curr
IMPORTING
cost_estimate_header = cost_estimate_header
return = returndetail
TABLES
cost_components = cost_components
EXCEPTIONS
OTHERS = 1.

IF returndetail-type = 'E' OR returndetail-type = 'A'.
REFRESH cost_components.
CLEAR cost_estimate_header.
ENDIF.

CASE cost_estimate_header-cstg_vrnt.
WHEN 'BBP4'.
i_main-maliyet = cost_estimate_header-total_amt.
i_main-mparabir = 'TRY' .
EXIT.

WHEN 'BBP3'.
i_main-maliyet = cost_estimate_header-total_amt.
i_main-mparabir = 'TRY' .
EXIT.

WHEN 'BBP2'.
i_main-maliyet = cost_estimate_header-total_amt.
i_main-mparabir = 'TRY' .
EXIT.

WHEN 'BBP1'.
i_main-maliyet = cost_estimate_header-total_amt.
i_main-mparabir = 'TRY' .
EXIT.

ENDCASE.

ENDLOOP.

ENDFORM. " find_cost_estimate_values
*&---------------------------------------------------------------------*
*& Form update_liste_psf
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
FORM update_liste_psf.
DATA: l_headdata LIKE /afs/bapimathead OCCURS 0 WITH HEADER LINE,
va_return LIKE bapiret2,
tb_returnmessages LIKE bapi_matreturn2 OCCURS 0 WITH header line.
DATA: i_bapiparex LIKE bapiparex OCCURS 0.
* w_bapiparex LIKE bapiparex .
* DATA: w_bapi_te_mara LIKE bapi_te_mara ,
* w_bapi_te_marax LIKE bapi_te_marax .


LOOP AT i_main.
* BAPI değerlerinin doldurulması
PERFORM fill_data.

CALL FUNCTION '/AFS/BAPI_MATERIAL_SAVEDATA'
EXPORTING
headdata = l_headdata
* CLIENTDATA =
* CLIENTDATAX =
* PLANTDATA =
* PLANTDATAX =
* FORECASTPARAMETERS =
* FORECASTPARAMETERSX =
* PLANNINGDATA =
* PLANNINGDATAX =
* STORAGELOCATIONDATA =
* STORAGELOCATIONDATAX =
* valuationdata = va_valuationdata
* valuationdatax = va_valuationdatax
* WAREHOUSENUMBERDATA =
* WAREHOUSENUMBERDATAX =
* SALESDATA =
* SALESDATAX =
* STORAGETYPEDATA =
* STORAGETYPEDATAX =
IMPORTING
return = va_return
TABLES
* MATERIALDESCRIPTION =
* UNITSOFMEASURE =
* UNITSOFMEASUREX =
* SKUUNITSOFMEASURE =
* INTERNATIONALARTNOS =
* MATERIALLONGTEXT =
* TAXCLASSIFICATIONS =
returnmessages = tb_returnmessages
* PRTDATA =
* PRTDATAX =
EXTENSIONIN = i_bapiparex .
* EXTENSIONINX =
* SKU_PLANTDATA_MRP =
* SKU_PLANTDATA_VALUATION =
* SKU_PALLETIZATION_WM =
* SKU_STRATEGIES_WM =
* SKU_CAPUSAGE_WM =
* SKU_STORAGETYPEDATA =
* AFS_SEASONDATA =
* SKU_SALESDATA =
* AFS_QUOTACATEGORIES =
.



* PERFORM check_return.
* CLEAR planfiyat2.
ENDLOOP.

ENDFORM. " update_liste_psf
*&---------------------------------------------------------------------*
*& Form fill_data
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* --> p1 text
* <-- p2 text
*----------------------------------------------------------------------*
FORM fill_data .
* va_headdata LIKE /AFS/BAPIMATHEAD,
* va_valuationdata LIKE bapi_mbew,
* va_valuationdatax LIKE bapi_mbewx,

* Exporting ve Tables (l_poitem ve l_poitemx) Bilgileri Dolduruluyor
DATA: l_headdata LIKE /afs/bapimathead .
* l_poheaderx LIKE bapimepoheaderx OCCURS 0 WITH HEADER LINE.
* DATA: l_poitem LIKE bapimepoitem OCCURS 0 WITH HEADER LINE,
* l_poitemx LIKE bapimepoitemx OCCURS 0 WITH HEADER LINE.
DATA: gt_bapiret2 LIKE bapiret2 OCCURS 0 WITH HEADER LINE.

* LOOP AT i_main.
l_headdata-material = i_main-matnr.
* l_poheaderx-po_number = 'X'.

* l_poheader-exch_rate = i_ekpo-zzwkurs.
* l_poheaderx-exch_rate = 'X'.

* l_poitem-po_item = i_ekpo-ebelp.
* l_poitemx-po_item = i_ekpo-ebelp.
* l_poitemx-po_itemx = 'X'.

* APPEND l_headdata.
* APPEND l_poheaderx.
* APPEND l_poitem.
* APPEND l_poitemx.
* ENDLOOP.

DATA: i_bapiparex LIKE bapiparex OCCURS 0.
data: w_bapiparex LIKE bapiparex .
DATA: w_bapi_te_mara LIKE bapi_te_mara ,
w_bapi_te_marax LIKE bapi_te_marax .

* Mara-zzlstpsf ve Mara-lstpbr bilgilerinin update edilmesi istendi.
* Bu bilgiler Ek Geliştirmeler içinde olduğundan Tables -> EXTENSIONIN
* bilgisinin kullanılması gerekmektedir.
* Tables -> EXTENSIONIN -> Long Text kısmına bakınca 2 adet BAPI
* structure table olduğunu görürüz. Bunlar ;
* BAPI_TE_MARA ve BAPI_TE_MARAX dir.
w_bapi_te_mara-material = i_main-matnr.
* w_bapi_te_mepoitem-zzwkurs = i_ekpo-zzwkurs.

* DATA: l_container TYPE me_max_container.
* CALL METHOD cl_abap_container_utilities=>fill_container_c
* EXPORTING
* im_value = w_bapi_te_mara
* IMPORTING
* ex_container = l_container
* EXCEPTIONS
* illegal_parameter_type = 1
* OTHERS = 2.
*
* w_bapiparex-valuepart1 = l_container.

w_bapiparex-structure = 'BAPI_TE_MARA'.
* w_bapiparex-valuepart1 = i_main-listepsf.
w_bapiparex-valuepart1 = 200.

APPEND w_bapiparex TO i_bapiparex.

* w_bapi_te_mepoitemx-po_item = i_ekpo-ebelp.
* w_bapi_te_mepoitemx-zzwkurs = 'X'.
* w_bapiparex-structure = 'BAPI_TE_MEPOITEMX'.
* w_bapiparex-valuepart1 = w_bapi_te_mepoitemx.
* APPEND w_bapiparex TO i_bapiparex.

* va_headdata-material = i_main-matnr.
* va_valuationdata-val_area = itab-werks.
* va_valuationdata-plndprice1 = itab-planfiyat2 .
* va_valuationdata-plndprdate1 = sy-datum.
* va_valuationdatax-val_area = itab-werks.
* va_valuationdatax-plndprice1 = 'X'.
* va_valuationdatax-plndprdate1 = 'X'.

ENDFORM. " fill_data
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 -> ММ 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 cannot 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.