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

Shipment <-> Stages <-> Delivery



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



Joined: 19 Nov 2007
Posts: 37

PostPosted: Tue Jul 08, 2008 12:52 pm    Post subject: Shipment <-> Stages <-> Delivery Reply with quote

Коллеги, пожалуйста, если не сложно - подскажите, через какие таблицы можно посмотреть связь транспортировки-этапов-поставок.

В целом суть задачи следующая - делается ТТН по поставке, но если в поставке несколько этапов - надо сделать отдельную ТТН на каждый этап. Для этого надо определить какие поставки принадлежат тому или иному этапу транспортировки. Я когда то занимался подобной задачей, но забыл уже через какие таблицы всё связывал. Пожалуйста, подскажите, просто задача срочная - не хоетлось бы потратить кучу времени только на поиск связки.

Заранее спасибо.
Back to top
View user's profile Send private message Blog
Loyso
Участник
Участник



Joined: 19 Nov 2007
Posts: 37

PostPosted: Tue Jul 08, 2008 1:15 pm    Post subject: Reply with quote

Да нет, не получается так. Мне скорее нужна связь LIPS (LIKP) и VTTS (таблица этапов транспортировки), но вот как их связать - не могу понять
Back to top
View user's profile Send private message Blog
vga
Мастер
Мастер


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

PostPosted: Tue Jul 08, 2008 1:19 pm    Post subject: Reply with quote

Привет, я на днях ковырялся, связь номера PO с поставками lips такая
Code:
  SELECT * INTO TABLE it_ekbe FROM ekbe
      FOR ALL ENTRIES IN it_lips
       WHERE ebeln EQ it_lips-vgbel
           AND ebelp EQ it_lips-vgpos+1
           AND vgabe EQ '1'   "Goods receipt
           AND gjahr IN so_gjahr.


В довесок, что еще нарыл
likp c vttp
Code:
PARAMETERS:
  p_tknum LIKE vttk-tknum

  SELECT SINGLE t1~vbeln INTO it_vbeln FROM likp AS t1
                                   INNER JOIN vttp AS t2
                                  ON t1~vbeln = t2~vbeln
                                WHERE t2~tknum = p_tknum.
 SELECT SINGLE * FROM likp WHERE vbeln = it_vbeln.



VTTS и vttp имеют поле TKNUM в ключе
Back to top
View user's profile Send private message Blog Visit poster's website
Loyso
Участник
Участник



Joined: 19 Nov 2007
Posts: 37

PostPosted: Tue Jul 08, 2008 1:39 pm    Post subject: Reply with quote

Эээээ.... Вот что я надыбал - в таблицах VTTP и VTTS есть поле TPRFO - очередность этапа транспортировки... вот думаю - может по нему связаться? Тогда получаем достаточно четко всё... то есть есть этап транспортировки "первый", к нему есть позиции транспортировки с "первым" этапом - а в этих позициях - поставки...

Как думаете, коллеги - это правильно?
Back to top
View user's profile Send private message Blog
vga
Мастер
Мастер


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

PostPosted: Tue Jul 08, 2008 2:05 pm    Post subject: Reply with quote

Такую смотрел VTSP - Stage in transport per shipment item
??

Quote:
Sales and Distribution (SD) :
VBFA - Document flow (alg.)
VTFA - Flow shipping documents

Sales order :
VBAK - Header data
VBAP - Item data
VBPA - Partners in sales order
VBKD - Sales district data
VBEP - Data related to line items, delivery lines

Billing document :
VBRK - header data
VBRP - Item data

Shipping :
VTTK - Shipment header
VTTP - Shipment item
VTTS - Stage in transport
VTSP - Stage in transport per shipment item
VTPA - Shipment partners
VEKP - Handling Unit - Header Table
VEPO - Packing: Handling Unit Item (Contents)

Delivery :
LIKP - Delivery header
LIPS - Delivery item

Pricing :
KONH - Conditions header
KONP - Conditions items
KONV - Procedure ( billing doc or sales order)
KOND

Contracts :
VEDA - Contract data


Last edited by vga on Tue Jul 08, 2008 2:09 pm; edited 1 time in total
Back to top
View user's profile Send private message Blog Visit poster's website
Loyso
Участник
Участник



Joined: 19 Nov 2007
Posts: 37

