가끔 팝업창 이벤트 확인을 위해 디버깅을 해보고 싶을때가 있다.


그럴땐 이 방법을 써보자

[FUNCTION] 
Command=/H 
Title=Debugger 
Type=SystemCommand


1. 위 소스를 txt파일로 만든다.
2. 해당파일을 드래그해서 팝업창에 드랍해보자.
3. 디버깅모드로 변경된다..^^


출처: http://itpe.me/118

Posted by KindKay
,

Time 시간 더하기

SAP/ABAP 2013. 8. 12. 12:55

Time 시간 더하기


                 datalv_starttime type t,
              lv_startdate type d,
              lv_addtime   type t,
              lv_endtime   type t,
              lv_enddate   type d.

        clearlv_starttimelv_startdate,
               lv_addtime,   lv_endtimelv_enddate .

        lv_starttime gt_itab-pitime.
        lv_startdate gt_itab-pidate.
        lv_addtime   10.

        call function 'C14B_ADD_TIME'
          exporting
            i_starttime       lv_starttime
            i_startdate       lv_startdate
            i_addtime         lv_addtime
          importing
            e_endtime         lv_endtime
            e_enddate         lv_enddate.

        submit rsxmb_select_messages with exedate  eq lv_startdate
                                     with exetime  eq lv_starttime
                                     with exe2date eq lv_enddate
                                     with exe2time eq lv_endtime
                                     and return.



Posted by KindKay
,

    CALL FUNCTION 'READ_TEXT'

      EXPORTING
        CLIENT                  = (Client ID)
        ID                      = (Text ID)
        LANGUAGE                = (Language)
        NAME                    = (PO Number)
        OBJECT                  = 'EKKO' for Header & EKPO for Item
      TABLES
        LINES                   = (Internal Table of type tlines)
      EXCEPTIONS
        ID                      = 1
        LANGUAGE                = 2
        NAME                    = 3
        NOT_FOUND               = 4
        OBJECT                  = 5
        REFERENCE_CHECK         = 6
        WRONG_ACCESS_TO_ARCHIVE = 7
        OTHERS                  = 8.
 
 
If you read directly from the table then for getting HEADER TEXT it is is STXH & item text STXL.
 
Better would be to use Function Module READ_TEXT
 
    CALL FUNCTION 'READ_TEXT'
      EXPORTING
        CLIENT                  = (Client ID)
        ID                      = (Text ID)
        LANGUAGE                = (Language)
        NAME                    = (PO Number)
        OBJECT                  = 'EKKO' for Header & EKPO for Item
      TABLES
        LINES                   = (Internal Table of type tlines)
      EXCEPTIONS
        ID                      = 1
        LANGUAGE                = 2
        NAME                    = 3
        NOT_FOUND               = 4
        OBJECT                  = 5
        REFERENCE_CHECK         = 6
        WRONG_ACCESS_TO_ARCHIVE = 7
        OTHERS                  = 8.


출처: http://scn.sap.com/thread/1537830


Posted by KindKay
,

CALL FUNCTION 'BAPI_CURRENCY_CONV_TO_EXTERNAL'
EXPORTING
CURRENCY = 'YTL'
AMOUNT_INTERNAL = IT_FINAL_DATA-NETPR
IMPORTING
AMOUNT_EXTERNAL = IT_FINAL_DATA-NETPR1



출처: http://scn.sap.com/thread/654299

Posted by KindKay
,

FI_document_read_single

SAP/ABAP 2013. 7. 5. 08:50

Have you tried with this,

FI_DOCUMENT_READ1,

FI_DOCUMENT_READ



출처: http://scn.sap.com/thread/1268147

Posted by KindKay
,

SOAP channel exception


- 체크 Abap Source or Data




The error is purely data related. Please try to debug the ABAP funtion module or program with the values what you are passing from SAP PI .



'SAP > ABAP' 카테고리의 다른 글

Table to read PO Header text and item text  (0) 2013.07.19
BAPI_CURRENCY_CONV_TO_EXTERNAL  (0) 2013.07.05
FI_document_read_single  (0) 2013.07.05
SMW0 양식 다운로드  (0) 2013.05.14
download data into excel using fm  (0) 2013.05.08
Posted by KindKay
,

SMW0 양식 다운로드

SAP/ABAP 2013. 5. 14. 17:56

Code listing for: YRTEST00012
Description: 양식 다운로드
*&---------------------------------------------------------------------*
*& Report  YRTEST00012
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

report  yrtest00012 message-id z00mmm.

  include yrtest00012_top.
  include yrtest00012_sel.
  include yrtest00012_f01.


*----------------------------------------------------------------------*
initialization.
*----------------------------------------------------------------------*
  p_fname = 'C:\Upload\MaterialMaster_ROH.xls'.

  concatenate icon_xls '양식다운로드'
         into sscrfields-functxt_01.



*----------------------------------------------------------------------*
at selection-screen.
*----------------------------------------------------------------------*
  case sscrfields-ucomm.
    when 'FC01'.
      perform pop_up using '양식을 다운로드 하시겠습니까?'
                           '양식다운로드 확인'.
      check g_answer eq 'J'.

      perform download_excel_file using p_fname
                                        sy-cprog
                               changing g_rtncod.
  endcase.


*Selection texts
*----------------------------------------------------------
* P_FNAME D       .


