Simple Transfermation Program

Have you been requested to generate notification eamils for SAP users and been struggling with the text alignment problems?

Yes, html eamil is a good solution to solve the alignment issue, but how to construct the mail content?

1. We can concatenate literal html tags with sap data in ABAP program to construct the mail

2. We can use general text as template to generate eamil

3. Is there any better solution? Yes, we can use ST program!

http://help.sap.com/saphelp_nw04/helpdata/en/e3/7d4719ca581441b6841f1054ff1326/frameset.htm

Example:

1. Create a separate ST program with below notes:
  a) If abap data object was defined with type N, blank place must be filled with 0, otherwise
the simple transformation program will dump with exception XML_CONVERSION_NO_NUMBER.
e.g. DATA: lv_1 TYPE n LENGTH 3. value of lv_1 can be '009' but NOT '9' or '09'.
  b) Before using local variable in ST condition command, we must initialize it with ST command either
assign or clear.
e.g.
<tt:assign to-var="v1" ref="r1"/>
<tt:clear var="v1"/>
  c) Can NOT pass itab with header line to ST program.
2. CALL TRANSFORMATION xxx in general abap program
    SOURCE para1= ls_para1
           para2 = lt_para2[]
    RESULT XML xml_string.

3. Convert xml_string into SOLI itab

4. Send eamil

Tutorial: Data exchange between ABAP and XML

猜你喜欢

转载自jgtang82.iteye.com/blog/442680