PostPosted: Tue Jul 08, 2008 2:07 pm    Post subject: Reply with quote

Вот только сейчас надыбал её через трассировку транзакции...
Она!!!! спасибо Smile
Back to top
View user's profile Send private message Blog
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1640

PostPosted: Fri Jun 08, 2012 5:04 pm    Post subject: Reply with quote

Code:
REPORT z_tree_rob LINE-SIZE 90 NO STANDARD PAGE HEADING.
*----------------------------------------------------------------------*
* R.Andreozzi
*
*----------------------------------------------------------------------*
************************************************************************
************************* Global data **********************************
************************************************************************
TABLES: vttk, vttp, likp, vepo, vekp, zmatch, vbfa.
DATA: length TYPE i VALUE 30. " Length of lis
DATA: BEGIN OF tp OCCURS 10, id, nr(8), text(255), END OF tp.
DATA: txt_report LIKE dokhl-object. "Report name for documentation
DATA: BEGIN OF mylist OCCURS 50. " Internal table hierarchy
        INCLUDE STRUCTURE snodetext.
DATA: END OF mylist.
DATA: BEGIN OF mylisti OCCURS 50. " Internal table hierarchy
        INCLUDE STRUCTURE snodetext.
DATA: END OF mylisti.
DATA: f15 TYPE c.
DATA: seed1 TYPE i, " Rand number seed 1
seed2 TYPE i, " Rand number seed 2
seed3 TYPE i, " Rand number seed 3
width TYPE i. " Width of list
SELECT-OPTIONS: tknum FOR vttk-tknum OBLIGATORY.
DATA: i_vttk TYPE STANDARD TABLE OF vttk WITH HEADER LINE,
i_vepo TYPE STANDARD TABLE OF vepo WITH HEADER LINE,
i_vekp TYPE STANDARD TABLE OF vekp WITH HEADER LINE,
i_vtts TYPE STANDARD TABLE OF vtts WITH HEADER LINE.
DATA: BEGIN OF i_text OCCURS 0,
text(75).
DATA: END OF i_text.
DATA: BEGIN OF i_vttp OCCURS 0,
tknum LIKE vttp-tknum,
vbeln_vl LIKE zmatch-vbeln_vl,
vbeln_gen LIKE zmatch-vbeln_gen,
datum LIKE sy-datum,
uzeit LIKE sy-uzeit,
werks LIKE lips-werks.
DATA: END OF i_vttp.
DATA: BEGIN OF delivery OCCURS 0,
vbeln LIKE likp-vbeln.
DATA: END OF delivery.
DATA: ztext(75).
REFRESH: i_text, delivery.
CLEAR: i_text, ztext, delivery.
************************************************************************
*************************** Main Program *******************************
************************************************************************
START-OF-SELECTION.
  SET PF-STATUS 'LIBS2'.
  READ TEXTPOOL sy-repid INTO tp LANGUAGE sy-langu.
  LOOP AT tp WHERE id = 'R'.
    SET TITLEBAR '001' WITH tp-text.
    EXIT.
  ENDLOOP.
* Fill internal table with pseudo-data
  PERFORM fill_itab.
* Hierarchy output
  PERFORM main.
************************************************************************
*************************** Form Routines ******************************
************************************************************************
*---------------------------------------------------------------------*
* FORM MAIN *
*---------------------------------------------------------------------*
* Main output routine *
*---------------------------------------------------------------------*
FORM main.
  PERFORM header. " output the tree header
  PERFORM hierarchy. " construct & draw the tree
