2

Print and Send Invoice & Credit Memo E-Document (pdf, xml format) for Mexic...

 10 months ago
source link: https://blogs.sap.com/2023/06/09/print-and-send-invoice-credit-memo-e-document-pdf-xml-format-for-mexico-via-edoc_cockpit/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

2.1 Logic and BADI for addition of custom fields:

  1. Here all data is coming in XML format. Hence XML based Adobe form needs to be created. Layout and @30 custom fields need to be added and mapped to the form. SO its better approach with creation of custom XML based form and configure custom form in place of standard form.
  2. Here two different BADI will be required, given as below. One for adding custom fields in segment addenda and another one is required for remving added custom fields from addenda so as clients local customers will not receive custom fields.
  3. On research on google, we came to know that, there is a BADI EDOC_ADAPTOR has a provision to add custom fields in segment called addenda which further helps us to print them on PDF form.
  4. BADI EDOC_ADAPTOR will be implemented enhancement ZESD_CHANGE_DATA_PDF and class ZCLSD_CHANGE_DATA_PDF will be created. Here we are adding all custom fields required to print the form PDF.
  5. BADI EDOC_PARTNER_CONNECTOR will be implemented for edit the XMLfile. Here we are removing all custome fields which we have added for printing on PDF.
  6. New form will be created for this and it should be configure before starting with actual development.
  7. Form layout, form fields mapping and Logic for code of adding custom fields in addenda segment of BADI has been provided by functional specification. Code has been written in SET_OUTPUT_DATA method.
  8. As already mentioned in point 2, to fill addenda segment deep structure we have to create, which will hold header and item level data in one line. This is because BADI needs addenda data in the hexadecimal format before proceeding further.

2.2  Form Layout and Data structure creation in XML format.

  1. Once logic is ready and all required custom data is in the addenda segment, then we have to map the data on form which we have already created in SFP.
  2. We have to create XML based interface and mapped that interface with new form as our data in addenda is in XML format.
  3. There is no context button as in DDIC based form.
    Picture2-12.png
  4. We need to take following steps to upload our data structure to this form. We need to create data structure in XML format with addition of custom fields in same same order in which we have declared in our code while creating deep structure.
  5. Link for standard XML file will be provided by client to functional owners. XML file can be edited using Notepad++ for better readability. This will reduces the human errors in the file.
    1. Follow below steps to Upload above file to adobe form
    • To upload the XSD file into a form Go to layout of your Adobe form.
    • In Data View click on “Data Connection” then right click.
    • if you already have a connection, delete it and add the new one. Deleting step has to follow only for 1st
    • Once you click on delete system will ask you delete with mapping on form? Say No to this option or say Keep binding on form. Other wise it will remove all your mapping on form level as well and you need to remap whole form again with all properties
  6. Right click in the blank space and add a “New Data Connection.

    Picture3-12.png
  7. Select “XSD SChema” and next. Add the XSD Document

Picture4-11.png

And will be able to see the new fields added

Picture6-9.png

After this step we can map our custom fields on form. To view PDF, we have to select In process document from EDOC_COCKPIT t-code and press submit.

Once it is submitted successfully it will turn into green status which means it got approved from local tax authorities and got stamped in XML format. After this step we can view pdf.

Custom Field removal from XML.

Once PDF is view successfully we can press sent to customer from EDOC_COCKPIT t-code. Once sent to customer, XML and PDF both will be sent to mentioned email id probably 3rd party like bank, local customers etc.

If 3rd party doesnot required custom fields which we have added in Addenda segment that we can remove using BADI EDOC_PARTNER_CONNECTOR


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK