Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

*Programa de para llenar dato de la transaccin VK11 y Visualizarlos en la VK13

REPORT ZPRUEBAVK11.

TABLES: mvke, MARA. DATA: DATA: DATA: DATA: DATA: DATA: DATA: ta_bapicondct TYPE bapicondct OCCURS ta_bapicondhd TYPE bapicondhd OCCURS ta_bapicondit TYPE bapicondit OCCURS ta_bapicondqs TYPE bapicondqs OCCURS ta_bapicondvs TYPE bapicondvs OCCURS ta_bapiret2 TYPE bapiret2 OCCURS 0. ret TYPE bapiret2. 0. 0. 0. 0. 0.

DATA: ta_bapiknumhs TYPE bapiknumhs OCCURS 0. DATA: ta_mem_initial TYPE cnd_mem_initial OCCURS 0. DATA: wa_bapicondct DATA: wa_bapicondhd DATA: wa_bapicondit LIKE lINE OF ta_bapicondct. LIKE lINE OF ta_bapicondhd. LIKE lINE OF ta_bapicondit.

data: h_varkey(100). data: h_cond_unit type meins. PARAMETERS: i_vkorg TYPE vkorg, "organizacin i_vtweg TYPE vtweg, "I_KUN TYPE KUNNR, i_upm type upmat, "precio de referencia del material i_matnr TYPE matnr, COND_T LIKE wa_bapicondct-cond_type, "I_COND_TYPE VAL_TO LIKE wa_bapicondct-valid_to,"I_VALID_TO VAL_FR LIKE wa_bapicondct-valid_FROM, "I_VALID_FORM CON_VAL LIKE wa_bapicondit-cond_value. " I_COND_VALUE. concatenate i_vkorg i_vtweg i_upm i_matnr into h_varkey respecting blanks .

select single meins from mara into h_cond_unit where matnr = i_matnr. select single * from mvke where matnr = i_matnr and vkorg = i_vkorg. if sy-subrc <> 0. raise vkorgerror. endif. *conditietabel

wa_bapicondct-table_no = '100'. wa_bapicondct-applicatio = 'V'. wa_bapicondct-cond_usage = 'A'. wa_bapicondct-cond_type = COND_T."I_COND_TYPE. wa_bapicondct-operation = '009'. wa_bapicondct-varkey = h_varkey. wa_bapicondct-valid_to = VAL_TO. wa_bapicondct-valid_from = VAL_FR."I_VALID_FROM. wa_bapicondct-cond_no = '$000000001'. APPEND wa_bapicondct TO ta_bapicondct. *KONH wa_bapicondhd-operation = '009'. wa_bapicondhd-cond_no = '$000000001'. wa_bapicondhd-created_by = sy-uname. wa_bapicondhd-creat_date = sy-datum. wa_bapicondhd-cond_usage = 'A'. wa_bapicondhd-table_no = '100'. wa_bapicondhd-applicatio = 'V'. wa_bapicondhd-cond_type = COND_T."I_COND_TYPE. wa_bapicondhd-varkey = h_varkey. wa_bapicondhd-valid_from = VAL_FR. "I_VALID_FROM. wa_bapicondhd-valid_to = VAL_TO."I_VALID_TO. APPEND wa_bapicondhd TO ta_bapicondhd.

*KONP tabel wa_bapicondit-operation = '009'. wa_bapicondit-cond_no = '$000000001'. wa_bapicondit-cond_count = '01'. wa_bapicondit-applicatio = 'V'. wa_bapicondit-cond_type = COND_T."I_COND_TYPE. wa_bapicondit-scaletype = 'A'. "STFKZ Staffelsoort wa_bapicondit-scalebasin = 'C'. "KZBZG Teken:rekeneenheid wa_bapiconditscale_qty = '1'. "KSTBM Conditiestaffelbasis hoeveelheid wa_bapicondit-cond_p_unt = '1'. "KPEIN prijseenheid wa_bapicondit-cond_unit = h_cond_unit. "KMEIN Conditiehoeveelheidseenheid wa_bapicondit-calctypcon = 'C'. "KRECH Conditie-rekenregel wa_bapicondit-cond_value = CON_VAL."I_COND_VALUE. wa_bapicondit-condcurr = 'EUR'. APPEND wa_bapicondit TO ta_bapicondit.

CALL FUNCTION 'BAPI_PRICES_CONDITIONS' * EXPORTING

* *

PI_INITIALMODE PI_BLOCKNUMBER TABLES ti_bapicondct ti_bapicondhd ti_bapicondit ti_bapicondqs ti_bapicondvs to_bapiret2 to_bapiknumhs to_mem_initial EXCEPTIONS UPDATE_ERROR OTHERS .

= 'X' = = = = = = = = = = 1 = 2 ta_bapicondct ta_bapicondhd ta_bapicondit ta_bapicondqs ta_bapicondvs ta_bapiret2 ta_bapiknumhs ta_mem_initial

if sy-subrc = 1. raise update_error. endif. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' *EXPORTING * WAIT = IMPORTING return = ret. MESSAGE 'Material Agregado' type 'S'.

Transaccion Vk13

Seleccionamos

Dato visualizado en la transaccin VK13

Dato en la tabla.

Para encontrar las tablas a las que va asociada la transaccin VK13

Introduces el tipo de condicin

Seleccionas Introduces tu material o los valores que hayas ingresado y f8