ENDFORM.                    "main
*---------------------------------------------------------------------*
* FORM FILL_ITAB *
*---------------------------------------------------------------------*
* Fills the internal table for hierarchy list *
*---------------------------------------------------------------------*
FORM fill_itab.
  DATA: help TYPE p DECIMALS 1.
  SELECT * FROM vttk INTO TABLE i_vttk WHERE tknum IN tknum.
  SELECT vbeln tknum FROM vttp INTO (i_vttp-vbeln_vl, i_vttp-tknum)
  WHERE tknum IN tknum.
    APPEND i_vttp.
    CLEAR: i_vttp.
  ENDSELECT.
  SELECT * FROM vtts INTO TABLE i_vtts WHERE tknum IN tknum.
  SELECT vbeln_gen tknum FROM zmatch INTO (i_vttp-vbeln_gen,
  i_vttp-tknum) WHERE tknum IN tknum.
    APPEND i_vttp.
    CLEAR: i_vttp.
  ENDSELECT.
  SORT i_vttp BY tknum vbeln_vl vbeln_gen.
  DELETE ADJACENT DUPLICATES FROM i_vttp COMPARING tknum vbeln_vl
  vbeln_gen.
  LOOP AT i_vttp.
    delivery-vbeln = i_vttp-vbeln_vl.
    APPEND delivery.
    delivery-vbeln = i_vttp-vbeln_gen.
    APPEND delivery.
    SELECT SINGLE * FROM vbfa WHERE vbelv = i_vttp-vbeln_vl
    AND vbtyp_n = 'R'
    AND vbtyp_v = 'J'.
    IF sy-subrc = 0.
      SELECT SINGLE werks FROM lips INTO i_vttp-werks WHERE vbeln =
      i_vttp-vbeln_vl
      AND werks <> space.
      i_vttp-datum = vbfa-erdat.
      i_vttp-uzeit = vbfa-erzet.
      MODIFY i_vttp.
    ELSE.
      SELECT SINGLE * FROM vbfa WHERE vbelv = i_vttp-vbeln_gen
      AND vbtyp_n = 'R'
      AND vbtyp_v = '7'.
      IF sy-subrc = 0.
        SELECT SINGLE werks FROM lips INTO i_vttp-werks WHERE vbeln =
        i_vttp-vbeln_gen
        AND werks <> space.
        i_vttp-datum = vbfa-erdat.
        i_vttp-uzeit = vbfa-erzet.
        MODIFY i_vttp.
      ENDIF.
    ENDIF.
  ENDLOOP.
  SORT delivery BY vbeln.
  DELETE ADJACENT DUPLICATES FROM delivery COMPARING vbeln.
  SELECT * FROM vepo INTO TABLE i_vepo FOR ALL ENTRIES IN delivery
  WHERE vbeln = delivery-vbeln
  AND vbeln <> space.
  SORT i_vepo BY venum vbeln.
  DELETE ADJACENT DUPLICATES FROM i_vepo COMPARING venum vbeln.
  SELECT * FROM vekp INTO TABLE i_vekp FOR ALL ENTRIES IN i_vepo
  WHERE venum = i_vepo-venum
  AND venum <> space.
  mylist-name = 'TRASPORTI'.
  mylist-color = 1.
  mylist-intensiv = '1'.
  mylist-text = 'TRASPORTI'.
  mylist-tlength = 16.
  mylist-tlevel = 1.
  mylist-tcolor = 5.
  mylist-tintensiv = '1'.
  mylist-text1 = 'Dati trasporti'.
  mylist-tlength1 = 30.
  mylist-tcolor1 = 0.
  mylist-tintensiv1 = '0'.
  APPEND mylist.
  CLEAR: mylist.
  LOOP AT i_vttk.
    mylist-name = i_vttk-tknum.
    mylist-color = 1.
    mylist-intensiv = '1'.
    mylist-text = i_vttk-tknum.
    mylist-tlength = 16.
    mylist-tlevel = 2.
    mylist-tcolor = 1.
    mylist-tintensiv = '1'.
    mylist-text1 = 'Trasporto'.
    mylist-tlength1 = 30.
    mylist-tcolor1 = 0.
    LOOP AT i_vtts WHERE tknum = i_vttk-tknum.
      CONCATENATE i_vtts-knotz i_vtts-knota INTO ztext SEPARATED
      BY space.
      READ TABLE i_text INDEX 1.
      IF sy-subrc <> 0.
        i_text-text = ztext.
        APPEND i_text.
        CLEAR: ztext.
      ELSE.
        CONCATENATE ztext i_text-text INTO i_text-text SEPARATED BY space.
        MODIFY i_text INDEX sy-tabix.
        CLEAR: ztext.
      ENDIF.
    ENDLOOP.
    READ TABLE i_text INDEX 1.
    IF sy-subrc = 0.
      CONCATENATE 'Tappe:' i_text-text INTO mylist-text2 SEPARATED BY
      space.
      mylist-tlength2 = 75.
      mylist-tintensiv2 = '0'.
    ENDIF.
    LOOP AT i_vttp WHERE tknum = i_vttk-tknum.
      READ TABLE i_vepo WITH KEY vbeln = i_vttp-vbeln_vl.
      IF sy-subrc = 0.
        CONCATENATE '@AD@' 'Trasporto con HU' INTO mylist-text1.
        EXIT.
      ELSE.
        READ TABLE i_vepo WITH KEY vbeln = i_vttp-vbeln_gen.
        IF sy-subrc = 0.
          CONCATENATE '@AD@' 'Trasporto con HU' INTO mylist-text1.
          EXIT.
        ENDIF.
      ENDIF.
    ENDLOOP.
    APPEND mylist.
    CLEAR: mylist, i_text.
    REFRESH: i_text.
    SORT i_vttp BY tknum datum uzeit.
    LOOP AT i_vttp WHERE tknum = i_vttk-tknum.
      IF NOT i_vttp-vbeln_vl IS INITIAL.
        mylist-name = i_vttp-vbeln_vl.
        mylist-color = 2.
        mylist-intensiv = '1'.
        CONCATENATE '@9S@' i_vttp-vbeln_vl INTO mylist-text.
        mylist-tlength = 16.
        mylist-tlevel = 3.
        mylist-tcolor = 2.
        mylist-tintensiv = '1'.
        IF NOT i_vttp-werks IS INITIAL.
          CONCATENATE 'Uscita dal centro' i_vttp-werks INTO mylist-text1
          SEPARATED BY space.
        ENDIF.
        mylist-tlength1 = 30.
        mylist-tcolor1 = 0.
        mylist-tintensiv1 = '0'.
        APPEND mylist.
        CLEAR: mylist.
        LOOP AT i_vepo WHERE vbeln = i_vttp-vbeln_vl.
          LOOP AT i_vekp WHERE venum = i_vepo-venum.
            mylist-name = i_vekp-exidv.
            mylist-color = 3.
            mylist-intensiv = '1'.
            mylist-text = i_vekp-exidv.
            mylist-tlength = 30.
            mylist-tlevel = 4.
            mylist-tcolor = 3.
            mylist-tintensiv = '1'.
            mylist-text1 = 'HU'.
            mylist-tlength1 = 30.
            mylist-tcolor1 = 0.
            mylist-tintensiv1 = '0'.
            APPEND mylist.
            CLEAR: mylist.
          ENDLOOP.
        ENDLOOP.
      ELSEIF NOT i_vttp-vbeln_gen IS INITIAL.
        mylist-name = i_vttp-vbeln_gen.
        mylist-color = 2.
        mylist-intensiv = '1'.
        CONCATENATE '@9T@' i_vttp-vbeln_gen INTO mylist-text.
        mylist-tlength = 16.
        mylist-tlevel = 3.
        mylist-tcolor = 2.
        mylist-tintensiv = '1'.
        IF NOT i_vttp-werks IS INITIAL.
          CONCATENATE 'Entrata nel centro' i_vttp-werks INTO mylist-text1
          SEPARATED BY space.
        ENDIF.
        mylist-tlength1 = 30.
        mylist-tcolor1 = 0.
        mylist-tintensiv1 = '0'.
        APPEND mylist.
        CLEAR: mylist.
        LOOP AT i_vepo WHERE vbeln = i_vttp-vbeln_gen.
          LOOP AT i_vekp WHERE venum = i_vepo-venum.
            mylist-name = i_vekp-exidv.
            mylist-color = 3.
            mylist-intensiv = '1'.
            mylist-text = i_vekp-exidv.
            mylist-tlength = 30.
            mylist-tlevel = 4.
            mylist-tcolor = 3.
            mylist-tintensiv = '1'.
            mylist-text1 = 'HU'.
            mylist-tlength1 = 30.
            mylist-tcolor1 = 0.
            mylist-tintensiv1 = '0'.
            APPEND mylist.
          ENDLOOP.
          CLEAR: mylist.
        ENDLOOP.
      ENDIF.
    ENDLOOP.
  ENDLOOP.
