Transfer PDC Data – Hand Terminal

Transfer PDC Data

Run program ZPHYEXP1 to download ZBISEG to the dataset.
Run program ZPHYEXP2 to view the dataset.

Run reports ZPHYLIST to check the Physical Inventory ( counted and after post difference ).

This standard SAP program are for those who want to upload the physical inventory data from dataset to a sequential file.

First, you must upload the file to the Application Server.
MIMD ( RM07IMDE ) – Report For Transferring PDC Phys. Inv. Data

Next, you create the batch session to transfer the counted data into ISEG. The count flag in ISEG will be set as ‘X’.
MI34 ( RM07II34 ) – Batch Input: Enter Count with Reference to Document

——————————–
Download ztable to the dataset

REPORT ZPHYEXP1.

* ZBISEG is a transparent table.  The structure copy from BISEG_MDE.

TABLES: ZBISEG,
        RLGRAP.

SELECT-OPTIONS: S_WERKS FOR ZBISEG-WERKS,
                S_LGORT FOR ZBISEG-LGORT.
*                s_matnr for ZBISEG-matnr.

DATA: BEGIN OF ITAB OCCURS 100.
        INCLUDE STRUCTURE BISEG_MDE.
DATA: END OF ITAB.

SELECT * FROM ZBISEG WHERE WERKS IN S_WERKS AND
     LGORT IN S_LGORT.
*     matnr in s_matnr.
  MOVE-CORRESPONDING ZBISEG TO ITAB.
  MOVE ‘1’ TO ITAB-BSTAR.
  APPEND ITAB.
ENDSELECT.

OPEN DATASET ‘/usr/sap/trans/data/phyinvmde’ FOR OUTPUT IN TEXT MODE.
LOOP AT ITAB.
  TRANSFER ITAB TO ‘/usr/sap/trans/data/phyinvmde’.
ENDLOOP.
CLOSE DATASET ‘/usr/sap/trans/data/phyinvmde’.

——————-

View the data after transferring to the dataset

REPORT ZPHYEXP2.

TABLES: ZBISEG,
        RLGRAP.

DATA: BEGIN OF ITAB OCCURS 100.
        INCLUDE STRUCTURE BISEG_MDE.
DATA: END OF ITAB.

OPEN DATASET ‘/usr/sap/trans/data/phyinvmde’ IN TEXT MODE.
DO.
  READ DATASET ‘/usr/sap/trans/data/phyinvmde’ INTO ITAB.
  IF SY-SUBRC <> 0.
    EXIT.
  ENDIF.
  WRITE: / ITAB-WERKS, ITAB-LGORT, ITAB-MATNR, ITAB-BSTAR,
           ITAB-ERFMG, ITAB-ERFME.
ENDDO.
CLOSE DATASET ‘/usr/sap/trans/data/phyinvmde’.

———————-

Physical Stock Take – With Posted Difference Value

* Function : To list stock take
* Download to dos:
* – use menu path List=>Save=>File…
* – select unconverted format
* – enter file name in dos format

REPORT ZPHYLIST LINE-SIZE 132 NO STANDARD PAGE HEADING
      LINE-COUNT 65(001).

TABLES: ISEG,
        IKPF,
        MBEW.

SELECT-OPTIONS: S_IBLNR FOR IKPF-IBLNR,
                S_WERKS FOR IKPF-WERKS,
                S_LGORT FOR IKPF-LGORT,
                S_MATNR FOR ISEG-MATNR,
                S_GIDAT FOR IKPF-GIDAT DEFAULT SY-DATUM.

SELECTION-SCREEN SKIP.
PARAMETERS:     C_XZAEL AS CHECKBOX DEFAULT ‘X’,
                C_XDIFF AS CHECKBOX DEFAULT ‘X’.
SELECTION-SCREEN SKIP.
PARAMETERS:     X_ZERO  AS CHECKBOX.
DATA: P_WERKS LIKE IKPF-WERKS,
      P_LGORT LIKE IKPF-LGORT,
      W_DIFF LIKE ISEG-MENGE,
      L_BTTL  LIKE ISEG-MENGE,
      L_PTTL LIKE ISEG-BUCHM,
      L_DTTL LIKE ISEG-MENGE,
      L_DVAL LIKE ISEG-DMBTR,
      P_BTTL  LIKE ISEG-MENGE,
      P_PTTL LIKE ISEG-BUCHM,
      P_DTTL LIKE ISEG-MENGE,
      P_DVAL LIKE ISEG-DMBTR,
      W_DMBTR LIKE ISEG-DMBTR,
      W_UCOST TYPE P DECIMALS 4,
      W_SPRICE TYPE P DECIMALS 4,
      W_LEN TYPE I.

