bg

Modus ponendo ponens

SAP SUM stuck in MAIN_NEWBAS/XPRAS_AIMMRG

Another day another play….. at this moment i’m making an update to SAP ERP 6.0 SPS 22 but during downtime in step 5.6 (execution) phase MAIN_NEWBAS/XPRAS_AIMMRG receive a series of errors that in no way to proceed with SUM, the errors are type:

XPRA ERRORS and RETURN CODE in SAPR702XPRA90000008.DG1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 ETP109 version and release : "380.05.19" "738"
1 ETP198
2 EPU126XPost-import methods for change/transport request: "SAPK702XPRA90000008"
4 EPU111    on the application server: "dg1"
2 EPU122XPost-import method "/BOBF/CONF_CTS_AFTER_IMPORT" started for "BOBF" "L", date and time: "20130305043445"
1AETR012XProgram terminated (job: "RDDEXECL", no.: "04344400")
1AEPU320 See job log"RDDEXECL""04344400""DG1"
1 ETP111 exit code           : "12"

As always, the times are short and after defeat another problems during weekend and are very close to goal this can’t be happen, I’m scrub, i think!

Search in forums, Google, sap notes and nothing, ok, i’m really scrub, next and paining step, send message to SAP support, during the process for create a new message SAP first “ask you” if you have revised notes and playing with SAP Knowledge Base i found the note 1664235 (Investigating errors in XPRAS phase) and after read and follow the “resolution”, new errors are displayed, now and are a lot of dumps, all with common error:

The following syntax error occurred in program

"CL_SHM_AREA===================CP " in include

"CL_SHM_AREA===================CM00V " in

line 1:

"The kernel module "AB_SHMKMPROPAGATEAREA" is not registered for the im"
"plementation of method "_PROPAGATE_AREA" of class "CL_SHM_AREA"."

OK, let’s find a solution…… ok there is neither in Google or SAP notes but the word “kernel” shines for me, let’s make a try, KERNEL DOWNGRADE!!!!

My instance have the last version in branch 7.x (7.38), i downloaded the kernel 7.20 (i consider it more stable than others), decompress, copy  and “startsap r3” ….

Instance on host dg1 started, test a SAPlogon connection, all ok

Click in button next on SUM…. after a few minutes, SUM
continues its.

Now i’m making the last backup and after finish this post i will try to sleep a little.

Making a db2 user for SAP database with read-only permissions (*nix)

One more time i need make “magic” for solve request from last minute, in this occasion the requirement it’s a user for db2 with read-only permissions, the problem with db2 is the need of explicit GRANT permission for each table in database, SAP have 92000+ and i’m not a db2 expert.

The solution comes with some clicks in Google and a bash script line (don’t judge it’s ugly like all my bash code).

  1. Add user in OS: # useradd -g db<dbsid>adm -s /bin/bash db2read
  2. Add password for the new user: # passwd db2read
  3. Login with administrative user for db2, in SAP regularly it’s db2<db2sid>
  4. Connect the user to db2: $ db2 connect to <DBSID>
  5. Grant connect privileges to new db2 user: $ db2 grant connect on database to user db2read
  6. Extract all tables of SAP schema to a file and make the “grant queries”: $ db2 -x “select ‘grant select on table ’ || tabschema || ‘. ’ || tabname || ’ to user db2read’ from syscat.tables where tabschema = ‘SAP<DBSID>’” > grantselect
  7. Read query by query  the file generated and execute: $ COUNT=0 ; while read grant; do TEXT=$(echo $grant | awk ‘{print $7}’); TEXT2=${grant/$TEXT/\”$TEXT\”} ; db2 -x $TEXT2 ; (( COUNT++ )); echo $COUNT $TEXT ; done < grantselect ;
  8. Go for a coffee and other and other and other…. if you want know how many lines (queries) are to be executed check with $ wc -l grantselect

If you know a better way to do it, please say me!!!!

Subir y leer documentos en servidor *nix con SAP

En algunas ocasiones sobre todo en lo referente a algunos desarrollos Z requeriremos utilizar layouts que se encuentren en el servidor (esta guia aplica solo para servidores tipo unix) de la instancia SAP para poder realizar cargas masivas en proceso de fondo.

