Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata
Error rendering macro 'code': Invalid value specified for parameter 'lang'
REPORT  ZLF_DELIVERY_FORM.
INCLUDE ZLR_DELIVERY_DATA.
INCLUDE ZLR_DELIVERY_FORMS.
INCLUDE ZLR_DELIVERY_PRINT_FORMS.
*---------------------------------------------------------------------*
*       FORM ENTRY
*---------------------------------------------------------------------*
FORM ENTRY USING RETURN_CODE LIKE SY-SUBRC
                 US_SCREEN   TYPE C.
  DATA: LF_RETCODE TYPE SY-SUBRC.
  XSCREEN = US_SCREEN.                 "Screen Used for Display
  PERFORM PROCESSING USING    US_SCREEN
                     CHANGING LF_RETCODE.
  IF LF_RETCODE NE 0.
    RETURN_CODE = 1.
  ELSE.
    RETURN_CODE = 0.
  ENDIF.
ENDFORM.                               "ENTRY
**---------------------------------------------------------------------*
**       FORM PROCESSING                                               *
**---------------------------------------------------------------------*
FORM PROCESSING USING    XSCREEN    TYPE C
                CHANGING CF_RETCODE LIKE SY-SUBRC.
  DATA: LS_PRINT_DATA_TO_READ TYPE LEDLV_PRINT_DATA_TO_READ. "Structure For setting print output
  DATA: LS_DLV_DELNOTE        TYPE LEDLV_DELNOTE.            "Structure having Delivery Details
  DATA: LF_FM_NAME            TYPE RS38L_FNAM.               "Function Module name
  DATA: LF_FORMNAME           TYPE FPNAME.                   "Form Name
  DATA: LS_ADDR_KEY           LIKE ADDR_KEY.                 "Address Structure
* Pdfname from customizing table TNAPR
  LF_FORMNAME = TNAPR-SFORM.
* Determine print data
  PERFORM SET_PRINT_DATA_TO_READ CHANGING LS_PRINT_DATA_TO_READ.
* Set data to print
  PERFORM GET_DATA USING      LS_PRINT_DATA_TO_READ
                   CHANGING   LS_ADDR_KEY
                              LS_DLV_DELNOTE
                              CF_RETCODE.
* Get the data to be displayed using the form
  PERFORM GET_ADDITIONAL_DATA USING LS_DLV_DELNOTE.
* Set print data requirements
  IF CF_RETCODE = 0.
* Determine PDF function module for Certificate of guarantee
    CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
      EXPORTING
        I_NAME     = LF_FORMNAME
      IMPORTING
        E_FUNCNAME = LF_FM_NAME.
*   E_INTERFACE_TYPE           =
  ENDIF.
  CALL FUNCTION 'FP_JOB_OPEN'
    CHANGING
      IE_OUTPUTPARAMS = LS_OUTPUT_PARAM
    EXCEPTIONS
      CANCEL          = 1
      USAGE_ERROR     = 2
      SYSTEM_ERROR    = 3
      INTERNAL_ERROR  = 4
      OTHERS          = 5.
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
  LS_DOC_PARAM-LANGU = NAST-SPRAS.
* Calling the function module and passing the form interface values
  CALL FUNCTION LF_FM_NAME
    EXPORTING
     /1BCDWB/DOCPARAMS         = LS_DOC_PARAM
      IS_DELNOTE               = LS_DLV_DELNOTE
* IMPORTING
*   /1BCDWB/FORMOUTPUT       =
   EXCEPTIONS
     USAGE_ERROR              = 1
     SYSTEM_ERROR             = 2
     INTERNAL_ERROR           = 3
     OTHERS                   = 4
            .
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
* Close spool job
  CALL FUNCTION 'FP_JOB_CLOSE'
*   IMPORTING
*     E_RESULT             = result
   EXCEPTIONS
     USAGE_ERROR          = 1
     SYSTEM_ERROR         = 2
     INTERNAL_ERROR       = 3
     OTHERS               = 4
             .
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ENDIF.
ENDFORM.                               "PROCESSING
*&---------------------------------------------------------------------*
*&  Include           ZLR_delivery_DATA
*&---------------------------------------------------------------------*
DATA:
  LS_DOC_PARAM       TYPE SFPDOCPARAMS, "Doc Parameters
  LS_OUTPUT_PARAM    TYPE SFPOUTPUTPARAMS,
                                       "Output Parameters
  RESULT            TYPE SFPJOBOUTPUT. "Output parameter returned in job close
TABLES: NAST,                          "Messages
        TNAPR,                         "Programs & Forms
        ADDR_KEY.                      "Adressnumber for ADDRESS