Genera la siguiente pantalla

Seleccionas en la barra de herramientas GOTO > ALV DISPLAY

Te genera la siguiente pantalla

Seleccionas el icono de Y te genera las tablas asociadas a es transaccin.

*cambios para la tabla de para la tabla A920 REPORT ZPRUEBAVK11.

TABLES: mvke, MARA, marc. DATA: DATA: DATA: DATA: DATA: DATA: DATA: ta_bapicondct TYPE bapicondct OCCURS ta_bapicondhd TYPE bapicondhd OCCURS ta_bapicondit TYPE bapicondit OCCURS ta_bapicondqs TYPE bapicondqs OCCURS ta_bapicondvs TYPE bapicondvs OCCURS ta_bapiret2 TYPE bapiret2 OCCURS 0. ret TYPE bapiret2. 0. 0. 0. 0. 0.

DATA: ta_bapiknumhs TYPE bapiknumhs OCCURS 0. DATA: ta_mem_initial TYPE cnd_mem_initial OCCURS 0. DATA: wa_bapicondct DATA: wa_bapicondhd DATA: wa_bapicondit LIKE lINE OF ta_bapicondct. LIKE lINE OF ta_bapicondhd. LIKE lINE OF ta_bapicondit.

data: h_varkey(100). data: h_cond_unit type meins. PARAMETERS: COND_T LIKE wa_bapicondctcond_type, "Condicional "I_COND_TYPE i_vkorg TYPE vkorg, "centro i_vtweg TYPE vtweg, "Canal de distribucin i_werks type werks, "Tabla Marc plant "I_KUN TYPE KUNNR, "i_upm type upmat, "Precio de referencia del material i_matnr TYPE matnr, "Material VAL_TO LIKE wa_bapicondct-valid_to,"Fin de validez VAL_FR LIKE wa_bapicondct-valid_FROM, "Inicio de validez CON_VAL LIKE wa_bapiconditcond_value. "KNUMH Condition record number concatenate i_vtweg i_werks i_matnr into h_varkey respecting blanks. select single meins from mara into h_cond_unit

where matnr = i_matnr. select single * from mvke where matnr = i_matnr and vkorg = i_vkorg . select single * from marc where matnr = i_matnr and werks = i_werks. if sy-subrc <> 0. raise vkorgerror. endif. *conditietabel wa_bapicondct-table_no = '920'. wa_bapicondct-applicatio = 'V'. wa_bapicondct-cond_usage = 'A'. wa_bapicondct-cond_type = COND_T. wa_bapicondct-operation = '009'. wa_bapicondct-varkey = h_varkey. wa_bapicondct-valid_to = VAL_TO. wa_bapicondct-valid_from = VAL_FR. wa_bapicondct-cond_no = '$000000001'. APPEND wa_bapicondct TO ta_bapicondct. *KONH wa_bapicondhd-operation = '009'. wa_bapicondhd-cond_no = '$000000001'. wa_bapicondhd-created_by = sy-uname. wa_bapicondhd-creat_date = sy-datum. wa_bapicondhd-cond_usage = 'A'. wa_bapicondhd-table_no = '920'. wa_bapicondhd-applicatio = 'V'. wa_bapicondhd-cond_type = COND_T."I_COND_TYPE. wa_bapicondhd-varkey = h_varkey. wa_bapicondhd-valid_from = VAL_FR. "I_VALID_FROM. wa_bapicondhd-valid_to = VAL_TO."I_VALID_TO. APPEND wa_bapicondhd TO ta_bapicondhd.

*KONP tabel wa_bapicondit-operation = '009'. wa_bapicondit-cond_no = '$000000001'. wa_bapicondit-cond_count = '01'. wa_bapicondit-applicatio = 'V'. wa_bapicondit-cond_type = COND_T."I_COND_TYPE. wa_bapicondit-scaletype = 'A'. "STFKZ Staffelsoort

wa_bapicondit-scalebasin = 'C'. "KZBZG Teken:rekeneenheid wa_bapiconditscale_qty = '1'. "KSTBM Conditiestaffelbasis hoeveelheid wa_bapicondit-cond_p_unt = '1'. "KPEIN prijseenheid wa_bapicondit-cond_unit = h_cond_unit. "KMEIN Conditiehoeveelheidseenheid wa_bapicondit-calctypcon = 'C'. "KRECH Conditie-rekenregel wa_bapicondit-cond_value = CON_VAL. wa_bapicondit-condcurr = 'EUR'. APPEND wa_bapicondit TO ta_bapicondit.

CALL FUNCTION 'BAPI_PRICES_CONDITIONS' * EXPORTING * PI_INITIALMODE = 'X' * PI_BLOCKNUMBER = TABLES ti_bapicondct = ta_bapicondct ti_bapicondhd = ta_bapicondhd ti_bapicondit = ta_bapicondit ti_bapicondqs = ta_bapicondqs ti_bapicondvs = ta_bapicondvs to_bapiret2 = ta_bapiret2 to_bapiknumhs = ta_bapiknumhs to_mem_initial = ta_mem_initial EXCEPTIONS UPDATE_ERROR = 1 OTHERS = 2 . if sy-subrc = 1. raise update_error. endif. CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' *EXPORTING * WAIT = IMPORTING return = ret. MESSAGE 'Material Agregado' type 'S'.

Como visualizar el dato agregado. Entrar a la transaccion VK13

You might also like