Regularmente se le pediría a un BASIS el estar subiendo estos archivos al servidor y bajando los archivos generados por el desarrollo Z sin embargo en ocasiones es engorroso estar esperando que otras personas finalicen y soliciten estos movimientos, por lo que realice este pequeño manual para que cualquier usuario/funcional pueda subir sus layouts al servidor sin utilizar ninguna otra herramienta mas que el SAPgui y posteriormente acceda a lo generado por el desarrollo Z si así fuera el caso.

SUBIR ARCHIVOS

  1. Ingresar a la transacción SE37
  2. En el campo modulo de funciones escribir la función ARCHIVFILE_CLIENT_TO_SERVER y presionar F8.

    image

  3. En la siguiente pantalla deberán seleccionar la casilla Mayúsculas/Minúsculas en el campo PATH colocar la ruta completa del layout en el sistema local, por ejemplo, C:\layouts\layout01.txt y en TARGETPATH colocar la ruta /usr/sap/tmp/<mas el nombre del archivo>, por ejemplo, /usr/sap/tmp/layout01.txt, cuando se vaya a realizar la carga en el programa ABAP esta sera la ruta a utilizar para el layout. Nota: se debe escribir siempre en minusculas /usr/sap/tmp.image

  4. Presionamos Permitir a la pregunta que nos hace el sistema.

  5. Deberá presentarse una pantalla como la de a continuación y con esto daríamos por finalizada la carga del layout (no debe indicar ningún error).image

LEER ARCHIVOS GENERADOS EN EL SERVIDOR POR EL PROGRAMA ABAP


Dependiendo del desarrollo en ocasiones estos generaran archivos con resultados de la carga masiva en el mismo directorio donde se coloco el layout, para ver el contenido de estos archivos realizamos lo siguiente:

  1. Ingresar a la transacción AL11.
  2. Buscar la linea que dice DIR_PREF en la columna “Nombre parámetro directorio” y hacer doble clic.
  3. Buscar el archivo deseado en la columna File Name y hacer doble clic.

Little script for simple db2 database backup with progress bar.

Hello again from somewhere,

 since a few months ago I have had to interact a lot with db2 for laboral reasons.  Personally after “touch” db2 I think it’s quite “pretty” the interaction with it. But a partner complains that she can’t know the amount of progress without use the command db2 list utilities show detail, and their use may be uncomfortable for non-shell user.

After this little history i wrote an ugly bash script for this purpose (make simple backups and see the amount of progress with the plus of a progress bar :p)

#!/usr/bin/bash # progbardb2.sh 
# Ugly bash script for make simple db2 backups and see the amount of progress with a progress bar
# Author: Ruben Espadas (me [at] respadas [dot] net)
# Idea of progress bar taken from ksaver script
# License: BSD # April 30, 2012

DB=""
DBPATH=""
ENDSTR=""
PERCENT=0
BAR=""
PROMPT=">"
LAST=0

