Difference between revisions of "SAP SD FAQ"
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Autorización grabar variante en Transacción VF05 == | == Autorización grabar variante en Transacción VF05 == | ||
− | + | Para que un usuario pueda grabar una variante, el parámetro de usuario SD_VARIANT_MAINTAIN, tiene que tener el valor ‘A’, los valores posibles son: | |
− | |||
− | |||
SD_VARIANT_MAINTAIN = ' ' => no variant maintenance allowed | SD_VARIANT_MAINTAIN = ' ' => no variant maintenance allowed | ||
SD_VARIANT_MAINTAIN = 'U' => only user-specific variants can be maintained | SD_VARIANT_MAINTAIN = 'U' => only user-specific variants can be maintained | ||
Line 9: | Line 7: | ||
== ver/actualizar todas las clases de mensaje == | == ver/actualizar todas las clases de mensaje == | ||
− | + | transacción: NACU | |
− | + | ||
− | + | Las clases de mensaje se pueden ver en la tabla T685B TNAPR | |
+ | |||
+ | Programa impresión de mensajes: RSNAST00 , RSNAST0D | ||
==Impresión Entregas== | ==Impresión Entregas== | ||
Line 160: | Line 160: | ||
ENDFORM. " F_FILL_ITEMS_SIM</nowiki> | ENDFORM. " F_FILL_ITEMS_SIM</nowiki> | ||
+ | ==Leer Condiciones de Precio con formato externo== | ||
+ | <nowiki>select * into table lt_vbak from vbak where vbeln = gt_outtab-vbeln. | ||
+ | |||
+ | select * into table lt_vbap from vbap where vbeln = gt_outtab-vbeln. | ||
+ | |||
+ | read TABLE lt_vbak index 1. | ||
+ | loop at lt_vbap. | ||
+ | SELECT * into CORRESPONDING FIELDS OF TABLE lt_komv FROM KONV | ||
+ | WHERE KNUMV = lt_vbak-KNUMV | ||
+ | and kposn = lt_vbap-posnr. | ||
+ | CALL FUNCTION 'MAP_INT_TO_EXT_STRUCTURE' | ||
+ | EXPORTING | ||
+ | I_OPERATION = '05' | ||
+ | TABLES | ||
+ | FXVBAK = lt_vbak | ||
+ | FXKOMV = lt_komv | ||
+ | FXBAPIKOMV = lt_ORDER_CONDITIONS_OUT | ||
+ | EXCEPTIONS | ||
+ | ENTRY_MISSING = 1 | ||
+ | OTHERS = 2. | ||
+ | IF SY-SUBRC <> 0. | ||
+ | ENDIF. | ||
+ | LOOP at lt_ORDER_CONDITIONS_OUT into ls_ORDER_CONDITIONS_OUT where ITM_NUMBER = lt_vbap-posnr | ||
+ | and COND_TYPE = 'Z666'. | ||
+ | add ls_ORDER_CONDITIONS_OUT-cond_value to ld_cond_value. | ||
+ | endloop. | ||
+ | endloop.</nowiki> | ||
+ | |||
+ | ==Cambiar status de objeto== | ||
+ | * ejemplo modificar estado de pedido de venta | ||
+ | |||
+ | data: jostd_i_p like vbak-objnr. | ||
+ | data: stat_e_p like jest-stat. | ||
+ | data: extern_p value 'E'. | ||
+ | select single objnr | ||
+ | into jostd_i_p | ||
+ | from vbak | ||
+ | where vbeln = tp_vbak-vgbel. | ||
+ | if sy-subrc eq 0. | ||
+ | move 'E' to extern_p. | ||
+ | move 'E0005' to stat_e_p. | ||
+ | |||
+ | call function 'STATUS_CHANGE_EXTERN' | ||
+ | exporting | ||
+ | objnr = jostd_i_p | ||
+ | user_status = stat_e_p. | ||
+ | commit work. | ||
+ | endif. | ||
+ | |||
+ | ==Flujo de documentos VBFA== | ||
+ | clase cl_sd_document_flow_rt | ||
+ | <nowiki> | ||
+ | ls_sorders-id = i_vbeln. | ||
+ | ls_sorders-type = if_sd_doc_category=>delivery_shipping_notif. | ||
+ | APPEND ls_sorders TO lt_sorders. | ||
+ | ls_sorders-type = if_sd_doc_category=>delivery. | ||
+ | APPEND ls_sorders TO lt_sorders. | ||
+ | ls_sorders-type = if_sd_doc_category=>returns_delivery_for_order. | ||
+ | APPEND ls_sorders TO lt_sorders. | ||
+ | |||
+ | DATA(lo_docflow_rt) = NEW cl_sd_document_flow_rt( ). | ||
+ | |||
+ | CALL METHOD lo_docflow_rt->get_successors | ||
+ | EXPORTING | ||
+ | it_document = lt_sorders | ||
+ | it_successor_type = lt_vbtyp_rg_goods | ||
+ | iv_path_length = 1 | ||
+ | IMPORTING | ||
+ | et_document = lt_successors. | ||
+ | |||
+ | SELECT * FROM vbfa INTO CORRESPONDING FIELDS OF "#EC CI_NOFIELD | ||
+ | TABLE lt_vbfa | ||
+ | FOR ALL ENTRIES IN lt_successors | ||
+ | WHERE | ||
+ | vbelv = i_vbeln AND | ||
+ | vbeln = lt_successors-successor_id AND | ||
+ | vbtyp_v IN lt_vbtyp_rg AND | ||
+ | vbtyp_n = if_sd_doc_category=>goods_movement AND | ||
+ | posnn NE '000000' AND | ||
+ | bwart NE space. | ||
+ | </nowiki> | ||
+ | |||
+ | funcion SD_DOCUMENT_FLOW_GET | ||
+ | <nowiki> | ||
+ | * Fetch document flow | ||
+ | CALL FUNCTION 'SD_DOCUMENT_FLOW_GET' | ||
+ | EXPORTING | ||
+ | iv_docnum = lv_docnum | ||
+ | iv_self_if_empty = charx | ||
+ | IMPORTING | ||
+ | et_docflow = lt_docflow. | ||
+ | |||
+ | * buscar pedido de factura | ||
+ | LOOP AT lt_docflow INTO DATA(wa) WHERE vbtyp_n = if_sd_doc_category=>order "'C' | ||
+ | OR vbtyp_n = if_sd_doc_category=>purchase_order. "'V' | ||
+ | EXIT. | ||
+ | ENDLOOP. | ||
+ | IF sy-subrc = 0. | ||
+ | ta_docs-vbeln_pe = wa-docnum. | ||
+ | ENDIF. | ||
+ | |||
+ | * buscar tipo de factura | ||
+ | LOOP AT lt_docflow INTO wa WHERE hlevel = 0 AND docnum = l_docnum. | ||
+ | EXIT. | ||
+ | ENDLOOP. | ||
+ | IF sy-subrc = 0. | ||
+ | ta_docs-vbtyp = wa-vbtyp_n. | ||
+ | ENDIF. | ||
+ | </nowiki> | ||
[[Category:SD]] | [[Category:SD]] |
Latest revision as of 18:02, 9 March 2023
Contents
Autorización grabar variante en Transacción VF05
Para que un usuario pueda grabar una variante, el parámetro de usuario SD_VARIANT_MAINTAIN, tiene que tener el valor ‘A’, los valores posibles son:
SD_VARIANT_MAINTAIN = ' ' => no variant maintenance allowed SD_VARIANT_MAINTAIN = 'U' => only user-specific variants can be maintained SD_VARIANT_MAINTAIN = 'X' => only standard variants can be maintained SD_VARIANT_MAINTAIN = 'A' => both standard variants and user-specific variants may be maintained
ver/actualizar todas las clases de mensaje
transacción: NACU
Las clases de mensaje se pueden ver en la tabla T685B TNAPR
Programa impresión de mensajes: RSNAST00 , RSNAST0D
Impresión Entregas
- Smartform entrega: LE_SHP_DELNOTE
- Programa impresion Entregas (Smartforms): RLE_DELNOTE
- BADI datos adicionales impresion Entrega: BADI_DLV_PRTDATA
Impresión Facturas
- Actualizar clases de mensaje factura: transacción V/40
- Programa de Impresión de facturas vía SMARTFORM: ver programa RLB_INVOICE
- Smartform Factura: LB_BIL_INVOICE
- Programa de Impresión de facturas vía Adobe forms: ver programa SD_BIL_PRINT01, adobe form SD_INVOICE_FORM01 (tran. SFP)
- Función de obtención de datos para impresión: LB_BIL_INV_OUTP_READ_PRTDATA, esta posee la badi BADI_INV_PRTDATA para adjuntar/modificar datos de la factura, si se desea agregar datos de la factura se debe ampliar la estructura LBBIL_INVOICE.
- Para agregar textos de factura utilizar Texto include como:
Nombre de texto &IS_BIL_INVOICE-HD_GEN-BIL_NUMBER& Objeto de texto VBBK ID del texto Z999 Idioma &CONTROL_PARAMETERS-LANGU&
Factura Cuotas
Para calcular el valor de la cuota es necesario llamar a function BILLING_SCHEDULE_CREATE_T052S y alimentar con los siguientes valores a los Parámetros p.import
ZTERM: VBRK-ZTERM WERT: (suma de todas las posiciones XVBRP-KZWI2) – (suma de todas las posiciones del valor absoluto XVBRP -KZWI1), WAERK: CLP FKDAT: VBKD-FKDAT SKFBT: 0,00 VALTG: 00 VALDT: (vacío) I_COMPANY_CODE: VBRK-BUKRS
Nota: Para obtener el número total de cuotas (XX) filtrar la tabla VBKD por VBELN y traer el campo ZTERM, con este valor filtrar la tabla T052S y listar la tabla por orden ascendente del campo RATNR y trae el último valor.
En la tabla ZFPLT se muestra el valor de las cuotas en el campo ZFPLT -FAKWR .
Se aprecia que todos los registros de ZFPLT -FAKWR son iguales menos el último, por lo cual estos corresponderian a las (XX-1) cuotas y la última a la cuota que falta.
Al ejecutar la función en la tabla ZFPLT si aprece más de 2 registros y si es que estos registros tienen la misma fecha liquidación (ZFPLT-NFDAT) se debe sumar los registros del campo “Valor a Fact.” (ZFPLT-FAKWR).
types: begin of ty_sim_pos, CUOTA_NRO type RATNR, MONTO_CUOTA type KZWI1, WAERK type WAERK, end of ty_sim_pos. types ty_t_sim_pos. type table of ty_sim_pos. data gt_sim_pos type ty_t_sim_pos. READ TABLE gt_xvbkd INTO g_xvbkd WITH KEY vbeln = g_vbdka-vbeln posnr = c_initial. "'000000'" SELECT ratnr ratpz ratzt FROM t052s INTO TABLE gt_t052s WHERE zterm = g_vbdka-zterm. *MONTO_VENTA.MONTO_ABONO. LOOP AT gt_xvbap INTO ls_xvbap. ADD ls_xvbap-kzwi2 TO g_monto_venta. g_monto_abono = g_monto_abono + ABS( ls_xvbap-kzwi1 ). ENDLOOP. *MONTO_CREDITO. g_monto_credito = g_monto_venta - g_monto_abono. *WAERK. READ TABLE gt_xvbap INTO ls_xvbap INDEX 1. IF sy-subrc = 0. g_waerk = ls_xvbap-waerk. ENDIF. * Calculo de Cuotas DATA: lt_zfplt TYPE STANDARD TABLE OF fpltvb, lt_zfplt_aux TYPE STANDARD TABLE OF fpltvb, ls_zfplt TYPE fpltvb, ls_zfplt_aux TYPE fpltvb, ls_sim_pos TYPE ty_sim_pos. REFRESH: pt_sim_pos. CALL FUNCTION 'BILLING_SCHEDULE_CREATE_T052S' EXPORTING zterm = g_vbdka-zterm wert = g_monto_cred waerk = c_waerk "CLP" fkdat = g_xvbkd-fkdat skfbt = c_skfbt "0.00" valtg = c_valtg "00" valdt = c_valdt "space" i_company_code = g_vbdka-bukrs_vf TABLES zfplt = lt_zfplt EXCEPTIONS no_entry_t052s = 1 no_zfbdt = 2 no_entry_t052 = 3 no_billing_schedule = 4 no_entry_in_t001r_found = 5 OTHERS = 6. IF sy-subrc NE 0 AND sy-subrc NE 4. PERFORM protocol_update. retcode = 1. EXIT. ENDIF. IF g_vbdka-zterm = c_as01 OR g_vbdka-zterm = c_ts01. lt_zfplt_aux[] = lt_zfplt[]. REFRESH lt_zfplt. LOOP AT lt_zfplt_aux INTO ls_zfplt_aux. CLEAR ls_zfplt. la_zfplt-nfdat = ls_zfplt_aux-nfdat. ls_zfplt-fakwr = ls_zfplt_aux-fakwr. COLLECT ls_zfplt INTO lt_zfplt. ENDLOOP. ENDIF. LOOP AT lt_zfplt INTO ls_zfplt. AT NEW fakwr. IF sy-tabix NE 1. ls_sim_pos-cuota_nro = sy-tabix - c_1. APPEND ls_sim_pos TO gt_sim_pos. ENDIF. ENDAT. ls_sim_pos-monto_cuota = ls_zfplt-fakwr. ls_sim_pos-waerk = g_waerk. AT LAST. *CUOTA_NRO. IF gt_sim_pos IS NOT INITIAL. ls_sim_pos-cuota_nro = c_1. ELSE. ls_sim_pos-cuota_nro = sy-tabix. ENDIF. **MONTO_CUOTA. * ls_sim_pos-monto_cuota = ls_zfplt-fakwr. **WAERK. * ls_sim_pos-waerk = g_waerk. APPEND ls_sim_pos TO gt_sim_pos. ENDAT. ENDLOOP. ENDFORM. " F_FILL_ITEMS_SIM
Leer Condiciones de Precio con formato externo
select * into table lt_vbak from vbak where vbeln = gt_outtab-vbeln. select * into table lt_vbap from vbap where vbeln = gt_outtab-vbeln. read TABLE lt_vbak index 1. loop at lt_vbap. SELECT * into CORRESPONDING FIELDS OF TABLE lt_komv FROM KONV WHERE KNUMV = lt_vbak-KNUMV and kposn = lt_vbap-posnr. CALL FUNCTION 'MAP_INT_TO_EXT_STRUCTURE' EXPORTING I_OPERATION = '05' TABLES FXVBAK = lt_vbak FXKOMV = lt_komv FXBAPIKOMV = lt_ORDER_CONDITIONS_OUT EXCEPTIONS ENTRY_MISSING = 1 OTHERS = 2. IF SY-SUBRC <> 0. ENDIF. LOOP at lt_ORDER_CONDITIONS_OUT into ls_ORDER_CONDITIONS_OUT where ITM_NUMBER = lt_vbap-posnr and COND_TYPE = 'Z666'. add ls_ORDER_CONDITIONS_OUT-cond_value to ld_cond_value. endloop. endloop.
Cambiar status de objeto
- ejemplo modificar estado de pedido de venta
data: jostd_i_p like vbak-objnr. data: stat_e_p like jest-stat. data: extern_p value 'E'. select single objnr into jostd_i_p from vbak where vbeln = tp_vbak-vgbel. if sy-subrc eq 0. move 'E' to extern_p. move 'E0005' to stat_e_p.
call function 'STATUS_CHANGE_EXTERN' exporting objnr = jostd_i_p user_status = stat_e_p. commit work. endif.
Flujo de documentos VBFA
clase cl_sd_document_flow_rt
ls_sorders-id = i_vbeln. ls_sorders-type = if_sd_doc_category=>delivery_shipping_notif. APPEND ls_sorders TO lt_sorders. ls_sorders-type = if_sd_doc_category=>delivery. APPEND ls_sorders TO lt_sorders. ls_sorders-type = if_sd_doc_category=>returns_delivery_for_order. APPEND ls_sorders TO lt_sorders. DATA(lo_docflow_rt) = NEW cl_sd_document_flow_rt( ). CALL METHOD lo_docflow_rt->get_successors EXPORTING it_document = lt_sorders it_successor_type = lt_vbtyp_rg_goods iv_path_length = 1 IMPORTING et_document = lt_successors. SELECT * FROM vbfa INTO CORRESPONDING FIELDS OF "#EC CI_NOFIELD TABLE lt_vbfa FOR ALL ENTRIES IN lt_successors WHERE vbelv = i_vbeln AND vbeln = lt_successors-successor_id AND vbtyp_v IN lt_vbtyp_rg AND vbtyp_n = if_sd_doc_category=>goods_movement AND posnn NE '000000' AND bwart NE space.
funcion SD_DOCUMENT_FLOW_GET
* Fetch document flow CALL FUNCTION 'SD_DOCUMENT_FLOW_GET' EXPORTING iv_docnum = lv_docnum iv_self_if_empty = charx IMPORTING et_docflow = lt_docflow. * buscar pedido de factura LOOP AT lt_docflow INTO DATA(wa) WHERE vbtyp_n = if_sd_doc_category=>order "'C' OR vbtyp_n = if_sd_doc_category=>purchase_order. "'V' EXIT. ENDLOOP. IF sy-subrc = 0. ta_docs-vbeln_pe = wa-docnum. ENDIF. * buscar tipo de factura LOOP AT lt_docflow INTO wa WHERE hlevel = 0 AND docnum = l_docnum. EXIT. ENDLOOP. IF sy-subrc = 0. ta_docs-vbtyp = wa-vbtyp_n. ENDIF.