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

BAPI_QPGR_REPLICATE



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Interfaces | Интерфейсы -> BAPI
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Sat May 10, 2008 8:26 pm    Post subject: BAPI_QPGR_REPLICATE Reply with quote

BAPI_QPGR_REPLICATE - Prepare QM code group for distribution

Code:
TYPES:BEGIN OF ty_src,
  cat_type LIKE bapiqpgr_qpgr-cat_type,
  code_group LIKE bapiqpgr_qpgr-code_group,
  short_text LIKE bapiqpgr_qpgt-short_text,
  code LIKE bapiqpgr_qpcd-code,
  st LIKE bapiqpgr_qpct-short_text,
END OF ty_src.

DATA int_src TYPE TABLE OF ty_src.
DATA wa_src TYPE ty_src.
DATA: ws_filename TYPE string.
DATA: gt_bapiqpgr_qpgr TYPE bapiqpgr_qpgr OCCURS 0 WITH HEADER LINE,
      gt_bapiqpgr_qpgt TYPE bapiqpgr_qpgt OCCURS 0 WITH HEADER LINE,
      gt_bapiqpgr_qpcd TYPE bapiqpgr_qpcd OCCURS 0 WITH HEADER LINE,
      gt_bapiqpgr_qpct TYPE bapiqpgr_qpct OCCURS 0 WITH HEADER LINE,
      gt_bapiret2 TYPE bapiret2 OCCURS 0 WITH HEADER LINE.

CONSTANTS:
  lit_fty(10) TYPE c VALUE 'ASC',
  lit_sep(1) TYPE c VALUE 'X'.

SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.
PARAMETERS: p_fn LIKE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK a1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_fn.
  PERFORM get_filename USING 'P_FN'
  CHANGING p_fn.

START-OF-SELECTION.

  PERFORM upload_file.

  LOOP AT int_src INTO wa_src.

    CLEAR:gt_bapiqpgr_qpgr,gt_bapiqpgr_qpgt.
    CLEAR:gt_bapiqpgr_qpcd,gt_bapiqpgr_qpct.

    gt_bapiqpgr_qpgr-function = '004'.
    gt_bapiqpgr_qpgr-cat_type = wa_src-cat_type.
    gt_bapiqpgr_qpgr-code_group = wa_src-code_group.
    gt_bapiqpgr_qpgr-status = '2'.
    APPEND gt_bapiqpgr_qpgr.

    gt_bapiqpgr_qpgt-langu = 'EN'.
    gt_bapiqpgr_qpgt-short_text = wa_src-short_text.
    APPEND gt_bapiqpgr_qpgt.

    gt_bapiqpgr_qpcd-code = wa_src-code.
    APPEND gt_bapiqpgr_qpcd.

    gt_bapiqpgr_qpct-code = wa_src-code.
    gt_bapiqpgr_qpct-langu = 'EN'.
    gt_bapiqpgr_qpct-short_text = wa_src-st.
    APPEND gt_bapiqpgr_qpct.

    CALL FUNCTION 'BAPI_QPGR_SAVEREPLICA'
      EXPORTING
        i_code_group          = gt_bapiqpgr_qpgr
      TABLES
        code_grp_shorttexttab = gt_bapiqpgr_qpgt
        codes_of_code_grp     = gt_bapiqpgr_qpcd
        code_shorttexttab     = gt_bapiqpgr_qpct
        return                = gt_bapiret2.

    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
      IMPORTING
        return = gt_bapiret2.
  ENDLOOP.

*&--------------------------------------------------------------------
*& Form upload_file
*&--------------------------------------------------------------------
FORM upload_file .
  ws_filename = p_fn.

*Upload input file content
  CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
      filename                = ws_filename
      filetype                = lit_fty
      has_field_separator     = lit_sep
    TABLES
      data_tab                = int_src
    EXCEPTIONS
      file_open_error         = 1
      file_read_error         = 2
      no_batch                = 3
      gui_refuse_filetransfer = 4
      invalid_type            = 5
      no_authority            = 6
      unknown_error           = 7
      bad_data_format         = 8
      header_not_allowed      = 9
      separator_not_allowed   = 10
      header_too_long         = 11
      unknown_dp_error        = 12
      access_denied           = 13
      dp_out_of_memory        = 14
      disk_full               = 15
      dp_timeout              = 16
      OTHERS                  = 17.

ENDFORM. " upload_file

*&--------------------------------------------------------------------
*& Form get_filename
*&--------------------------------------------------------------------
FORM get_filename USING value(p_file)
CHANGING p_fn.
  CALL FUNCTION 'F4_FILENAME'
    EXPORTING
      field_name = p_file
    IMPORTING
      file_name  = p_fn.
ENDFORM. " get_filename
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> Interfaces | Интерфейсы -> BAPI 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.