ENDFORM.                    "fill_itab
*---------------------------------------------------------------------*
* FORM HEADER *
*---------------------------------------------------------------------*
* Writes the header of the list *
*---------------------------------------------------------------------*
FORM header.
* FORMAT INTENSIFIED.
* WRITE: /(72) 'Hierachische Liste' CENTERED NO-GAP.
* SKIP.
ENDFORM.                    "header
*---------------------------------------------------------------------*
* FORM HIERARCHY *
*---------------------------------------------------------------------*
* Draws the hierarchy *
*---------------------------------------------------------------------*
FORM hierarchy.
  PERFORM build_tree.
  PERFORM draw_tree.
ENDFORM.                    "hierarchy
*---------------------------------------------------------------------*
* FORM BUILD_TREE *
*---------------------------------------------------------------------*
* Builds the tree from internal table *
* Uses the Function module RS_TREE_CONSTRUCT *
*---------------------------------------------------------------------*
FORM build_tree.
  CALL FUNCTION 'RS_TREE_CONSTRUCT'
   TABLES
     nodetab      = mylist
   EXCEPTIONS
     tree_failure = 1.
* Wenn die WRITEs aktiv sind, kehrt der FBaustein nicht korrekt zurück!
  IF sy-subrc = 1.
* WRITE 'Hierarchie konnte nicht aufgebaut werden'.
  ELSE.
