SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Как по номеру документа узначь, чем его просматривать



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
stn
Участник
Участник



Joined: 18 Jan 2008
Posts: 31

PostPosted: Fri Mar 26, 2010 2:34 pm    Post subject: Как по номеру документа узначь, чем его просматривать Reply with quote

Здравствуйте!
Есть ли какая функция, чтобы по номеру документа узнать, какой транзакцией его просматривать (фин. док - MB03, документ закупки - me23n, и т.д.)? Это нужно для перехода из ALV GRID.
Back to top
View user's profile Send private message
Удав
Гуру
Гуру


Age: 48
Joined: 25 Jan 2008
Posts: 580
Location: Москва

PostPosted: Fri Mar 26, 2010 4:48 pm    Post subject: Reply with quote

нет.

ЗЫ: Финансовый документ просматривается транзакцией FB03, документ материала - MIGO или MB03

_________________
С уважением,
Удав.
Back to top
View user's profile Send private message
vga
Мастер
Мастер


Age: 90
Joined: 04 Oct 2007
Posts: 1218
Location: Санкт-Петербург

PostPosted: Fri Mar 26, 2010 4:54 pm    Post subject: Reply with quote

По номеру весьма проблематично.
Но зная тип документа (а его достать как правило легко), компани код и год, для большинства документов можно воспользоваться такой функцией.

Code:
FUNCTION ze_document_sender.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  IMPORTING
*"     VALUE(I_AWTYP) LIKE  ACCHD-AWTYP
*"     VALUE(I_AWREF) LIKE  ACCHD-AWREF
*"     VALUE(I_AWORG) LIKE  ACCHD-AWORG DEFAULT SPACE
*"     VALUE(I_AWSYS) LIKE  ACCHD-AWSYS DEFAULT SPACE
*"     VALUE(I_BUKRS) LIKE  ACCIT-BUKRS DEFAULT SPACE
*"----------------------------------------------------------------------

  DATA: l_ttyp TYPE ttyp.

  CHECK NOT i_awtyp IS INITIAL.
  SELECT SINGLE * FROM ttyp INTO l_ttyp
    WHERE awtyp = i_awtyp.

  CHECK sy-subrc IS INITIAL.
  CHECK NOT l_ttyp-function IS INITIAL.
  CALL FUNCTION l_ttyp-function
    EXPORTING
      i_awtyp = i_awtyp
      i_awref = i_awref
      i_aworg = i_aworg
      i_awsys = i_awsys
      i_bukrs = i_bukrs.

ENDFUNCTION.

Code:
*&------------------------------------------------------------------*
*&      Form  user_command
*&------------------------------------------------------------------*
*       Called on user_command ALV event.
*       Executes custom commands.
*-------------------------------------------------------------------*
FORM user_command USING r_ucomm     LIKE sy-ucomm
                        rs_selfield TYPE slis_selfield.

  DATA: ls_output TYPE styp_output.

  CASE r_ucomm.
    WHEN '&IC1'.
*dbl. click processing

*get selected item
      READ TABLE it_output INDEX rs_selfield-tabindex INTO ls_output.
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.

      CASE rs_selfield-fieldname.
        WHEN 'DOCNR'.
          SET PARAMETER ID 'BUK' FIELD p_bukrs.
          SET PARAMETER ID 'GDN' FIELD ls_output-docnr.
          SET PARAMETER ID 'GLN' FIELD 'R1'.
          SET PARAMETER ID 'GJR' FIELD p_year.
          CALL TRANSACTION 'GD23' AND SKIP FIRST SCREEN.
        WHEN 'REFDOCNR'.
          DATA: l_awtyp TYPE acchd-awtyp,
                l_awref TYPE acchd-awref,
                l_aworg TYPE acchd-aworg.

          IF ls_output-awtyp EQ 'BKPF' OR
             ls_output-awtyp EQ 'IBKPF' OR
             ls_output-awtyp EQ 'BKPFF' OR
             ls_output-awtyp EQ 'GLAL0'.
            l_aworg = p_bukrs.
          ENDIF.
          CONCATENATE l_aworg p_year INTO l_aworg.

          l_awtyp = ls_output-awtyp.
          l_awref = ls_output-refdocnr.

          CALL FUNCTION 'ZE_DOCUMENT_SENDER'
            EXPORTING
              i_awtyp = l_awtyp
              i_awref = l_awref
              i_aworg = l_aworg
              i_bukrs = p_bukrs.
      ENDCASE.
*do nothing
  ENDCASE.

ENDFORM.                    "user_command

_________________
Молитва - это запрос разработчику на изменение кода программы.
Back to top
View user's profile Send private message Blog Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.