Archivo
Grisar campo de pantalla en MIGO (Lote, Clasificación)
Caso: se busca que en la MIGO, para cuando se realiza una salida de mercancías (A07) y para unos materiales en particular, que se grise el campo LOTE y el botón CLASIFICACIÓN, así el usuario no puede modificar el dato que viene por defecto (ya que estaba configurado que si había varios lotes para el mismo material, que realice la salida de material desde el lote más antiguo).
El botón «Clasificación» se oculta porque al presionarlo asigna un nuevo número de lote.
Solución: Tenemos que ir al programa LMIGOSMC, crear una ampliación en ENHANCEMENT-SECTION LMIGOSMC_02 SPOTS ES_SAPLMIGO agregando el siguiente código:
* INI Lote grisado para materiales ZMEV
if screen-name = ‘GOITEM-CHARG’ or screen-name = ‘GODYNPRO-CHARG’
or screen-name = ‘GOITEM-BWTAR’ or screen-name = ‘GODYNPRO-BWTAR’
or screen-name = ‘OK_BATCH_CLASS’. » Oculto además el Botón Clasificación
check GODYNPRO-ACTION = ‘A07’ and goitem is not initial and GOITEM-MATNR(2) = ‘EV’.
ls_fs-work = c_visible.
ENDIF.
* FIN Lote grisado para materiales ZMEV
—
Es decir, debería quedar así:
—-
ENHANCEMENT-SECTION LMIGOSMC_02 SPOTS ES_SAPLMIGO.
IF ls_fs-type = ‘C’ AND
( sy-dynnr = ‘0200’ OR sy-dynnr = ‘1000’ ).
* Read the COLS table of the table control to check
* whether this element is a column or not (remember: there
* are buttons in screen 0200, too).
CASE sy-dynnr.
WHEN ‘0200’.
READ TABLE tv_goitem-cols INTO ls_column
WITH KEY screen-name = screen-name
TRANSPORTING invisible
index.
WHEN ‘1000’.
READ TABLE tv_gosplit-cols INTO ls_column
WITH KEY screen-name = screen-name
TRANSPORTING invisible
index.
ENDCASE.
* GLC = 0 : Disabling columns
IF i_global_counter IS INITIAL.
* Check for SY-SUBRC is necessary as there are data in field-
* selections which are possibly columns in the TC, but not
* currently implemented (accounting fields). For these, the
* MIGO fieldselection is used as a transporter for FS-information.
IF sy-subrc = 0.
* Columns disabled by administrator: INVISIBLE = X. Do not touch!
* Columns disabled by us: INVISIBLE = 1. Jupedidu!
CHECK ls_column-invisible <> x.
ls_column-invisible = c_mod_off.
IF ls_fs-work = c_invisible.
ls_column-invisible = c_mod_on.
ENDIF.
CASE sy-dynnr.
WHEN ‘0200’.
MODIFY tv_goitem-cols FROM ls_column
INDEX sy-tabix
TRANSPORTING invisible.
WHEN ‘1000’.
MODIFY tv_gosplit-cols FROM ls_column
INDEX sy-tabix
TRANSPORTING invisible.
ENDCASE.
* Do not execute normal screen modification!!!
CONTINUE.
ENDIF.
ELSE.
* GLC > 0: Item modification in TV. Check that column
* is visible. Necessary to prevent the field itself to
* be set INVISIBLE (No fields transport. Deadly!)
CHECK ls_column-invisible = c_mod_off.
ENDIF.
ENDIF.
END-ENHANCEMENT-SECTION.
ENHANCEMENT 1 ZMM_LMIGOSMC_02. «active version
IF ls_fs-type = ‘C’ AND
( sy-dynnr = ‘0200’ OR sy-dynnr = ‘1000’ ).
* Read the COLS table of the table control to check
* whether this element is a column or not (remember: there
* are buttons in screen 0200, too).
CASE sy-dynnr.
WHEN ‘0200’.
READ TABLE tv_goitem-cols INTO ls_column
WITH KEY screen-name = screen-name
TRANSPORTING invisible
index.
WHEN ‘1000’.
READ TABLE tv_gosplit-cols INTO ls_column
WITH KEY screen-name = screen-name
TRANSPORTING invisible
index.
ENDCASE.
* GLC = 0 : Disabling columns
IF i_global_counter IS INITIAL.
* Check for SY-SUBRC is necessary as there are data in field-
* selections which are possibly columns in the TC, but not
* currently implemented (accounting fields). For these, the
* MIGO fieldselection is used as a transporter for FS-information.
IF sy-subrc = 0.
* Columns disabled by administrator: INVISIBLE = X. Do not touch!
* Columns disabled by us: INVISIBLE = 1. Jupedidu!
CHECK ls_column-invisible <> x.
ls_column-invisible = c_mod_off.
IF ls_fs-work = c_invisible.
ls_column-invisible = c_mod_on.
ENDIF.
CASE sy-dynnr.
WHEN ‘0200’.
MODIFY tv_goitem-cols FROM ls_column
INDEX sy-tabix
TRANSPORTING invisible.
WHEN ‘1000’.
MODIFY tv_gosplit-cols FROM ls_column
INDEX sy-tabix
TRANSPORTING invisible.
ENDCASE.
* Do not execute normal screen modification!!!
CONTINUE.
ENDIF.
ELSE.
* GLC > 0: Item modification in TV. Check that column
* is visible. Necessary to prevent the field itself to
* be set INVISIBLE (No fields transport. Deadly!)
CHECK ls_column-invisible = c_mod_off.
ENDIF.
ENDIF.
* INI Lote grisado para materiales ZMEV
if screen-name = ‘GOITEM-CHARG’ or screen-name = ‘GODYNPRO-CHARG’
or screen-name = ‘GOITEM-BWTAR’ or screen-name = ‘GODYNPRO-BWTAR’
or screen-name = ‘OK_BATCH_CLASS’. » Oculto además el Botón Clasificación
check GODYNPRO-ACTION = ‘A07’ and goitem is not initial and GOITEM-MATNR(2) = ‘EV’.
ls_fs-work = c_visible.
ENDIF.
* FIN Lote grisado para materiales ZMEV
ENDENHANCEMENT.
*$*$-End: LMIGOSMC_02
Campos grisados en la oferta / documento de venta. Como hacerlos editables
Campos grisados en la oferta / documento de venta. Como hacerlos editables
Caso: Cuando un documento de ventas se factura totalmente, las posiciones de cantidades de pedido (campo VBAP-KWMENG) quedan grisadas y está bien, ya que fue completada la operación. En mi caso tengo ofertas, las cuales pueden tener varias facturas asociadas y hay veces en que aunque se haya completado la operación, se dan cuenta que se va a realizar otra venta y el usuario no quiere crear otra oferta nueva sino agregar cantidades a la existente para poder facturarla con referencia a ella.
Por lo tanto se busca dejar editable el campo “cantidad de pedido” para que se puedan agregar más cantidades de pedido y luego generar más ventas con respecto a la misma oferta. Lo haremos buscando una EXIT, la .
1. Ingresamos al modulpool SAPMV45A (de bruto que lo hago por la SE38) y buscamos el include MV45AFZZ y allí el FORM USEREXIT_FIELD_MODIFICATION.
*———————————————————————*
* FORM USEREXIT_FIELD_MODIFICATION *
*———————————————————————*
* This userexit can be used to modify the attributes of *
* screen fields. *
* This form is processed for each field in the screen. *
* *
* The use of the fields screen-group1 to screen-group4 is: *
* *
* Screen-group1: Automatic modification contolles by transaction*
* MFAW. *
* Screen-group2: Contents ‘LOO’ for steploop-fields. *
* Screen-group3: Used for modififaction, which are dependent on *
* control tables or other fix information. *
* Screen-group4: Unused *
* *
* For field mofifications, which are dependent on the document *
* status, you can use the status field in the workareas *
* XVBAP for item status and XVBUK for header status. *
* *
* This form is called from module FELDAUSWAHL. *
* *
*———————————————————————*
FORM USEREXIT_FIELD_MODIFICATION.
**
* Acá va el código
**
ENDFORM.
2. En ese form, ingresamos el código fuente necesario para desgrisar los campos que necesitamos, en mi caso es el KWMENG.
* Desgrisar el campo “Cantidad Pedido” sólo cuando quiere modificar una oferta
if sy-tcode = ‘VA22’ and
screen-name = ‘RV45A-KWMENG’ OR » Order quantity
screen-name = ‘VBEP-WMENG’ OR » Order qty in Schedule Lines
screen-name = ‘RV45A-KMPMG’. » Order quantity in «Structure» tab
SCREEN-INPUT = 1.
endif.
3. Va a pedir una orden, transportamos y lo probamos.
Link: http://scn.sap.com/thread/1706967
[end]
Agregar campo VKGRP en FBL5N
Escenario: se busca agregar el campo Grupo de vendedores (KNVV-VKGRP) como columna en la transacción FBL5N ya que existe la posibilidad de filtrar por este campo pero no lo trae en pantalla.
Las BTE son muy parecidas a las exits. Están configuradas para que salten en un momento determinado, de manera que en ese momento es posible incluir el código que necesitemos utilizando un módulo de función específico.
La transacción para acceder al menú de las BTE es la FIBF. Por lo tanto:
- Ingresar a la transacción FIBF
- Ir al menú Opciones-Productos-de un cliente
- Crear una entrada, por ejemplo “ZFIVKGRP”, indicar una descripción y tildarlo como activo.
- Ahora seleccionar el evento que se ejecutará al ingresar a la FBL5N. Para ello, volver a la pantalla de la FIBF e ir al menú Opciones-Módulos P/S-de un cliente.
- Agregar a la lista el producto recién creado, indicando el evento, en Ps el código de país y el módulo de funciones correspondiente. Para ver como crear un módulo de funciones (se debe hacer una copia de uno estándar), ir a: http://www.saptechnical.com/Tutorials/Others/BTE/Page1.htm.
Para el caso es una copia del SAMPLE_INTERFACE_00001650 al que previamente llamé “” y el evento es el 00001650 – VISUALIZACIÓN PI: Completar datos por posición)
Nota: Al pie agrego como hacerlo, en el apéndice.
- Ahora, en la FBL5N debo agregar la/s columna/s que necesito (Grupo de vendedores y descripción), para ello debo agregar a la estructura RFPOS y RFPOSX una estructura con estos dos nuevos campos. En el ejemplo de las pantallas en mi caso ya aparecía agregado el campo NAME1 en la estructura “ZADICIONALES_FBLXN”, por lo que me ahorré un paso.
- image0031
- image0041
- Ejecutar el programa RFPOSXEXTEND para ajustar los cambios en las estructuras.
- image0051
- image0061
- image0071
Apéndice:
Para copiar el modulo de funciones a partir de un estándar.
- Ir a Entorno-Sistema Info(P/S). Traer todos los registros.
- Buscar el 00001650 – VISUALIZACIÓN PI: Completar datos por posición. Hacer doble click.
- Presionar el botón “Módulo funciones tipo”.
- Realizar una copia del módulo actual a otro Z. Para ello presione “Copiar”, elija el nombre y un grupo de funciones (debe ser previamente creado).
- Editar el nuevo módulo de funciones y agregar el código necesario.
function z_vkgrp_interface_00001650. *"---------------------------------------------------------------------- *"*"Interfase local *" IMPORTING *" VALUE(I_POSTAB) LIKE RFPOS STRUCTURE RFPOS *" EXPORTING *" VALUE(E_POSTAB) LIKE RFPOS STRUCTURE RFPOS *"---------------------------------------------------------------------- *-------------- Initialize Output by using the following line ---------- tables: knvv. "Customer Master Sales Data data: l_vkgrp type knvv-vkgrp, l_bezei type tvgrt-bezei. clear: l_vkgrp, l_bezei. e_postab = i_postab. * Obtengo el grupo de vendedores select single vkgrp into l_vkgrp from knvv where kunnr eq e_postab-konto. * Obtengo la descripción del grupo de vendedores select single bezei into l_bezei from tvgrt where vkgrp eq l_vkgrp and spras eq sy-langu. e_postab-zzvkgrp = l_vkgrp. e_postab-zzbezei = l_bezei. i_postab = e_postab. endfunction.
Para más información sobre añadir campos en los informes de partidas, mirad las notas OSS 569939, 217189, 112312, 429382. Y los siguientes links!
http://www.saptechnical.com/Tutorials/ExitsBADIs/BTE/Page1.htm
http://www.saptechnical.com/Tutorials/ExitsBADIs/BTE/Page2.htm
http://www.saptechnical.com/Tutorials/Others/BTE/Page1.htm
Actualizar campo BSEG-SGTXT en FBL5N
Transacción: FBL5N, SE38
Caso: Actualizar el campo BSEG-SGTXT para visualizar un texto en la FBL5N
Ejemplo: en mi caso tenía que crear un EXIT al grabar una factura y actualizar con un dato el campo SGTXT.
Busqué y vi que hacer un UPDATE a la BSEG a mano no servía, tampoco haciendo un UPDATE a la BSEG y BSIS; estas funciones las probé y funcionan.
****** Adicionado para reporte FBL5N - Se agrega el Nro. Legal de factura en documento contable, modificándolo. lc_sgtxt = xvbrk-xblnr. * Obtengo el documento contable call function 'FI_DOCUMENT_READ1' exporting i_docno = le_bkpf-belnr " Documento contable de la factura i_byear = le_bkpf-gjahr " Ejercicio i_compy = le_bkpf-bukrs " Sociedad importing e_bkpf = e_bkpf tables t_bseg = t_bseg t_bsec = t_bsec t_bset = t_bset. loop at t_bseg where buzei = '001'. * Con read table me da error. Actualizo el texto en la posición 001 t_bseg-sgtxt = lc_sgtxt. modify t_bseg. exit. endloop. append e_bkpf to t_bkpf. if not t_bseg[] is initial. call function 'CHANGE_DOCUMENT' tables t_bkdf = t_bkdf t_bkpf = t_bkpf t_bsec = t_bsec t_bsed = t_bsed t_bseg = t_bseg t_bset = t_bset. endif. clear : t_bseg,t_bkpf,t_bsec,t_bsed,t_bset. refresh : t_bseg,t_bkpf,t_bsec,t_bsed,t_bset.
En el caso planteado, tenía que dejar grabado el Nro. legal de factura de EXPO, vemos que ahora aparece (campo texto),
por ejemplo el 0006E00000179:
Haciendo doble click:
Links de interés:
http://forums.sdn.sap.com/thread.jspa?threadID=254178
https://forums.sdn.sap.com/thread.jspa?messageID=2423899&tstart=0#2423899
https://forums.sdn.sap.com/thread.jspa?messageID=2480155&tstart=0#2480155