Validacion/substitucion BSEG-VBUND FI

Colapsar
Este tema está cerrado
X
X
 
  • Tiempo
  • Mostrar
Limpiar Todo
nuevos mensajes
  • Nachraziel
    Junior Member
    • feb
    • 25

    #1

    Validacion/substitucion BSEG-VBUND FI

    Buenos dias,
    Me gustaría saber como puedo realizar una sustitucion del campo BSEG-VBUND en la transaccion FB01 según el valor de BSEG-HKONT.
    He estado leyendo muchas cosas pero no me entero bien de como se puede hacer. Entre en la GGb1 y intente modificar el RGGBR000 pero no he conseguido nada, ahora estoy probando en la RGGBS000. Soy nuevo en esto y no entiendo bien lo que debo hacer para realizar el cambio.
    Si alguien me puede explicar algo o si me puede proporcionar un manual de lo que tengo que hacer se lo agradecería.
    Muchas gracias.
    Editado por última vez por Nachraziel; 31/03/2009, 09:51:28.
  • ongo
    Member
    • ago
    • 45

    #2
    Buenas,

    Si me pasa tu dirección de correo te mando un manual que hice la primera vez que me pidieron una valñidación/sustitución.

    Un saludo.

    Comentario

    • Nachraziel
      Junior Member
      • feb
      • 25

      #3
      Ok, muchas gracias, me lo puedes mandar a isoloaga@gmail.com
      Te lo agradezco mucho, estoy bastante perdido y necesito saber un poco de que va el tema. Gracias!

      Comentario

      • Bmamba
        Member
        • jun
        • 91

        #4
        Originalmente publicado por ongo
        Buenas,

        Si me pasa tu dirección de correo te mando un manual que hice la primera vez que me pidieron una valñidación/sustitución.

        Un saludo.
        Hola ongo, yo también estoy interesada en el manual. Te lo agradecería mucho si me lo puedes mandar a mi correo: mindyourhead@gmail.com.

        Saludos

        Comentario

        • Tonnyman
          Member
          • dic
          • 53

          #5
          Hola,

          Me interesa el manual, podrias hacermelo llegar tambien?

          Gracias.

          Comentario

          • Tonnyman
            Member
            • dic
            • 53

            #6
            Perdona, se me olvidó el correo: tonnytomm@yahoo.com.ar

            Gracias.

            Comentario

            • Nachraziel
              Junior Member
              • feb
              • 25

              #7
              El manual muy bien, la verdad que me sirvio de mucho, ahora tengo otras dudas. Cuando escribo el código en el Uxxx, como se que valores puedo utilizar? que tablas estan definidas? como se los valores que se han introducido en la transaccion FB01 para poder utilizarlos?
              Gracias a todos. Un saludo.

              Comentario

              • ongo
                Member
                • ago
                • 45

                #8
                Buenas,

                Create la sustitución o lo que sea y en la user pon un break point. Asi veras los valores que tengas

                Comentario

                • vickxo
                  Senior Member
                  • nov
                  • 118

                  #9
                  Sustituciones nota 842318

                  Hola, hay una nota en SAP que es la 842318 en donde explica a detalle cuando y pq se deben de usar las validaciones o sustituciones

                  La pego

                  Anexo tambien un par de links que en su momento me ayudaron a implementarlas:





                  chttp://sapprogramming.blogspot.com/2007/01/programming-with-substitution.html



                  26.03.2009 Page 1 of 9
                  SAP Note 842318 - Frequently asked questions about validations +
                  substitutions
                  Note Language: English Version: 11 Validity: Valid Since 10.11.2008
                  Summary
                  Symptom
                  This note deals with frequently asked questions about validation and
                  substitution maintenance.
                  More Terms
                  Cause and Prerequisites
                  Solution
                  I. Creating, activating and transporting validations and substitutions
                  1. Which transactions are required to use validation or substitution
                  functions?
                  GGB0 Validation Maintenance
                  GGB1 Substitution Maintenance
                  GCVZ Rule Maintenance
                  GGB4 Select action for validation/substitution, for example,
                  activation of application areas, message usage or substituted fields
                  GCX2 Definition of Includes for User Exits
                  OB28 Activation of FI validations
                  OBBH Activation of FI substitutions
                  OBBZ Activation of cost of sales accounting substitution (in the
                  FI area)
                  OKC7 Activation of CO validations
                  OKC9 Activation of CO substitutions
                  GCT9 Transport: Validations
                  GCT0 Transport: Substitutions
                  2. What must I take into account when using the formula editor?
                  a) Validation GGB0
                  If you create the first validation for a callup point, for example
                  'Financial ccounting - document header', you must define a message class.
                  This is then valid for ALL validations for this callup point.
                  Not all fields can be used for validations for certain callup points, for
                  example 'Complete document in FI'. This is because there are several rows
                  and it is not clear on which row the check is to be carried out. You can
                  only use numeric fields here. (Note 413956)
                  You should use a user exit if you need more checks on this callup point.
                  26.03.2009 Page 2 of 9
                  SAP Note 842318 - Frequently asked questions about validations +
                  substitutions
                  b) Substitution GGB1
                  If you create a substitution, for example "Financial accounting - document
                  line item", only certain fields are authorized for the substitution. This
                  is because it may lead to problems with the documents or inconsistencies
                  between different applications.
                  It is possible to release more fields for substitution. However, this can
                  be critical, as serious problems can occur as a result.
                  This is why you should regard the following change as a modification (Note
                  170183):
                  The table GB01 contains information about which table fields can or cannot
                  be substituted for which callup point.
                  A field can be substituted if you change the field BEXCLUDE to ' '.
                  For example: 'Complete document' callup point in FI
                  As standard, no field is released for substitution for this callup point.
                  You can see this in the following entries:
                  BOOLCLASS CLASSTYPE BCLTAB BCLFIELD BEXCLUDE
                  015 S BKPF * X
                  015 S BSEG * X
                  BOOLCLASS - Specifies the Boolean class. This is determined in the
                  application area and callup point in each case, for example:
                  008 - Document header (FI)
                  009 - Line item (FI)
                  015 - Complete document (FI)
                  016 - Cost of sales accounting
                  100 - Document header (CO)
                  CLASSTYPE - Specifies if the field can be used for validations (B),
                  substitutions (S) or both (A).
                  BCLTAB - Table that is used
                  BLCFIELD - Field of this table
                  BEXCLUDE - Can be used ' ' or cannot be used 'X'.
                  As mentioned above, you should regard this change as a modification.
                  Problems that occur as a result of this change cannot be handled in
                  'standard' support.
                  3. What must I take into account when activating validations or
                  substitutions?
                  You can activate validations and substitutions in two ways.
                  Activation level: 1 - Active
                  2 - Active, except during 'batch input' processing
                  Because the activation in financial accounting (FI) is company
                  code-specific, you should activate the validations or substitutions in both
                  company codes in the case of cross-company code transactions.
                  4. What must I take into account when transporting validations or
                  substitutions?
                  Usually, only table entries are transported when validations or
                  26.03.2009 Page 3 of 9
                  SAP Note 842318 - Frequently asked questions about validations +
                  substitutions
                  substitutions are transported. The generated source code should not be
                  transported, as this can cause problems. After the import into the target
                  system, the source code is generated automatically when you start the
                  report RGUGBR00 is started.
                  If you want to delete a validation/substitution, and do not want to do this
                  in each system individually, proceed as described in Note 840981.
                  II. Using user exits in validations or substitutions
                  1. Where can I maintain user exits for validations and substitutions?
                  The exits for validations and substitutions are stored in an include of
                  your choice.
                  The following includes are delivered as examples by default:
                  RGGBR000 Val/Sub: Exits for rules
                  RGGBS000 Val/Sub: Exits for substitutions
                  You should copy these into the customer namespace, for example ZGGBR000.
                  The length of the name you choose should not exceed 8 characters. This is
                  because the name is also generated in the source code, and it may exceed a
                  certain line length.
                  You can also create a separate include for each client, which can improve
                  performance.
                  In transaction GCX2, you should then define where your include is used. To
                  do this, enter the name of your include as a FORM pool in the relevant
                  application area.
                  2. How should I create a user exit?
                  Define your user exit in the FORM routine GET_EXIT_TITLES with the correct
                  exit type (EXITS-PARAM). You can use the existing sample entries as a
                  template for this.
                  The exit types required in the FORM routine GET_EXIT_TITLES are organized
                  as follows:
                  o C_EXIT_PARAM_NONE No parameter
                  Apart from the return value (B_TRUE or B_FALSE), you do not need any
                  parameters for the validation. If you do not want to substitute a field,
                  use this parameter in the substitution (select "Only exit").
                  However, you must then use a TABLE statement in the FORM pool (not in the
                  actual form) to identify the relevant structure.
                  o C_EXIT_PARAM_FIELD A Field is transferred as a parameter
                  You only use this type in the substitution. Exactly one field is
                  substituted. Enter user exits of this type in the substitution maintenance
                  instead of assigning a constant value.
                  26.03.2009 Page 4 of 9
                  SAP Note 842318 - Frequently asked questions about validations +
                  substitutions
                  o C_EXIT_PARAM_CLASS A complete type is transferred as a parameter
                  Matrix validations/substitutions ("Only exit"). This exit type can only be
                  used for callup points with complete documents, for example in FI and LC.
                  You cannot use this exit type for any other callup points. The transferred
                  type contains all information about a class. An example is the use of the
                  document header and all corresponding line items in the FI area.
                  In the FORM routine GET_EXIT_TITLES, change the fields NAME and TEXT of the
                  internal table EXITS to the values you want.
                  Use one of the sample routines as a template and copy these to the names
                  you selected. You can now implement the functions you want in this FORM
                  routine.
                  After you have finished creating the user exit, you can use it in your
                  validations or substitutions.
                  3. What must I take into account when implementing the user exit?
                  No dialog boxes, warning messages, information or error messages must be
                  issued in an exit, and a "COMMIT WORK" must not be rejected. This would,
                  for example, interrupt the batch processing or cause problems with the
                  documents to be posted. If you find a serious error in the field contents
                  in the exit, send a termination message (A or X), which will ensure that
                  the transaction is terminated.
                  Do not use any ABAP commands that cause you to leave the exit directly, for
                  example 'LEAVE (TO) SCREEN ...' or 'SUBMIT <REPORT> ...' or 'CALL
                  TRANSACTION ...'
                  In an exit, use only structure fields that belong to the Boolean class of
                  the calling substitution, validation or rule. The other structure fields
                  are not filled or are not filled properly for the callup point of the calls
                  of the substitution, validation or rule.
                  You may make changes to field contents in a substitution exit only if this
                  field can be substituted in the Boolean class. You can display these fields
                  by choosing "Add entry" in the substitution maintenance.
                  In the includes of the substitution exits, you must not use the commands
                  MODIFY, INSERT or DELETE in the internally used structures such as BSEG or
                  BKPF. These structures are interpreted internally as database tables
                  because they are defined by a TABLES statement. As a result, the system
                  writes, deletes or changes database records if you use the commands
                  mentioned above. This can cause serious inconsistencies and
                  problems in the document processing.
                  If you want to change field contents in the exit type C_EXIT_PARAM_CLASS,
                  you should make the changes in the internal table BOOL_DATA (for example
                  BOLL_DATA-BSEG).
                  III. Problem analysis
                  26.03.2009 Page 5 of 9
                  SAP Note 842318 - Frequently asked questions about validations +
                  substitutions
                  1. What must I take into account before I analyze the problem?
                  Before you analyze a problem with validations/substitutions, make sure that
                  the generated source code is up to date. You can use the report RGUGBR00 to
                  do this.
                  Call this report in transaction SE38. You see the following selection
                  screen:
                  Application area ' '
                  Application callup point ' '
                  ' ' Regenerate main program
                  ' ' Generate table file
                  ' ' Generate rules
                  ' ' Generate validations
                  ' ' Generate substitutions
                  ' ' Generate sets
                  ' ' Generate rule use
                  ' ' ' Generate validation use
                  ' ' ' Generate substitution usage
                  ' ' ' Generate substitution export routines
                  ' ' Generate substitution routines in all clients
                  ' ' ' Generate trace program calls
                  Now update the source code for the application area and application callup
                  point in which the validation or substitution was created.
                  To do this, enter the application area, for example FI, and the application
                  callup point (0003/complete document), and set all indicators except for
                  'Generate substitution routine in all clients' and 'Generate trace program
                  calls'. Then execute the report.
                  The source code is now at its current status.
                  2. How can the validation and substitution trace be used?
                  a) Validation trace
                  You created and activated a validation.
                  You can now activate the trace, for example in transaction GGBO. To do
                  this, select the validation and choose 'Extras -> Activate trace'.
                  Example:
                  You created an FI validation for the callup point 'Line item'. To test the
                  validation, call transaction FB01, for example. The trace is displayed as
                  soon as the validation has run. You can now see different things in the
                  trace, for example the values contained in the fields of the various
                  structures. From this, you can see whether additional checks are required,
                  or what the cause of a problem is.
                  b) Substitution trace
                  Activate the trace in the same way as you activate validations.
                  Example:
                  You created a substitution in the same way as you activated the trace for
                  the validation described above. The trace for substitutions has an
                  additional function, in that you can view the field contents before and
                  after the substitution. There, problems can be reproduced in the same way.
                  26.03.2009 Page 6 of 9
                  SAP Note 842318 - Frequently asked questions about validations +
                  substitutions
                  3. How can I use the Debugger to analyze a problem?
                  a) Basic information
                  All includes for validations and substitutions are created in this form:
                  GBTmmaa0.
                  mm stands for the two-digit client key.
                  You can use the function module G_CLIENT_ENCODE to convert a three-digit
                  client (>099) to a two-digit client, for example, client 100 --> AA
                  client 800 --> TQ
                  AA stands for the application area, for example FI --> Financial Accounting
                  CO --> Cost Accounting
                  You will find this abbreviation in the maintenance transaction.
                  Therefore, GBTAAFI0 is the include in client 100 for FI validations and
                  substitutions.
                  b) Structure of the includes and FORM routines for validations and
                  substitutions and tips on how to debug
                  The includes listed above are structured as follows (sample include in FI,
                  Client 800):
                  INCLUDE GBTTQFIA. " Rules
                  INCLUDE GBTTQFIB. " Substitutions
                  INCLUDE GBTTQFIC. " Substitution conditions
                  INCLUDE GBTTQFID. " Validations
                  INCLUDE GBTTQFIE. " Validation conditions
                  INCLUDE GBTTQFIF. " Validation checks
                  INCLUDE GBTTQFII. " Application rules
                  INCLUDE GBTTQFIJ. " Subst. export routines
                  INCLUDE GBTTQFIM. " Trace/simulation
                  INCLUDE GBTTQFIS. " Subst. import routines
                  c) The form routines for validations have the following sample
                  structure (sample validation with the name VAL01):
                  FORM VAL_VAL01.
                  G_BFOUND = B_TRUE.
                  DATA: COND LIKE D_BOOL,
                  CHECK LIKE D_BOOL,
                  NVALSEVEREST LIKE SY-SUBRC VALUE -1.
                  G_STEP = '001'.
                  PERFORM VALCOND_1VAL01##001
                  CHANGING
                  COND.
                  IF COND = B_TRUE .
                  PERFORM VALCHCK_2VAL01##001
                  CHANGING
                  CHECK.
                  IF CHECK = B_FALSE .
                  PERFORM MESSAGE_OUTPUT
                  USING
                  " ...message parameter
                  26.03.2009 Page 7 of 9
                  SAP Note 842318 - Frequently asked questions about validations +
                  substitutions
                  CHANGING
                  NVALSEVEREST.
                  ENDIF.
                  ENDIF.
                  ENDFORM. " VAL_VAL01
                  The statement G_STEP = '001' indicates the step that is executed.
                  The prerequisite of the step is defined in the FORM routine VALCOND_...,
                  and the FORM routine VALCHCK_... checks the validation step.
                  To analyze this step, you should create breakpoints on these two PERFORM
                  statements and also on the code line 'IF CHECK = FALSE'. This allows you to
                  determine whether your prerequisite or the check is causing the problem,
                  for example if a field that is to be checked does not contain the value
                  that you expect.
                  d) The FORM routines for substitutions have the following sample
                  structure (sample substitution with the name SUB01):
                  FORM SUB_SUB01.
                  G_BFOUND = B_TRUE.
                  DATA: COND LIKE D_BOOL.
                  G_CLASSID = '009'.
                  G_SUBST_PERFORMED = B_FALSE.
                  IF G_TAB_FLAG-BSEG <> B_TRUE .
                  PERFORM READ_MASTER_DATA
                  USING
                  'BSEG'
                  G_BFOUND.
                  IF G_BFOUND = B_FALSE .
                  MESSAGE E083 WITH 'BSEG'.
                  ENDIF.
                  ENDIF.
                  G_STEP = '001'.
                  PERFORM SUBCON_3SUB01##001
                  CHANGING
                  COND.
                  IF COND = B_TRUE .
                  BSEG-SGTXT = 'This is a Test'. " Text
                  G_SUBST_PERFORMED = B_TRUE.
                  ENDIF.
                  ENDFORM. " SUB_SUB01
                  As mentioned above for validations, 'G_STEP = '001' indicates the step, and
                  the prerequisite of the substitution is defined in FORM routine SUBCON_....
                  The actual substitution is performed by the statements in the structure IF
                  COND = B_TRUE --> ENDIF. These statements vary depending on the type of
                  substitution created (field allocation, constant value, user exit).
                  In the substitutions, you should also set a breakpoint for the PERFORM on
                  the prerequisite and the statement 'IF COND = B_TRUE'.
                  4. Function modules that call validations and substitutions
                  26.03.2009 Page 8 of 9
                  SAP Note 842318 - Frequently asked questions about validations +
                  substitutions
                  Validations - Function module G_VSR_VALIDATION_CALL
                  The different structures/tables, the name of the validation, callup point
                  and application area are assigned to this function module.
                  Substitutions - Function module G_VSR_SUBSTITUTION_CALL
                  The parameters transferred to validations are also transferred to this
                  function module. However, this function module also returns the structures
                  or tables that contain the changed values.
                  You could set a breakpoint to analyze both function modules. By doing this,
                  you can see which data was transferred, which data the validation or
                  substitution receives, and which values are returned.
                  5. What must I take into account when using the set?
                  When sets are used in validations or substitutions, the system generates
                  source code from the values in the sets.
                  Performance problems can occur if a set is of a certain size, since the
                  generated source code causes longer runtimes.
                  This can also cause a runtime error.
                  To reduce the size of the source code of the sets used, proceed as follows:
                  Use a smaller set in the validation, substitution or rule. To do this,
                  group single values in the set into intervals (for example, instead of the
                  single values 0001, 0002 and 0003, use the interval 0001 - 0003).
                  instead of "<value> IN SET" use the rule "( <value> IN SET1 OR <value> IN
                  SET2 )", where SET1 and SET2 together include the values from SET (for
                  example, subhierarchies at the highest hierarchy level).
                  The simplest way to determine the number of single values or intervals in a
                  set hierarchy is to execute the program RGSEX000.
                  Enter the name of the set and execute the program. All contained sets and
                  values/intervals are listed and the sequence number of the entries is
                  contained in the first column.
                  6. Why does a validation or substitution work in the development system,
                  but not work in another system after a transport?
                  You should make sure that validations and substitutions are activated in
                  the target system. You can also use the report RGUGBR00 to regenerate the
                  source code again.
                  There could be another cause in substitutions:
                  You try to substitute a field that is not released by SAP as standard. To
                  substitute a field, you have adjusted the table GB01 in your development
                  system. However, this table was not adjusted in the target system. The
                  generated source code is correct and the value was changed in the
                  substitution, but the change was not returned to the calling application
                  using the export routines.
                  Header Data
                  26.03.2009 Page 9 of 9
                  SAP Note 842318 - Frequently asked questions about validations +
                  substitutions
                  Release Status: Released for Customer
                  Released on: 10.11.2008 08:19:11
                  Original Lang.: German
                  Priority: Recommendations/additional info
                  Category: FAQ
                  Main Component: FI-SL-VSR Validation, Substitution and Rules
                  Additional Components:
                  MM-IV-LIV Logistics Invoice Verification
                  Valid Releases
                  Software Component Release From
                  Release
                  To Release and
                  Subsequent
                  SAP_APPL 45 45A 45B
                  SAP_APPL 46 46A 46B
                  SAP_APPL 46C 46C 46C
                  SAP_APPL 470 470 470
                  SAP_APPL 500 500 500
                  SAP_APPL 600 600 600
                  Related Notes
                  Number Short Text
                  840981 Cross-system deletion of validations or substitutions
                  413956 Complete document / matrix validation, -substitution
                  170183 What to consider when applying modifications
                  158739 Validation for document parking in FI
                  el tema esta en hacer la pregunta correcta...

                  Comentario

                  • Nachraziel
                    Junior Member
                    • feb
                    • 25

                    #10
                    Muchas gracias a todos por vuestra contribucion, poco a poco me voy enterando de como va.
                    Gracias!

                    Comentario

                    • Nachraziel
                      Junior Member
                      • feb
                      • 25

                      #11
                      Hola de nuevo,
                      Ya me he enterado mas o menos de como va el tema.
                      Ahora tengo otra dudilla, he creado una copia de RGGBS000 llamada ZRGGBS000. Estoy modificando el u100 para modificar el dato VBUND de las sociedades 600000-799999 por el valor de VBUND de las sociedades de 400000-433000.
                      Solo que la user-exit me salta cuando introduzco datos en la transaccion fb01 y le doy al enter.
                      Dentro de la user-exit solo me deja modificar la tabla BSEG de uno de los elementos a la vez. Con lo que no puedo guardar el dato de uno para meterlo en el otro.
                      La pregunta es como puedo tener acceso a la tabla BSEG completa que vamos a introducir en ese documento? Utilizando el debug he comprobado q utiliza la tabla XBSEG, pero no puedo tener acceso a ella desde la user-exit.
                      Alguna sugerencia? no se si me he explicado bien,
                      Muchas gracias

                      Comentario

                      • Nachraziel
                        Junior Member
                        • feb
                        • 25

                        #12
                        Vale, ya comprendi que tenia q hacerlo en el evento 3, de documentos completos.
                        Ahora tengo otro problema, cuando intento crear un paso en el documento completo de FI me sale el siguiente error:

                        "En este momento no puede sustituirse ningún campo"

                        Alguien sabe porque es? o como lo puedo solucionar??

                        Muchas gracias!

                        Comentario

                        • Nachraziel
                          Junior Member
                          • feb
                          • 25

                          #13
                          Ya puede solucionar eso, con lo cual puedo ejecutar las user-exit en el documento completo.
                          Aunque sigo teniendo el problema que solo puedo ver el valor de una posicion de la tabla BSEG, como podria ver el valor de todas las posiciones desde la useer-exit uxxx? si eso es posible claro.
                          Muchas gracias!

                          Comentario

                          • rhein
                            Member
                            • abr
                            • 66

                            #14
                            Por favor me puedes enviar el manual a rhein@esfera.cl

                            muchas gracias
                            RHEIN

                            Comentario

                            • RicardoLeon
                              Member
                              • mar
                              • 85

                              #15
                              Originalmente publicado por Nachraziel
                              Ya puede solucionar eso, con lo cual puedo ejecutar las user-exit en el documento completo.
                              Aunque sigo teniendo el problema que solo puedo ver el valor de una posicion de la tabla BSEG, como podria ver el valor de todas las posiciones desde la useer-exit uxxx? si eso es posible claro.
                              Muchas gracias!

                              Estimado, tengo el mismo problema, Alguien pudo solucionarlo?? Necesito los valores de todas las posiciones en el user exit y solo me muestra la ultima posicion (Estoy en el evento 3).

                              Gracias de antemano, saludos

                              Comentario

                              Trabajando...