*Messages
*----------------------------------------------------------
*
* Message class: Z00MMM
*015   등록된 Excel양식이 없습니다.
*016   & 으로 저장되었습니다.
*020   자료를 OPEN 하였는지 확인하세요.

Extracted by Direct Download Enterprise version 1.3.1 - E.G.Mellodew. 1998-2005 UK. Sap Release 701


Code listing for: YRTEST00012_TOP
Description: Include YRTEST00012_TOP
*&---------------------------------------------------------------------*
*&  Include           YRTEST00012_TOP
*&---------------------------------------------------------------------*

  type-pools: icon.

  tables: sscrfields.

  data: g_answer,
        g_rtncod.

Extracted by Direct Download Enterprise version 1.3.1 - E.G.Mellodew. 1998-2005 UK. Sap Release 701



Code listing for: YRTEST00012_SEL
Description: Include YRTEST00012_SEL
*&---------------------------------------------------------------------*
*&  Include           YRTEST00012_SEL
*&---------------------------------------------------------------------*

  selection-screen: function key 1.

  selection-screen begin of block b1 with frame title text-001.

    parameters: p_fname like rlgrap-filename default 'C:\' obligatory.

  selection-screen end of block b1.

Extracted by Direct Download Enterprise version 1.3.1 - E.G.Mellodew. 1998-2005 UK. Sap Release 701



Code listing for: YRTEST00012_F01
Description: Include YRTEST00012_F01
*&---------------------------------------------------------------------*
*&  Include           YRTEST00012_F01
*&---------------------------------------------------------------------*

*&---------------------------------------------------------------------*
*&      Form  pop_up
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
form pop_up  using  p_1 p_2.

  clear: g_answer.

  call function 'POPUP_TO_CONFIRM_STEP'
    exporting
      textline1      = p_1
      titel          = p_2
      cancel_display = ''
    importing
      answer         = g_answer.

endform.                    " pop_up



*&---------------------------------------------------------------------*
*&      Form  DOWNLOAD_EXCEL_FILE
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
form download_excel_file using p_file
                               p_cprog
                      changing p_rtncod.

  data: lv_dfname       like  rlgrap-filename,
        lv_objid        like  wwwdata-objid,
        lv_fname        like  rlgrap-filename,
        lv_tail         type  string,
        ls_wwwdatatab   like  wwwdatatab,
        lv_subrc        type  i.

  clear : lv_fname, ls_wwwdatatab, lv_subrc.
  p_rtncod = 'E'.

  lv_dfname = p_file. "file name.

  lv_objid = 'Z00MMC001_UPD'.

* Pc 파일 삭제
  call function 'WS_FILE_DELETE'
    exporting
        file  = lv_dfname
    importing
      return = lv_subrc.

  if  lv_subrc <> 0   and   lv_subrc <> 1.
    message s020  display like 'E'.
    exit.
  endif.

  select single  *
    into corresponding fields of ls_wwwdatatab
    from wwwdata                 " WWW 오브젝트 저장에 대한 INDX-유형 테이블
   where objid = lv_objid.       " SAP WWW 게이트웨이 오브젝트 이름

  if sy-subrc ne 0.
    message s015 display like 'E'.
    exit.
  endif.

* Web 템플레이트(Excel Form) 다운로드
  call function 'DOWNLOAD_WEB_OBJECT'
    exporting
      key         = ls_wwwdatatab
      destination = lv_dfname.

  clear : lv_fname, lv_tail.
  split  lv_dfname  at  ' '  into  lv_fname  lv_tail.

  if  lv_dfname <> lv_fname.
    message  s016  with  lv_dfname.
  else.
*   Download 파일명에 공백이 없는 경우 Excel 실행
    call function 'WS_EXECUTE'
      exporting
        commandline = lv_dfname
        program     = 'EXCEL.EXE'.
    message  s016  with  lv_dfname.
  endif.

  clear: p_rtncod.
endform.                    " DOWNLOAD_EXCEL_FILE

Extracted by Direct Download Enterprise version 1.3.1 - E.G.Mellodew. 1998-2005 UK. Sap Release 701
Posted by KindKay
,

code for download data into excel .


TYPE-POOLS: truxs.


 TABLES: zregtab.


Parameters: p_file TYPE rlgrap-filename default 'C:\test.xls'.


TYPES: BEGIN OF ty_regtab,
        empid         LIKE zregtab-empid,
        empname       LIKE zregtab-empname,
        technology    LIKE zregtab-technology,
        desgination   LIKE zregtab-desgination,
        mobile        LIKE zregtab-mobile,
        boardingpoint LIKE zregtab-boardingpoint,
        END OF ty_regtab.


DATA:  itab1    TYPE truxs_t_text_data.


 DATA:  itab    TYPE ty_regtab OCCURS 0.


SELECT empid
        empname
        technology
        desgination
        mobile
        boardingpoint
        FROM zregtab
        INTO TABLE itab.


CALL FUNCTION 'SAP_CONVERT_TO_XLS_FORMAT'
   EXPORTING
 *   I_FIELD_SEPERATOR          = ';'
 *   I_LINE_HEADER              =
     I_FILENAME                 = p_file
 *   I_APPL_KEEP                = ' '
   TABLES
     I_TAB_SAP_DATA             = itab
 CHANGING
    I_TAB_CONVERTED_DATA       = itab1.



출처: http://wiki.sdn.sap.com/wiki/display/Snippets/download+data+into+excel+using+fm

Posted by KindKay
,