TYPE-POOLS SZADR.
DATA:   XSCREEN(1)   TYPE C.           "Output on printer or screen
*&---------------------------------------------------------------------*
*&  Include           ZLR_Delivery_FORMS
*&---------------------------------------------------------------------*
*---------------------------------------------------------------------*
*       FORM GET_DATA                                                 *
*---------------------------------------------------------------------*
*       General provision of data for the form                        *
*---------------------------------------------------------------------*
FORM GET_DATA
     USING    IS_PRINT_DATA_TO_READ TYPE LEDLV_PRINT_DATA_TO_READ
     CHANGING CS_ADDR_KEY           LIKE ADDR_KEY
              CS_DLV_DELNOTE        TYPE LEDLV_DELNOTE
              CF_RETCODE            TYPE SY-SUBRC.
  DATA:
    LS_DELIVERY_KEY TYPE  LESHP_DELIVERY_KEY. "Delivery Number
  LS_DELIVERY_KEY-VBELN = NAST-OBJKY.
*Function module get fills the structure ledlv_delnote according to exporting parameters
  CALL FUNCTION 'LE_SHP_DLV_OUTP_READ_PRTDATA'
    EXPORTING
      IS_DELIVERY_KEY       = LS_DELIVERY_KEY
      IS_PRINT_DATA_TO_READ = IS_PRINT_DATA_TO_READ
      IF_PARVW              = NAST-PARVW
      IF_PARNR              = NAST-PARNR
      IF_LANGUAGE           = NAST-SPRAS
    IMPORTING
      ES_DLV_DELNOTE        = CS_DLV_DELNOTE
    EXCEPTIONS
      RECORDS_NOT_FOUND     = 1
      RECORDS_NOT_REQUESTED = 2
      OTHERS                = 3.
  IF SY-SUBRC <> 0.
*  error handling
    CF_RETCODE = SY-SUBRC.
    PERFORM PROTOCOL_UPDATE.
  ENDIF.
* get nast partner adress for communication strategy
  PERFORM GET_ADDR_KEY USING    CS_DLV_DELNOTE-HD_ADR
                       CHANGING CS_ADDR_KEY.
ENDFORM.                    "GET_DATA
*---------------------------------------------------------------------*
*       FORM SET_PRINT_DATA_TO_READ                                   *
*---------------------------------------------------------------------*
*       General provision of data for the form                        *
*---------------------------------------------------------------------*
FORM SET_PRINT_DATA_TO_READ
         CHANGING CS_PRINT_DATA_TO_READ TYPE LEDLV_PRINT_DATA_TO_READ.
* Set print data requirements
  CS_PRINT_DATA_TO_READ-HD_GEN = 'X'.
  CS_PRINT_DATA_TO_READ-HD_REF = 'X'.
  CS_PRINT_DATA_TO_READ-IT_GEN = 'X'.
  CS_PRINT_DATA_TO_READ-HD_ADR = 'X'.
ENDFORM.                               "SET_PRINT_DATA_TO_READ
*&---------------------------------------------------------------------*
*&      Form  get_addr_key
*&---------------------------------------------------------------------*
FORM GET_ADDR_KEY USING    IT_HD_ADR   TYPE LEDLV_DELNOTE-HD_ADR
                  CHANGING CS_ADDR_KEY LIKE ADDR_KEY.
  FIELD-SYMBOLS <FS_HD_ADR> TYPE LINE OF LEDLV_DELNOTE-HD_ADR.
  READ TABLE IT_HD_ADR ASSIGNING <FS_HD_ADR>
                       WITH KEY DELIV_NUMB = NAST-OBJKY
                                PARTN_ROLE = NAST-PARVW.
  IF SY-SUBRC = 0.
    CS_ADDR_KEY-ADDRNUMBER = <FS_HD_ADR>-ADDR_NO.
    CS_ADDR_KEY-PERSNUMBER = <FS_HD_ADR>-PERSON_NUMB.
    CS_ADDR_KEY-ADDR_TYPE  = <FS_HD_ADR>-ADDRESS_TYPE.
  ENDIF.
ENDFORM.                               " get_addr_key
*&---------------------------------------------------------------------*
*&  Include           ZLR_delivery_PRINT_FORMS
*&---------------------------------------------------------------------*
*---------------------------------------------------------------------*
*       FORM PROTOCOL_UPDATE                                          *
*---------------------------------------------------------------------*
*       The messages are collected for the processing protocol   *
*---------------------------------------------------------------------*
FORM PROTOCOL_UPDATE.
  CHECK XSCREEN = SPACE.
  CALL FUNCTION 'NAST_PROTOCOL_UPDATE'
    EXPORTING
      MSG_ARBGB = SYST-MSGID
      MSG_NR    = SYST-MSGNO
      MSG_TY    = SYST-MSGTY
      MSG_V1    = SYST-MSGV1
      MSG_V2    = SYST-MSGV2
      MSG_V3    = SYST-MSGV3
      MSG_V4    = SYST-MSGV4
    EXCEPTIONS
      OTHERS    = 1.
ENDFORM.                               "PROTOCOL_UPDATE
  • No labels