* WRITE 'Hierarchie wurde aufgebaut'.
  ENDIF.
ENDFORM.                    "build_tree
*---------------------------------------------------------------------*
* FORM DRAW_TREE *
*---------------------------------------------------------------------*
* Builds the tree from internal table *
* Uses the Function module RS_TREE_DISPLAY *
*---------------------------------------------------------------------*
FORM draw_tree.
  SET PF-STATUS 'LD_TREE'.
* SET PF-STATUS 'ZSTANDARD4'.
  sy-lsind = 0.
  CALL FUNCTION 'RS_TREE_LIST_DISPLAY'
   EXPORTING
     callback_program      = 'Z_TREE_ROB'
     callback_user_command = 'NODE_SELECT'
   IMPORTING
     f15                   = f15.
ENDFORM.                    "draw_tree
*---------------------------------------------------------------------*
* FORM NODE_SELECT *
*---------------------------------------------------------------------*
* Handles selection of nodes *
*---------------------------------------------------------------------*
FORM node_select TABLES knoten STRUCTURE seucomm
USING command
CHANGING exit
list_refresh.
  DATA: antwort.
* Processing of commands for hierarchy list
  CASE command.
* F2 = Select
    WHEN 'TRSL'.
      CALL FUNCTION 'RS_TREE_GET_CURRENT_NODE'
       IMPORTING
         node_info = mylisti.
      IF mylisti-tlevel = '01'.
        LOOP AT mylist.
          CALL FUNCTION 'RS_TREE_EXPAND'
          EXPORTING
          node_id = mylist-id
          all = 'X'
* LIST_SCROLL =
* DEPTH = 1
          EXCEPTIONS
          not_found = 1
          OTHERS = 2
          .
          IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
        ENDLOOP.
      ELSE.
        CALL FUNCTION 'RS_TREE_EXPAND'
        EXPORTING
        node_id = mylisti-id
        all = 'X'
* LIST_SCROLL =
* DEPTH = 1
        EXCEPTIONS
        not_found = 1
        OTHERS = 2
        .
        IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
**LOOP AT mylist WHERE tlevel = 2.
**
**CONCATENATE '@0A@' 'XXXXXXX' INTO mylist-text1.
**MODIFY mylist.
**
**ENDLOOP.
**
**PERFORM hierarchy.
**
**REFRESH: mylist.
    WHEN 'TRRT'.
      LEAVE PROGRAM.
** WHEN 'ERLE'.
** txt_report = 'ERGP2600'.
** CALL FUNCTION 'ERGO_TEXT_SHOW'
** EXPORTING
** textname = txt_report
** id = 'RE'
** langu = sy-langu
** EXCEPTIONS
** text_not_found = 01.
  ENDCASE.
  list_refresh = 'X'.
ENDFORM.                    "node_select
************************************************************************
*************************** Events *************************************
************************************************************************
AT USER-COMMAND.
  CASE sy-ucomm.
    WHEN 'ERLE'.
* txt_report = 'ERGP2600'.
* CALL FUNCTION 'ERGO_TEXT_SHOW'
* EXPORTING
* textname = txt_report
* id = 'RE'
* langu = sy-langu
* EXCEPTIONS
* text_not_found = 01.
 ENDCASE.
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 -> 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.