Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
3.3 kB
0
Indexable
Never
FORM TO_OLAP.
  LV_DBS_CONNECTION = 'TRIASDB04'.

  SELECT SINGLE * INTO LT_DBCON
  FROM DBCON
  WHERE CON_NAME = LV_DBS_CONNECTION.

  IF LT_DBCON-DBMS = 'MSS'.
    TRY.

      EXEC SQL.
        CONNECT TO :LV_DBS_CONNECTION
      ENDEXEC.

      IF SY-SUBRC <> 0.
        RAISE EXCEPTION TYPE CX_SY_NATIVE_SQL_ERROR.
      ENDIF.

      IF P1 = 'X'.
        EXEC SQL.
          DELETE FROM XZSD503
        ENDEXEC.

        EXEC SQL.
          COMMIT WORK
        ENDEXEC.

        LOOP AT IT_SHIP2.
          IF IT_SHIP2-ERDAT IS INITIAL.
            IT_SHIP2-ERDAT = '19000101'.
          ENDIF.
          IF IT_SHIP2-DATEN IS INITIAL.
            IT_SHIP2-DATEN = '19000101'.
          ENDIF.
          EXEC SQL.
            INSERT INTO
              XZSD503(ShipmentNo,
                      ShipmentType,
                      TransPlanningPoint,
                      Vendor,
                      NamaVendor,
                      ShippingType,
                      Status,
                      TandaTerima,
                      ShipmentDate,
                      NetWeight,
                      ShipmentCostNo,
                      CreatedBy,
                      PackMatType,
                      Route,
                      ShipmentInstruction,
                      ShipmentRemarks,
                      TanggalTandaTerima,
                      NamaDriver,
                      VehicleNo,
                      SealNo,
                      ContainerNo,
                      PrintSJ,
                      PrintTT,
                      PrintShipList,
                      TimeGI)
            VALUES  (:IT_SHIP2-TKNUM,
                     :IT_SHIP2-SHTYP,
                     :IT_SHIP2-TPLST,
                     :IT_SHIP2-TDLNR,
                     :IT_SHIP2-ZZTDLNR,
                     :IT_SHIP2-VSART,
                     :IT_SHIP2-ZZSTTRG,
                     :IT_SHIP2-ZZSTTEN,
                     :IT_SHIP2-ERDAT,
                     :IT_SHIP2-NTGEW,
                     :IT_SHIP2-FKNUM,
                     :IT_SHIP2-ERNAM,
                     :IT_SHIP2-ZZVHART,
                     :IT_SHIP2-ROUTE1,
                     :IT_SHIP2-ZZSHIPING,
                     :IT_SHIP2-ZZREMARKSSHIP,
                     :IT_SHIP2-DATEN,
                     :IT_SHIP2-NAMEF,
                     :IT_SHIP2-NAMBE,
                     :IT_SHIP2-EXIDV2,
                     :IT_SHIP2-INHALT,
                     :IT_SHIP2-COUNTERSJ,
                     :IT_SHIP2-COUNTERTT,
                     :IT_SHIP2-COUNTERSHL,
                     :IT_SHIP2-UZABF,)
          ENDEXEC.
        ENDLOOP.
      ELSEIF P2 = 'X'.
        LOOP AT IT_DO.
          " Nothing to do, provided if Item Data need to be processed
        ENDLOOP.
      ENDIF.

      EXEC SQL.
        COMMIT WORK.
      ENDEXEC.

      EXEC SQL.
        DISCONNECT :LV_DBS_CONNECTION
      ENDEXEC.

      IF P1 = 'X'.
        MESSAGE 'Header Data berhasil di-download!' TYPE 'I'.
      ELSEIF P2 = 'X'.
        " Nothing to do, provided if Item Data need to be processed
      ENDIF.
    ENDTRY.
  ENDIF.
ENDFORM.                    "TO_OLAP
Leave a Comment