if [ $# -lt 2 ] || ([ $# -lt 3 ] && ([ "$1" == "-c" ] || [ "$1" == "--compress" ]))
then
echo "Usage: $0 [OPTION] DATABASE PATH"
echo " -c, --compress compress backup"
exit
fi

if [ "$1" == "-c" ] || [ "$1" == "--compress" ]
then
DB=$2
DBPATH=$3
ENDSTR="compress"
else
DB=$1
DBPATH=$2
fi

if [ -w $DBPATH ]
then
DBINST=$(db2 list database directory | grep $DB | grep name | awk '{print $4}')
if [ "$DB" != "$DBINST" ]
then
echo "Database not found"
exit
fi
else
echo "I can't write in $DBPATH, check the user, owners dir and permissions"
exit
fi

function progr_bar()
{
STARTDB=$(db2 backup database $DB to $DBPATH $ENDSTR)&
STARTDB=$(echo $STARTDB | awk '{print $8}')
if [ "$STARTDB" == "SQLSTATE=57019" ]
then
echo "The database is currently in use, try again after turn off systems."
exit
fi

write_percent

while [ $PERCENT -lt 100 ]
do
PERCENT=$(db2 list utilities show detail | grep Percentage | awk '{print $5}')
if [ -z $PERCENT ] || [ $PERCENT -eq 0 ]
then
let PERCENT=0
elif [ $LAST -ne $PERCENT ]
then
write_percent
LAST=$PERCENT
fi
done
echo -e " Respaldo finalizado.\n"
}

function write_percent()
{
echo -ne "\r\t[ "
echo -ne "$BAR$PROMPT ] $PERCENT% "
BAR="${BAR}="
}

progr_bar

Eviux thanks for your complaints to the shell xD

Resume WTF

Resume WTF

BAPI_PR_CREATE

Si se requiere utilizar la BAPI_PR_CREATE (recomendada por SAP para suplir la BAPI_REQUISITION_CREATE a partir de SAP R/3 Release 4.70) para la creación de requisiciones de servicios se debe activar una función de negocio para el correcto uso de las imputaciones de lo contrario recibiremos el error “En caso de imputación, registre los datos de imputación para la posición” (In case of account assignment, please enter acc. assignment data for item) o E436

  •     Ingresamos a la transacción SFW5
  •     Activamos FICAX
  •     Activamos ENTERPRISE_BUSINESS_FUNCTIONS > LOG_MM_CI_2
  •     Guardamos activamos cambios y listo.

La implementación de la BAPI es sencilla sin embargo cualquier duda me pueden contactar.

Catalyst Framework en Debian Squeeze

Sencillamente.

aptitude install libcatalyst-devel-perl libcatalyst-perl libcatalyst-modules-perl

Enjoy and happy hacking!

Dios no tiene todas las respuestas

Dios no tiene todas las respuestas

Validar si documento de venta esta bloqueado por otro usuario con ABAP en SAP-SD

En ocasiones para cargas masivas o call transactions se requiere validar que otro usuario no este utilizando un documento de ventas, esto con el fin de evitar errores en el procesamiento. Esta validacion se puede realizar fácilmente con dos funciones SD_SALES_DOCUMENT_ENQUEUE y DEQUEUE_EVVBAKE como se puede observar en el siguiente ejemplo:

CALL FUNCTION ‘SD_SALES_DOCUMENT_ENQUEUE’ “ REVISAMOS QUE EL DOCUMENTO DE 

VENTAS NO SE ENCUENTRE BLOQUEADO INTENTANDO BLOQUEARLO
        EXPORTING
          VBELN          = <DOCUMENTO_DE_VENTA>
        EXCEPTIONS
          FOREIGN_LOCK   = 1
          SYSTEM_FAILURE = 2
          NO_CHANGE      = 3
          OTHERS         4.
      IF SY-SUBRC <> 0. “ SI ESTA BLOQUEADO LEVANTAMOS UNA BANDERA PARA USO FUTURO
        F_ENQUEUE = ‘X’.
        ELSE. “ SI NO ESTA BLOQUEADO LIBERAMOS EL DOC. DE LA FUNCIÓN ANTERIOR
          CALL FUNCTION ‘DEQUEUE_EVVBAKE’
           EXPORTING
             VBELN           =
<DOCUMENTO_DE_VENTA>
             .
      ENDIF.

Saludos.

Rasurar los pedos

Mucha gente me cataloga de “mamon”, “pedante”, “engreido”, “vale madres”, “pelana” y n cantidad mas de adjetivos, pero gracias al @byteStriker les traigo esta parábola:

Está un señor frente al espejo con la cara llena de espuma de afeitar, su esposa entra al baño y le dice: ¡Óyeme cabrón, la criada está panzona!; el marido responde tranquilamente: “Es su pedo ¿no?”; la esposa replica: “sí, pero no mames, dice que el bebé es tuyo”; el marido dice “Es mi pedo ¿no?”; la esposa al borde de la histeria le reprocha: “¡Sí cabrón, pero no mames, Yo soy tu esposa”. El marido concluye su conversación diciéndole: “Pues ese es tu pedo ¿no?”