sapdev logo background
sapdev logo sapdev logo
Comments

SAP TEM course attendees




The ABAP code below is an extract that shows how to check if an attendee of a business Event is an external person or an internal person(someone who is on your SAP payrole system). This code is based on looping around your selected Business events. This can be done by setting the logical database to PCH in the abap program(Menu path Goto->Attributes) and using the GET OBJEC event or by selecting the details yourself into and internal table and then looping around this!

TABLES: objec.
tables: pa0001, pa0002, hrp1000, hrp1034, hrp1001.

INFOTYPES: 1001 NAME i1001 MODE n.
INFOTYPES: 1001 NAME note1001 OCCURS 0.
INFOTYPES: 1001 NAME partic_1001 OCCURS 0.
INFOTYPES: 1026 NAME i1026 MODE n.
DATA: w_d_begda LIKE sy-datum,
      w_d_endda LIKE sy-datum,
      w_d_event like hrp1001-sobid.
types: BEGIN OF participant.
        INCLUDE STRUCTURE hrvpartic.
types: END OF participant.
data: it_participant type standard table of participant,
      wa_participant type participant.
  DATA: l_vornm LIKE q1000-vornm,
        l_nachn LIKE q1000-nachn,
        l_subrc type sy-subrc,
        l_title type t522t-atext,
        l_addr type hrp1028-cname.

* If you are using this you need to ensure you have set the logical database to PCH in
* the abap program. Menu path Goto->Attributes. Also need to ensure you select type
* 'E' from the selection screen
GET objec.

*LOOP Around your Business Events ( object type 'E')
  SELECT SINGLE sobid begda endda FROM hrp1001 INTO (w_d_event, w_d_begda, w_d_endda) WHERE plvar EQ objec-plvar
                            AND otype EQ objec-otype
                            AND objid EQ objec-objid
                            AND relat EQ '020'
                            AND rsign EQ 'A'
                            AND sclas EQ 'D'.
  IF sy-subrc EQ 0.
    SELECT * FROM hrp1001 WHERE plvar EQ objec-plvar
                          AND otype EQ 'D'
                          AND objid EQ w_d_event
                          AND relat EQ '034'
                          AND rsign EQ 'A'
                          AND begda EQ w_d_begda
                          AND endda EQ w_d_endda.

    CASE hrp1001-sclas.
     WHEN 'H'.
      SELECT SINGLE * FROM hrp1000 WHERE objid EQ hrp1001-sobid
                                   AND plvar EQ objec-plvar
                                   AND otype EQ 'H'
                                   AND begda LE sy-datum
                                   AND endda GE sy-datum.

      CALL FUNCTION 'RH_NAME_INIT'
       EXPORTING
         in_short = hrp1000-short
         in_stext = hrp1000-stext
       IMPORTING
         in_vornm = l_vornm  "Initials
         in_nachn = l_nachn  "Surname
         in_subrc = l_subrc.


      SELECT SINGLE * FROM hrp1034 WHERE objid EQ hrp1001-sobid
                                       AND plvar EQ objec-plvar
                                       AND otype EQ 'H'
                                       AND begda LE sy-datum
                                       AND endda GE sy-datum.

      SELECT SINGLE atext FROM t522t INTO l_title
                          WHERE sprsl EQ 'EN'
                          AND anred EQ hrp1034-anred.

      SELECT SINGLE cname FROM hrp1028  INTO l_addr
                                       WHERE objid EQ hrp1001-sobid
                                         AND plvar EQ objec-plvar
                                         AND otype EQ 'H'
                                         AND begda LE sy-datum
                                         AND endda GE sy-datum.

     WHEN 'P'.
*      Get details from usual HR PA... tables i.e. PA0002, PA0001
    ENDCASE.
    ENDSELECT.
  ENDIF.

*ENDLOOP.



comments powered by Disqus