FORMAT INTENSIFIED OFF.
SELECT * FROM IKPF WHERE IBLNR IN S_IBLNR AND
     WERKS IN S_WERKS AND
     LGORT IN S_LGORT AND
     GIDAT IN S_GIDAT AND
     SOBKZ NE ‘O’
     ORDER BY WERKS LGORT IBLNR.
  IF P_WERKS IS INITIAL.
    P_WERKS = IKPF-WERKS.
    P_LGORT = IKPF-LGORT.
  ENDIF.
  IF P_WERKS NE IKPF-WERKS.
    SKIP.
    FORMAT INTENSIFIED ON.
    WRITE:/ ‘ ** ‘, P_LGORT, ‘Location Total’,
              056(14) L_PTTL,
              072(14) L_BTTL,
              088(14) L_DTTL,
              118(14) L_DVAL.
    SKIP.
    FORMAT COLOR COL_TOTAL.
    WRITE:/ ‘  **** ‘, P_WERKS, ‘Plant Total’,
              056(14) P_PTTL,
              072(14) P_BTTL,
              088(14) P_DTTL,
              118(14) P_DVAL.
    FORMAT INTENSIFIED OFF.
    FORMAT COLOR OFF.
    P_WERKS = IKPF-WERKS.
    P_LGORT = IKPF-LGORT.
    CLEAR: L_BTTL, P_BTTL, L_PTTL, P_PTTL, L_DTTL, P_DTTL,
             L_DVAL, P_DVAL.
    NEW-PAGE.
  ENDIF.
  IF P_LGORT NE IKPF-LGORT.
    FORMAT INTENSIFIED ON.
    ULINE AT /46(86).
    WRITE:/ ‘ ** ‘, P_LGORT, ‘Location Total’,
              056(14) L_PTTL,
              072(14) L_BTTL,
              088(14) L_DTTL,
              118(14) L_DVAL.
    FORMAT INTENSIFIED OFF.
    SKIP.
    SKIP.
    P_LGORT = IKPF-LGORT.
    CLEAR: L_BTTL, L_PTTL, L_DTTL, L_DVAL.
  ENDIF.
  SELECT * FROM ISEG WHERE IBLNR = IKPF-IBLNR AND
       XZAEL = C_XZAEL AND
       XDIFF = C_XDIFF
       ORDER BY ZEILI.
    IF ISEG-XNZAE = ‘X’.
      CONTINUE.
    ENDIF.

    W_LEN = STRLEN( ISEG-MATNR ).
    IF W_LEN = 1.
      CONTINUE.
    ENDIF.

    CHECK S_MATNR.

    W_DIFF = ISEG-MENGE – ISEG-BUCHM.
    IF X_ZERO NE ‘X’.
      CHECK W_DIFF NE 0.
    ENDIF.
    CLEAR: MBEW-VPRSV, W_UCOST.
    IF ISEG-XDIFF NE ‘X’.
      CLEAR MBEW-VPRSV.
      SELECT SINGLE * FROM MBEW WHERE MATNR = ISEG-MATNR AND
              BWKEY = ISEG-WERKS.
      IF MBEW-VPRSV = ‘S’.
        W_UCOST = MBEW-STPRS / MBEW-PEINH.
      ELSE.
        W_UCOST = MBEW-VERPR / MBEW-PEINH.
      ENDIF.
      W_DMBTR = W_DIFF * W_UCOST.
    ELSE.
      IF W_DIFF < 0.
        W_DMBTR = ISEG-DMBTR * -1.
      ELSE.
        W_DMBTR = ISEG-DMBTR.
      ENDIF.
      W_UCOST = W_DMBTR / W_DIFF.
    ENDIF.
    WRITE: /001 ISEG-WERKS,
       008 ISEG-IBLNR,
       020 ISEG-ZEILI,
       026 ISEG-MATNR,
       046 ISEG-LGORT,
       056(14) ISEG-MENGE,
       072(14) ISEG-BUCHM,
       088(14) W_DIFF NO-ZERO,
       104(12) W_UCOST NO-ZERO,
       118(14) W_DMBTR NO-ZERO.
*    if iseg-xloek = ‘X’.
*      write: 118 ‘** deleted item’.
*    else.
    L_BTTL = L_BTTL + ISEG-BUCHM.
    P_BTTL = P_BTTL + ISEG-BUCHM.
    L_PTTL = L_PTTL + ISEG-MENGE.
    P_PTTL = P_PTTL + ISEG-MENGE.
    L_DVAL = L_DVAL + W_DMBTR.
    P_DVAL = P_DVAL + W_DMBTR.
    L_DTTL = L_DTTL + W_DIFF.
    P_DTTL = P_DTTL + W_DIFF.
    CLEAR: W_SPRICE, W_UCOST.
  ENDSELECT.
ENDSELECT.
FORMAT INTENSIFIED ON.
ULINE AT /46(86).
WRITE:/ ‘ ** ‘, P_LGORT, ‘Location Total’,
         056(14) L_PTTL,
         072(14) L_BTTL,
         088(14) L_DTTL,
         118(14) L_DVAL.
SKIP.
FORMAT COLOR COL_TOTAL.
WRITE:/ ‘  **** ‘, P_WERKS, ‘Plant Total’,
         056(14) P_PTTL,
         072(14) P_BTTL,
         088(14) P_DTTL,
         118(14) P_DVAL.
FORMAT INTENSIFIED OFF.
FORMAT COLOR OFF.

TOP-OF-PAGE.
  WRITE: / SY-DATUM, SY-UZEIT,
         50 ‘Physical Inventory Documents’, 110 SY-UNAME,
         120 ‘Page’, SY-PAGNO.
  SKIP.
  ULINE.
  WRITE:/001 ‘Plant’,
         008 ‘Doc No’,
         020 ‘Line’,
         026 ‘Material’,
         046 ‘Location’,
         056 ‘      Phy Inv’,
         072 ‘     Book Bal’,
         088 ‘    Difference’,
         104 ‘  Unit Cost’,
         118 ‘     Diff (S$)’.
  ULINE.
  SKIP.

Advertisements
Categories: VeryGood | Leave a comment

Post navigation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: