Quantcast
Channel: SCN : Document List - ABAP Development
Viewing all 935 articles
Browse latest View live

SAP Excel In Place

$
0
0

SAP Excel in Place

 

Applies to:

SAP NetWeaver 2004s, mySAP ERP 2005

Created on:

21-08-2013

Author:

Gaurang Gujar, Capgemini ,  Consultant , Appsone.

Summary

Many times it is an requirement to add an derived field to standard ALV report.

Normally It will take a lot of coding effort to get a derived in Standard or Your Custom ALV List.

Good News is this document SAP is very thought full about it and has introduced Excel in Place using which

Coding for requirement is not reduced but made absolutely zero.

Steps to use this Excel in Place

Lets us take an Example of View SFLIGHTS

Temp.JPG

      The view looks like below

Temp.JPG

       Now Here we have Two Columns Seats Max and Seats Occupied

       Suppose there is a requirement to have a derived column seats available. It would require a lot of coding for the same.

       SAP Excel in Place comes to our Rescue.

     Step 1

       Click on Excel In Place Icon

Temp.JPG

 

    Temp.JPG

          Enter the File Name

     Temp.JPG

     Step 2

     Create the formula or Macro for the derived column

     In our case l2-M2 and Drag it down.

Temp.JPG

Temp.JPG

     Save the file and Close it

    Step 3

     Go to Change layout

Temp.JPG

     Go to view Tab

Temp.JPG


     Select the view as Microsoft Excel

Temp.JPG

     Click on Upload Document from BDS

 

     Browse the File We Created and Saved

     Our File appear in the List

Temp.JPG

       Select the same and click on Save

Temp.JPG

     Save the layout

Temp.JPG

     Click on enter

     Tadaaaa

Temp.JPG


Seats available in Output

Excel in place can be used with Macro Recording with get derived Fields also Hide Columns’

with Value Zero and Many other stuffs


How to get Overview Tree from MD04 with MD_SALES_ORDER_STATUS_REPORT FM

$
0
0

Recently I needed to get information from CO46 tcode to use in a custom development. More specifically, I needed Overview Tree from MD04.

tela1.jpg

The only FM to get this data is MD_SALES_ORDER_STATUS_REPORT, but this FM just open CO46 tcode.

So we have this NODISP parameter in the FM, but when enabled, it returns only the IIOELX table and any data from Overview Tree.

 

So, I did a huge workaround to get this information from this FM. As it is described below.

 

In the Z program we have to o the following:

Declare two variables:

 

DATA: lc_md_memory,             gt_ord_outtab  TYPE ty_io_struc_tab.

 

You can copy ty_io_struc_tab structure from program LM61TTOP.

 

In your code, before call MD_SALES_ORDER_STATUS_REPORT FM, you need to set some memory information.

Note that NODISP parameter is set to space as default.

 

lc_md_memory = cc_x.    " Set var to export to memory
EXPORT lc_md_memory TO MEMORY ID 'MDREPORT'.

" Call FM with your parameters
CALL FUNCTION 'MD_SALES_ORDER_STATUS_REPORT'
EXPORTING
           edelet         = ls_mdpsx-delet           edelkz         = ls_mdpsx-delkz           edelnr         = ls_mdpsx-del12           edelps         = ls_mdpsx-delps           ewerks         = ls_mt61d-werks           i_ignore_mtold = 'X'           i_profid       = 'SAP000000002'
EXCEPTIONS           error          = 1          others         = 2.

" Import result table from memory
IMPORT gt_ord_outtab FROM MEMORY ID 'MDREPORT'.

 

After this points, you should have your internal table GT_ORD_OUTTAB with the same information from Overview Tree, but to work we need to create another piece of this puzzle: an implicit enhancement.

 

Go to program LM61TF27, enable Enhance and Show Implicit Enhance Options.

In the end of form ord_create_tree, create an enhance implamentation to insert the following code:

 

  DATA: lc_md_memory.   IMPORT lc_md_memory FROM MEMORY ID 'MDREPORT'.   IF lc_md_memory IS NOT INITIAL.     EXPORT gt_ord_outtab TO MEMORY ID 'MDREPORT'.     LEAVE PROGRAM.   ENDIF.

In this code, we get lc_md_memory from memory to check if it is set from our calling program.

If is set, we export gt_ord_outtab to memory and finally leave current program to avoid open CO46 transaction.

 

It should be like this:

tela2.jpg

 

In our calling program, GT_ORD_OUTTAB will be populated as CO46.

tela3.jpg

 

Hope it helps!

How to use Material Master Skipping numbers using RFC/BAPI

$
0
0

Sometimes the client or end-users says that some material master numbers are getting skipped due to some error in Material Master Record data during the data upload using RFC / BAPI. 


Scenario:


Material Numbers generated are “000000000200000020”, “000000000200000021”, “000000000200000022”, ‘‘000000000200000023”, “‘000000000200000026” and so on. The numbers between ‘‘000000000200000023” and “‘000000000200000026” are missing. What could be the reason?

 

Reason:


The Reason may be “N” number, but here I am Concentrate on data Error like Base Unit of Measure is Wrong, Instead of ‘EA’ wrongly transfer to SAP ‘EAA’, or Material Group is wrong..etc.. then your material record is not save or you lost one sequential number range, mean at end of day when you generate a daily report of material master you seen one or more than one material numbers are missing, may be above reason one of them.so how to use the Skipping number range using RFC/BAPI ?.

 


Solution:


Note: I not taking all Fields of Creating Material Master Only Use “Basic Data1” view data, like Industry Sector(I_MBRSH) , Material Type (I_MTART), Material Number(I_MATNR) , Base unit of measure (I_MEINS) and Material Shot Description.

 

 

 

I_MEINS(Base Unite of Measure) = ‘EAA’ (which is not available in SAP)

and once you execute below Function Module with wrong Base unit of Measure then you got below error, see in Screen Shot#1 With one error Material Number, that material is skipped, next time with correct value or next record of same material type when you transfer to SAP you never pick your skipped number, if you follow my below steps then you must use your skipping material master number s.


 


RR1.png

Screen Shot# 1

 

 

Step # 1: Create One “Z” or “Y” Table for Insert the Error Material Number or Skipping Material Number with Respective Material Type.

 

 

t2.png

Screen Shot# 2

 

 

Step #2:


Write the Code as below Screen Shot,

  • Check is it Internal Number or External Number Range?
  • Internal Number Range.  (Screen Shot# 3 and 4 )
    • Check any Skipping Internal Number is available in “Y” Table for the Respective Material Type, here I am using Material Type = ‘ERSA’.
    • Use the Skipping Internal Number and Delete that Skipping Internal Number from “Y” Table after Use.
    • IF any Skipping Internal Number not available in “Y” Table with respective material type, then how to retrieve one Current Sequential Number ranges with respective material type.

 

t3.png

Screen Shot# 3

 

 

t4.png

Screen Shot# 4

 

 

 

  • External Number Range. (Screen Shot# 5)
    • Check any Skipping External Number is available in “Y” Table for Respective Material Type , Here I am using Material Type = ‘ERSA’ .
    • Use the Skipping External Number and Delete that Skipping External Number from “Y” Table after Use.
    • IF any Skipping External Number not available in “Y” Table with respective material type, then pass the External Material Number to Material Header Structure.

                   i.e.  DATA:  MHEADER LIKE BAPIMATHEAD .

  MOVE  I_MATNR TO MHEADER-MATERIAL.

t5.png

Screen Shot# 5


 

 

Step #3 :

 

Finally Pass all Respective field value into "BAPI_MATERIAL_SAVEDATA" .

 

t8.png

Screen Shot# 6

 

t9.png

Screen Shot# 7


 

Step #4:

 

Re-Execute your Function Module with Correct data; here the correct data is “Base Unit of Measure” which is wrong previously, Instead of “EA” wrongly transfer “EAA”, Check below Screen Shots # 8 and 9.

 

RR2.png

Screen Shot# 8

 

 

RR3.png

Screen Shot# 9

 

 

Regard's

Smruti


Adding notes, long texts to the Business partner UI

$
0
0

Purpose


The document explains how to load notes in to business partner. The loading is done using a report program. Also there was some requirement to do string operations with the notes from the source system.

 

Capture.PNG

Capture.PNG

 

Steps


  1. The source notepad file should contain the Business partner number and note that is to be added.
  2. I am using  FM gui_upload for that.

     Capture.PNG

3.From internal table , now we have the BP number and long text  that is to be loaded. Fill the tables lt_lines as shown below.

 

          Capture.PNG

4.Or you can give lwa_lines-tdformat = '' for better result.

 

5.To run the program ib background , we need to use open dataset.

 

6.We can use the function 'CONV_TEXTSTRING_TO_ITF' for formatting the notes.

(The standard field tdline will truncate the note on 123, if we do not use conv_textstring_to_itf )

 

     Capture.PNG

also,

     Capture.PNG

7.Call function Save_text , for populating the text.

 

     Capture.PNG

 

8.Call the BAPI  for saving the text. (Even savemode_direct parameter in save_text fm can fulfill the rquirement)

 

          Capture.PNG

Download Multiple Internal Tables in Single Excel Sheet

$
0
0

Download Multiple Internal Tables in Single Excel Sheet

 

 

Objective:

 

Some times we need to download multiple internal tables in single excel files as per requirement. Internal tables having different structure at that time we can download multiple internal tables in single excel sheet using GUI_DOWNLOAD function module.

 

Simple Solution:

 

Using append function in GUI_DOWNLOAD function module

 

Sample Code:

 


**** Types Declaration
TYPES: BEGIN OF ty_header,
        fld(20) TYPE c,
        END OF ty_header,

        BEGIN OF ty_t001,
        bukrs TYPE t001-bukrs,
        butxt TYPE t001-butxt,
        ort01 TYPE t001-ort01,
        END OF ty_t001,

        BEGIN OF ty_sflight,
        carrid TYPE sflight-carrid,
        connid TYPE sflight-connid,
        fldate TYPE sflight-fldate,
        price  TYPE sflight-price,
        END OF ty_sflight.

**** Internal table Declaration
DATA: it_t001 TYPE TABLE OF ty_t001,
       it_sflight TYPE TABLE OF ty_sflight,
       it_header_1 TYPE TABLE OF ty_header,
       it_header_2 TYPE TABLE OF ty_header.

**** WorkArea Declaration
DATA: wa_t001 TYPE ty_t001,
       wa_sflight TYPE ty_sflight,
       wa_header TYPE ty_header.

**** getting data from t001 to it_t001
SELECT bukrs
        butxt
        ort01
        INTO TABLE it_t001 FROM t001 UP TO 10 ROWS.

**** Header Declaration for t001
wa_header-fld = 'Company Code'.
APPEND wa_header TO it_header_1.
CLEAR wa_header.
wa_header-fld = 'Name of Company Code or Company'.
APPEND wa_header TO it_header_1.
CLEAR wa_header.
wa_header-fld = 'City'.
APPEND wa_header TO it_header_1.
CLEAR wa_header.

**** getting data from sflight to it_sflight
SELECT carrid
        connid
        fldate
        price
        INTO TABLE it_sflight FROM sflight UP TO 10 ROWS.

**** Header Declaration for sflight
wa_header-fld = 'Airline Code'.
APPEND wa_header TO it_header_2.
CLEAR wa_header.
wa_header-fld = 'Flight Connection Number'.
APPEND wa_header TO it_header_2.
CLEAR wa_header.
wa_header-fld = 'Flight date'.
APPEND wa_header TO it_header_2.
CLEAR wa_header.
wa_header-fld = 'Airfare'.
APPEND wa_header TO it_header_2.
CLEAR wa_header.

**** To download data to excel
CALL FUNCTION 'GUI_DOWNLOAD'
   EXPORTING
     filename              = 'D:/test.xls'
     write_field_separator = 'X'
     append                = ' '
   TABLES
     data_tab              = it_t001
     fieldnames            = it_header_1.

CALL FUNCTION 'GUI_DOWNLOAD'
   EXPORTING
     filename              = 'D:/test.xls'
     write_field_separator = 'X'
    append                = 'X'                
   TABLES
     data_tab              = it_sflight
     fieldnames             = it_header_2.

 

 

Output

 

 

 

Regards,

Ramesh.T

Progress Indicator with estimated remaining time style windows.

$
0
0

Thisexample showsmy techniqueso thatthe user knowstheexecution timeandto cancelthe query ifnotappropriate.Hope youhelps.

 

process.jpg

 

CODE:

 

*&---------------------------------------------------------------------*
*& Report  Z_TEST_COUNT
*&
*&---------------------------------------------------------------------*
*&
*& By: J.Julio González
*&---------------------------------------------------------------------*

REPORT  Z_TEST_COUNT.

DATA: L_SYTABIX LIKE SY-TABIX.
DATA: LINES TYPE I.
DATA: PERCENT TYPE I.
DATA: CHARPERCENT TYPE STRING.
DATA: VPERCENT TYPE I.
DATA: TEXTPROGRESS TYPE STRING.
DATA: T_TEMP TYPE TIMESTAMP.
DATA: TOTAL_TEMP TYPE TIMESTAMP.
DATA: REST_TEMP TYPE TIMESTAMP.
DATA: SECONDS TYPE I.
DATA: SECONDS_C TYPE STRING.
DATA: TEMP TYPE STRING.
DATA: TI_SFLIGHT LIKE SFLIGHT OCCURS 0 WITH HEADER LINE.

*LOAD INTERNAL TABLE FOR EXAMPLE
SELECT * FROM SFLIGHT INTO TABLE TI_SFLIGHT.

*CALCULATE THE NUMBER OF RECORDS
DESCRIBE TABLE TI_SFLIGHT LINES LINES.

*DATA PROCESSING
LOOP AT TI_SFLIGHT.
PERCENT
= 100 * SY-TABIX / LINES.
MOVE PERCENT TO CHARPERCENT.
L_SYTABIX
= SY-TABIX.
VPERCENT
= PERCENT MOD 5.


****EMULATE PROCESSES********
WAIT UP TO 1 SECONDS.
**************************

* RECALCULATED EVERY 5 PERCENT.
IF VPERCENT = 0.
GET RUN TIME FIELD T_TEMP.
IF T_TEMP IS NOT INITIAL AND PERCENT IS NOT INITIAL.
VPERCENT
= PERCENT MOD 10.
IF  PERCENT = 5 OR VPERCENT = 0.
TOTAL_TEMP
=  ( T_TEMP * 100 ) / PERCENT .
REST_TEMP
= ( TOTAL_TEMP - T_TEMP ) / 1000000.
ENDIF.
ENDIF.
SECONDS
= REST_TEMP.
MOVE SECONDS TO SECONDS_C.
CONCATENATE SECONDS_C 'S' INTO TEMP.
CONCATENATE 'DATA PROCESSING...' CHARPERCENT '% COMPLETE, REMAINING TIME:' TEMP INTO TEXTPROGRESS SEPARATED BY SPACE.

* SHOW THE PROGRESS INDICATOR
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
PERCENTAGE
= PERCENT
TEXT = TEXTPROGRESS.
CLEAR VPERCENT.
ENDIF.
ENDLOOP.

Overcome the default limit of 30 characters to parameters/select-options text on selection screen

$
0
0

Hello Friends,

 

On selection screen we can display up to 30 characters of parameters/select-options text.

However with the help of SELECTION-SCREEN COMMENT [text] FOR FIELD sel”, we can overcome this limit of 30 characters upto 83 characters.

 

Steps:

 

1. Go to transaction code SE38 and create sample program.

demo1.jpg

2.     Let’s say we need to create two radio buttons R1 and R2 with the texts "Service Tax liability Register for manufracturing "and “Service Tax liability Register for services ”, respectively.

3.     Usual way of doing it is with the help of GOTO->TEXT ELEMEMTS->SELECTION TEXTS.

a.     Create two radio buttons as below.

demo2.jpg

 

b.    Now assign the texts to these radio buttons GOTO->TEXT ELEMEMTS->SELECTION TEXTS

 

demo3.jpg

 

c.     Enter the corresponding text here

 

demo4.jpg

 

 

d.    Activate and execute the program.

 

demo5.jpg

 

It will not allow us to write more than 30 characters.

 

4.     Let’s see how this can be achieved.

a.     Write below code and activate the program

demo6.jpg

 

 

b.    Maintain the texts TEXT-001 and TEXT-002 [Goto->Text elements-> Text Symbols] and activate the texts.

 

demo7.jpg

c.     Execute the program.

 

demo8.jpg

And it's DONE..

SEPA Mandate form in multiple languages

$
0
0

This document describes development steps for SEPA mandate form output. In this approach, no need to do tedious translation of smartfom (in SE63) to trigger output in multiple languages.

 

 

Standard Smartform: SEPA_MANDATE is copied to customized Smartform : ZSEPA_MANDATE. The new form name needs to be assigned in SEPA customization (transaction FI_APAR_SEPA_CUST).

sepa_cust.JPG

 

 

Copy the smart style SEPA_MANDATE_STIL to ZSEPA_MANDATE_STIL and assign it to new smartform ZSEPA_MANDATE (in form attributes).

 

Upload the logo in SE78 transaction and replace it in LOGO window.sepa_form1.JPG

Replace the texts with SO10 text or Text module. Keep the ‘Language’ field blank. The standard text will be called dynamically based on the language passed from application. Maintain the standard texts in intended language in SO10 transaction.

 

sepa_form2.JPG

sepa_form3.JPG

 

As per standard SEPA functionality, the mandate is triggered in payer’s language (Language field in ‘sender’ tab of mandate master data).


Internal Table in Mail Body

$
0
0

Objective

  • The requirement is to send internal table data in mail body instead of sending as attachment in mail. Mail body internal table data should display with different color’s based on conditions. 

Advantage

  • Not required to open mail attachment to see information on it, it displays mail body itself.
  • Color indication based on conditions, it helps for better analysis.

Steps for sending internal table data in mail body.   

  1. Getting data to internal table from data base table
  2. Create HTML mail content.
  3. Create Mail using SO_NEW_DOCUMENT_ATT_SEND_API1

   

1. Getting data to internal table from data base table

 

I am using data base table SFLIGHT for demo purpose

Code:

DATA : it_sflight TYPETABLEOF ty_sflight,
wa_sflight
TYPE ty_sflight.
DATA : it_final TYPETABLEOF ty_final,
wa_final
TYPE ty_final.

* Start-of-selection
START-
OF-SELECTION.

SELECT carrid
connid
fldate
planetype
seatsmax
seatsocc
FROM sflight INTOTABLE it_sflight UPTO10ROWS.
SORT it_sflight BY  fldate.
LOOPAT it_sflight INTO wa_sflight.
wa_final-carrid     =    wa_sflight-carrid.
wa_final-connid     =    wa_sflight-connid.
wa_final-fldate     =    wa_sflight-fldate.
wa_final-planetype  =    wa_sflight-planetype.
wa_final-seatsmax   =    wa_sflight-seatsmax.
wa_final-seatsocc   =    wa_sflight-seatsocc.
var = ( wa_sflight-seatsocc / wa_sflight-seatsmax ) *
100.
wa_final-percentage = var.
APPEND wa_final TO it_final.
CLEAR : wa_final, var.
ENDLOOP.

 

2. Create HTML mail content.

  • The HTML content is prepared and filled in table it_final which would be later used to create      HTML form.
  • <html> tag tells the browser that this is an HTML document.
  • <body> tag is used to defines the document's body.
  • <font> tag is used to use to give the style to the content.
  • <style> tag is used to define style information for an HTML document.
  • <th>    tag defines a header cell in an HTML table.
  • <tr>      tag defines a row in an HTML table.

 

Code:  

      *...Title
wa_docdata-obj_name  =
'Email notification'.

*...Description
wa_docdata-obj_descr =
'Internal Table in Email Body'.

*...Message Body in HMTL
wa_objtxt-
line = '<html> <body style="background-color:#FFE4C4;">'.
APPEND wa_objtxt TO it_objtxt.

wa_objtxt-
line = '<p> List of Test materials </p>'.
APPEND wa_objtxt TO it_objtxt.

*   table display
wa_objtxt-
line = '<table style="MARGIN: 10px" bordercolor="NavajoWhite" '.
APPEND wa_objtxt TO it_objtxt.
wa_objtxt-
line = ' cellspacing="0" cellpadding="3" width="800"'.
APPEND wa_objtxt TO it_objtxt.
wa_objtxt-
line = ' border="1"><tbody><tr>'.
APPEND wa_objtxt TO it_objtxt.

*   table header
wa_objtxt-
line = '<th><font color="RoyalBlue">Airline Code</font></th>'.
APPEND wa_objtxt TO it_objtxt.
wa_objtxt-
line = '<th><font color="RoyalBlue">Flight</font></th>'.
APPEND wa_objtxt TO it_objtxt.
wa_objtxt-
line = '<th><font color="RoyalBlue">Flight date</font></th>'.
APPEND wa_objtxt TO it_objtxt.
wa_objtxt-
line = '<th><font color="RoyalBlue">Aircraft Type</font></th>'.
APPEND wa_objtxt TO it_objtxt.
wa_objtxt-
line = '<th><font color="RoyalBlue">Maximum capacity</font></th>'.
APPEND wa_objtxt TO it_objtxt.
wa_objtxt-
line = '<th><font color="RoyalBlue">Occupied seats</font></th>'.
APPEND wa_objtxt TO it_objtxt.
wa_objtxt-
line = '<th><font color="RoyalBlue">Occupied %</font></th></tr>'.
APPEND wa_objtxt TO it_objtxt.

*   table Contents
LOOPAT it_final INTO wa_final.
wa_objtxt-
line = '<tr>'.
APPEND wa_objtxt TO it_objtxt.
var = wa_final-percentage.
IF var GE'50'.
CONCATENATE'<td><center>' wa_final-carrid '</center></td>'INTO wa_objtxt-line.
APPEND wa_objtxt TO it_objtxt.
CONCATENATE'<td><center>' wa_final-connid '</center></td>'INTO wa_objtxt-line.
APPEND wa_objtxt TO it_objtxt.
CONCATENATE'<td><center>' wa_final-fldate '</center></td>'INTO wa_objtxt-line.
APPEND wa_objtxt TO it_objtxt.
CONCATENATE'<td><center>' wa_final-planetype '</center></td>'INTO wa_objtxt-line.
APPEND wa_objtxt TO it_objtxt.
CONCATENATE'<td><center>' wa_final-seatsmax '</center></td>'INTO wa_objtxt-line.
APPEND wa_objtxt TO it_objtxt.
CONCATENATE'<td><center>' wa_final-seatsocc '</center></td>'INTO wa_objtxt-line.
APPEND wa_objtxt TO it_objtxt.
CONCATENATE'<td><center>' wa_final-percentage '%''</center></td></tr>'INTO wa_objtxt-line.
APPEND wa_objtxt TO it_objtxt.
ELSE.
CONCATENATE'<td><center><font color="Red">' wa_final-carrid '</font></center></td>'INTO wa_objtxt-line.
APPEND wa_objtxt TO it_objtxt.
CONCATENATE'<td><center><font color="Red">' wa_final-connid '</font></center></td>'INTO wa_objtxt-line.
APPEND wa_objtxt TO it_objtxt.
CONCATENATE'<td><center><font color="Red">' wa_final-fldate '</font></center></td>'INTO wa_objtxt-line.
APPEND wa_objtxt TO it_objtxt.
CONCATENATE'<td><center><font color="Red">' wa_final-planetype '</font></center></td>'INTO wa_objtxt-line.
APPEND wa_objtxt TO it_objtxt.
CONCATENATE'<td><center><font color="Red">' wa_final-seatsmax '</font></center></td>'INTO wa_objtxt-line.
APPEND wa_objtxt TO it_objtxt.
CONCATENATE'<td><center><font color="Red">' wa_final-seatsocc '</font></center></td>'INTO wa_objtxt-line.
APPEND wa_objtxt TO it_objtxt.
CONCATENATE'<td><center><font color="Red">' wa_final-percentage '%''</font></center></td></tr>'INTO wa_objtxt-line.
APPEND wa_objtxt TO it_objtxt.
ENDIF.
CLEAR : wa_final, var.

ENDLOOP.

*   table close
wa_objtxt-
line = '</tbody> </table>'.
APPEND wa_objtxt TO it_objtxt.

*   Signature color
wa_objtxt-
line = '<br><br>'.
APPEND wa_objtxt TO it_objtxt.
wa_objtxt-
line = '<p> Regards,</p>'.
APPEND wa_objtxt TO it_objtxt.
wa_objtxt-
line = '<p><b> Your Name</b></p>'.
APPEND wa_objtxt TO it_objtxt.

*   HTML close
wa_objtxt-
line = '</body> </html> '.
APPEND wa_objtxt TO it_objtxt.

* Document data
DESCRIBETABLE it_objtxt      LINES w_tab_lines.
READ     TABLE it_objtxt      INTO wa_objtxt INDEX w_tab_lines.
wa_docdata-doc_size =
( w_tab_lines -
1 ) * 255 + STRLEN( wa_objtxt ).

* Packing data
CLEAR wa_objpack-transf_bin.
wa_objpack-head_start =
1.
wa_objpack-head_num   =
0.
wa_objpack-body_start =
1.
wa_objpack-body_num   = w_tab_lines.
*   we will pass the HTML, since we have created the message
*   body in the HTML
wa_objpack-doc_type   =
'HTML'.
APPEND wa_objpack TO it_objpack.

ENDFORM.                    " CREATE_TITLE_DESC_BODY

*&---------------------------------------------------------------------*
*&      Form  fill_receivers
*&---------------------------------------------------------------------*
*       Filling up the Receivers
*----------------------------------------------------------------------*
FORM fill_receivers .

wa_reclist-receiver =
'ramesh@gmail.com'.
wa_reclist-rec_type =
'U'.
APPEND wa_reclist TO it_reclist.
CLEAR  wa_reclist.


ENDFORM.                    " fill_receivers

 

 

3. Create Mailusing SO_NEW_DOCUMENT_ATT_SEND_API1


Now using  SO_NEW_DOCUMENT_ATT_SEND_API1  to send message to external internet id.

 

* Send Message to external Internet ID
CALLFUNCTION'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data              = wa_docdata
put_in_outbox              =
'X'
commit_work                =
'X'
TABLES
packing_list               = it_objpack
object_header              = it_objhead
contents_txt               = it_objtxt
receivers                  = it_reclist
EXCEPTIONS
too_many_receivers         =
1
document_not_sent          =
2
document_type_not_exist    =
3
operation_no_authorization =
4
parameter_error            =
5
x_error                    =
6
enqueue_error              =
7
OTHERS                     = 8.

IF sy-subrc NE0.
WRITE: 'Sending Failed'.
ELSE.
WRITE: 'Sending Successful'.
ENDIF.

 

Output in SOST.

 

Out put in Mail.

 

 

Source code attached in text file

 

 

Field Exit and Field Enhancement

$
0
0

Field Exit and Field Enhancement


Field Exit:


Field exit is used to write your custom logic against field, it is no longer used by SAP after 4.6C as SAP has come up with lots of user exit and enhancement options. However this document illustrates the way we can use field exit in our SAP.

Go to Transaction Code CMOD then put Transaction Code PRFB in Command Prompt.

SDN1.JPG

 

Then Go to Menu option ‘Field Exit -> Create’, it will come to below shown screen.

SDN1.JPG

 

SDN1.JPG

 

Or

Run the Program RSMODPRF without parameters.

SDN1.JPG

Execute the program.

SDN1.JPG

 

Now, once we create FIELD_EXIT_XXXX function Module, then it will get triggered every time we use that field.

Set the profile parameter abap/field exit = YES and restart the system.

And before using this field exit, we need to assign it to program and screen.

 

To assign field exit to a screen, go to Transaction Code PRFB and select your Data Element and click on Assign program/ screen.

SDN1.JPG

 

Field Enhancement:


Example:  As we can see in below screen shot, we have VBAK-AUART field with Data Element description ‘SD document category’. Now we will use Field Enhancement Technique to Change this Data Element Description to “Test Document Category”.

SDN1.JPG

Go to Transaction Code CMOD and follow the path as shown in below screen.

SDN1.JPG

 

Make Changes to description.

SDN2.JPG

Save it and now check the changes.

SDN1.JPG

BAPI_PO_CHANGE - Change SLFDT variable

$
0
0

Hello,attachedan example tochange the datestatisticsof distributions (variable SLFDT ), you just have topassthe parametersandcall the routine.

 

EXAMPLE:

 

FORM CHANGE_SLFDTUSING EBELN EBELP ETENR STAT_DATE.

   DATA: ERROR TYPE SY-SUBRC.
   DATA: POSCHEDULE LIKE  BAPIMEPOSCHEDULE OCCURS 0 WITH HEADER LINE.
   DATA: POSCHEDULEX LIKE  BAPIMEPOSCHEDULX OCCURS 0 WITH HEADER LINE.

   DATA : l_msgty      TYPE c,
          l_msgid(2)   TYPE c,
          l_msgno(3)   TYPE c,
          l_msgtx(100) TYPE c,
          l_errflag    TYPE c.

   CONSTANTS: c_x              TYPE  c         VALUE 'X',
            c_hyp            TYPE  c         VALUE '-',
            c_err            TYPE  bdc_mart  VALUE 'E'.
   DATA : BEGIN OF t_bapireturn OCCURS 0.
         INCLUDE STRUCTURE bapiret2.
   DATA : END OF t_bapireturn.
   DATA: WA_EKPO LIKE EKPO.
   DATA: ELIKZ_AUX LIKE EKPO-ELIKZ.
   DATA: EKPO_MSG TYPE STRING.
   DATA: i_return TYPE bapiret2 OCCURS 0 WITH HEADER LINE,
       wa_message TYPE c LENGTH 100.

      CLEAR: t_bapireturn.
      REFRESH: t_bapireturn.
      CLEAR POSCHEDULE.
      REFRESH POSCHEDULE.
      CLEAR POSCHEDULEX.
      REFRESH POSCHEDULEX.


* Load  PARAMETERS


     CLEAR POSCHEDULE.
     POSCHEDULE-PO_ITEM = EBELP.
     POSCHEDULE-SCHED_LINE = ETENR.
     POSCHEDULE-STAT_DATE = STAT_DATE.
     APPEND POSCHEDULE.
     CLEAR POSCHEDULEX.
     POSCHEDULEX-PO_ITEM = EBELP.
     POSCHEDULEX-SCHED_LINE = ETENR.
     POSCHEDULEX-STAT_DATE = 'X'.
     APPEND POSCHEDULEX.


*Call BAPI


     CALL FUNCTION 'BAPI_PO_CHANGE'
     exporting
     purchaseorder = EBELN
     TESTRUN = ''
     TABLES
     RETURN = t_bapireturn
     POSCHEDULE = POSCHEDULE
     POSCHEDULEX = POSCHEDULEX.

     READ TABLE t_bapireturn WITH KEY type = c_err TRANSPORTING NO FIELDS.

      IF sy-subrc NE 0.
        CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
          EXPORTING
            wait = c_x.

     ELSE.

        CLEAR EKPO_MSG.
        LOOP AT t_bapireturn WHERE TYPE = C_ERR.
          CONCATENATE EKPO_MSG 'ERROR //' t_bapireturn-type t_bapireturn-id t_bapireturn-number  t_bapireturn-message INTO EKPO_MSG SEPARATED BY SPACE.
        ENDLOOP.
    

      ENDIF.


ENDFORM.

 

 

Regards.

Display PHOTO employee in a DYNPRO

$
0
0

Hello, attachedan example to seethe photo ofemployeeby number of personnel in a DYNPRO.Variable "PERNR" is the number of personnel.

You have tocreate a container in the DYNPRO with the name of "PHOTO" and call the form.


 

CODE:

DATA: PERNR TYPE PERNR_D.

DATA: URI LIKE  TOAURI-URI.

DATA: G_RESULT TYPE I.

DATA: H_PICTURE       TYPE REF TO CL_GUI_PICTURE.
DATA: H_PIC_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER.

 

FORM PHOTO.

CLEAR URI.

CALL FUNCTION 'HRWPC_RFC_EP_READ_PHOTO_URI'
EXPORTING
PERNR =   PERNR
IMPORTING
   URI = URI
EXCEPTIONS
  NOTHING_FOUND = 1
  NO_AUTHORIZATION = 2
  INTERNAL_ERROR = 3.

IF SY-SUBRC = 0.
      IF H_PIC_CONTAINER IS INITIAL.
       CREATE OBJECT H_PIC_CONTAINER
           EXPORTING CONTAINER_NAME 'PHOTO'.
       CREATE OBJECT H_PICTURE EXPORTING PARENT = H_PIC_CONTAINER.
    ENDIF.

    CALL METHOD H_PICTURE->LOAD_PICTURE_FROM_URL
         EXPORTING URL    = URI
         IMPORTING RESULT = G_RESULT.

    CALL METHOD H_PICTURE->SET_DISPLAY_MODE
       EXPORTING DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_FIT_CENTER.
       CALL METHOD H_PICTURE->SET_DISPLAY_MODE
       EXPORTING DISPLAY_MODE = CL_GUI_PICTURE=>DISPLAY_MODE_FIT_CENTER.
      CALL METHOD CL_GUI_CFW=>FLUSH.

ELSEIF H_PICTURE IS NOT INITIAL.
        CALL METHOD H_PICTURE->CLEAR_PICTURE.
ENDIF.

ENDFORM.

 

Regards.

 

Decorate your Abap CODE with ASCII Art

Introduction to Jetform

$
0
0

What is Jetform?

  • Jetform is a print solution that replaces SAP script.
  • Produces output in many formats. i.e. PDF, HTML, etc.
  • The jetform Central is a server task listening for incoming data streams (this is outside of SAP)
  • The data stream is a spool file sent by SAP system. This data stream is merged with a layout form that stored on the jetform server and the merged data is sent to the printer.

 

Jetform concepts:

  • Jetform Central Server: A server task running on the Unix server. The Jetform Central will pick up the spool file coming from the SAP system, merge it with graphical layout (the design form) and send it to the appropriate printer.
  • Jetform data stream: A data stream is a spool file created by ABAP print program. The program will also send the data stream to appropriate jetform server. The data stream contains information concerning the design, printer and data to be printed on the output.
  • Jetform Designer - The graphical layout form: The jetform central merges the incoming data stream with corresponding layout. The (jetform) layout is a collection of fields. The corresponding values of field names within the data stream are placed in the layout and then sent to the printer. Boxes, logos and other design elements can also be placed on the form.

 

Putting it all together:

Jetform_1.png

  • The ABAP print program generates a spool file.
  • The spool contains the data stream which is sent to the Jetform Central server.
  • Jetform Central merges the data stream with the layout form.
  • The merged data is sent to the printer.

 

 

Jetform data stream

Jetform_2.png

  • The data stream is the spool file that is sent from SAP to the Jetform Central server.
  • It contains

            - The Printer name

            - The Form name

            - Data groups and field values


 

Jetform layout form

Jetform_3.png

  • Use the Jetform designer to create a Jetform layout form.
  • WYSIWYG designer
  • Design and test on your PC.
  • The compiled form is stored on the Jetform server.

 

 

Jetform development in IC

Following platforms supports Jetform architecture in Integrated Client (IC):

  • SAP R/3
  • Output Manager – Originally developed by Quest Software and now owned by Adobe.

 

 

Output Manager: Output manager is a server application that is connected to SAP to receive Datastream . The Output Manager processes the datastream and sends the formatted output to the printer. The format/design of the output is fetched from the Jetform Design File (.MDF).

Features of OM:

  • Guarantees end to end printing.
  • Foundation for all printing regardless of source, i.e.  SAP, Siebel, etc.
  • Enables redirection
  • Status communicated back to source i.e.  SP01 in SAP.
  • Integrates into monitoring software. e.g. Tivoli.

 

Landscape

Jetform_4.png

 

Jetform_5.png

 

Jetform development in IC: Which form to use?

 

  • Per Customer Facing Document (1 print program, 1 output type, multiple layouts).
  • Customizing tables to decide on the form.
  • Forms are stored within directory structures on the server. (e.g./JAPAN/INVOICE.mdf, /UK/INVOICE.mdf)

 

Jetform development in IC

  1. Build the data stream in SAP.
  2. Design the graphical layout form on your PC.
  3. Customize form selection in SAP (if needed).

Deploy the graphical layout form to the server

Jetform development in IC: Data Stream

Build the data stream in SAP

  • Identify the appropriate data stream.
  • Collect business requirements.
  • Compare with existing data stream to identify gaps.
  • Update the print program FD to change groups and fields.
  • TE updates the print program TD and completes development.
  • Test the data stream.


Jetform development in IC: Layout form

  • Design the graphical layout form on your PC.
  • Identify the default (IC) layout form for your data stream.
  • Download the form to your PC.
  • Modify the layout form.
  • Test locally on your PC – merge with a SAP spool file.


Jetform development in IC: Customizing

  • Form selection may depend on multiple parameters.
  • Example: Dunning notice
  • Generic one for the IC.
  • Generic one for your company code.
  • Special one for a specific customer.

 

Jetform development in IC: Deployment

  • Compile the layout form on your PC.
  • Contact BASIS to upload compiled form to the Jetform server.
  • Test !
  • Coordinate the datastream ABAP transports with migration of the Jetform layout forms.

OLE ABAP Code with Password Protected Excel Sheet

$
0
0

Objective


    • Password Store in ‘Y’ Table for the Respective User in Encrypted format .
    • To Export Excel Sheet with Password Protected(i.e. Decrypted format) both Cell and Worksheet.

 

 

  • Upload some User ID’s and it’s respective Password into Custom “Y” table.

 

S1.png

Screen Shot # 0

 

s1_1.png

Screen Shot # 1

 

User Name               : SMRUTI

Encrypted Password: QUJBUEA0MA==

Decrypted Password: ABAP@40

 

 

  • In your Custom Upload Program use below code for Encryption of Password , Which will store in above ‘Y’ Table.
    • Using CALL METHOD CL_HTTP_UTILITY=>IF_HTTP_UTILITY~ENCODE_BASE64 Encrypt the password text


s2.png

Screen Shot # 2

 

Note:

 

PASSWORD    : ABAP@40            ( Decrypted Password )

PASSWORD1  : QUJBUEA0MA== (Encrypted Password )

 

 

  • NowOLE ABAP Code using OLE2_OBJECT.

 

s3.png

Screen Shot # 3

 

s4.png

Screen Shot # 4

 

 

s5.png

Screen Shot # 5

 

Create Object for Excel using EXCEL.APPLICATION .

s6.png

Screen Shot # 6

 

 

s7.png

Screen Shot # 7

 

 

s8.png

Screen Shot # 8

 

 

S9.png

Screen Shot # 9

 

Using  CALL METHOD CL_GUI_FRONTEND_SERVICES=>CLIPBOARD_EXPORT to Clipboard.

 

S10.png

Screen Shot # 10

 

Using  CALL METHOD CL_HTTP_UTILITY=>IF_HTTP_UTILITY~DECODE_BASE64 decrypt the encrypted text (i.e. password) .

 

s11.png

Screen Shot # 11

 

 

  • Now Output

 

         Enter your Excel File Name with Path and User Name as a below Screen Shot.

        

        Note: If User Name in Lower Case then Click on Check box


s12.png

Screen Shot #12

 

 

After pressing Execute button or F8 Key you got Exported data( i.e. Password Protected ) in Excel Sheet , look as below Screen Shot .

 

s13.png

Screen Shot # 13

 

 

 

Now Check is your Worksheet, if you want to edit the Cell in work sheet then one password pop window show to ask for password Check below Screen Shot.

Here I want to edit the Division as Per below Screen Shot , then you see one Password Pop-up window appear for asking password , Until Correct Password you unable to edit the data

 

s14.png

Screen Shot # 14

 

 

Now I am try to enter wrong password see below screen shot.


s15.png

Screen Shot # 15


 

Reason of this below OLE ABAP Code line number 131 to 136 .

 

s16.png

Screen Shot # 16

 

 

Then I Enter Correct Password now Check below screen shot and now I am able to edit only where already data are available, mean within Range (i.e. A1:D11)


s17.png

Screen Shot # 17

 

 

Suppose you want add One row in Exported Excel Sheet that also protected by Password, Check below Screen Shot.

 

s18.png

Screen Shot # 18

 

 

Now you Un-Protect the Sheet using Un-protect Sheet in Review (i.e. here I using MS-Excel 2010)

 

s19.png

Screen Shot # 19

 

After pressing above Unprotected Sheet icon, then you pass password for Unprotected the Sheet.

 

S20.png

Screen Shot # 20

 

 

Reason of below OLE ABAP Code , Call below method "PROTECT" for Password

 

S21.png

Screen Shot # 21

 

 

S22.png

Screen Shot # 22

 

 

 

Note : Here i am using both Cell and Worksheet using one Password (i.e. fetch Encrypted Password from "Y" Table then Decrypt before assign to Excel Sheet ), you can take different password as per your requirement .

 

Source Code Available in Wiki link SAP Community Network Wiki - Code Gallery - ABAP - OLE2 Code with Dynamic Password Protected usin...

 

Regard's

Smruti

 




Comparison on LSMW and SAP PO - Middleware

$
0
0

Introduction

 

A brief comparison on LSMW, Interface and SAP PO - Middleware tool.

 

LSMW

 

Legacy System Migration Workbench (LMSW) as its name signifies is a SAP R/3 based tool which is used to transfer non-SAP ADHOC data into SAP. LSMW is a SAP tool designed to transfer non-SAP data into SAP once or to assist in the periodic mass-update of SAP Master Data. It requires a large amount of human input (i.e. it cannot directly interface with data sources and must be provided with an input file in a predefined format, it cannot automatically handle error conditions and must be re-run after manual amendments are made to the data in case of errors, and it cannot be scheduled on a recurring basis without custom development). Furthermore, there is no ability to monitor LSMWs in an automated way without manually checking each and every LSMW run. As a result, it is used for one-off data migration purposes or as a periodic business process to assist users in making large-scale updates to master data, but not as an integration tool between two systems and/or for processing transactional data.

 

The Legacy System Migration Workbench (LSMW) offers different technique for migrating data: Direct input, BAPI, IDOC, Batch Input Recording. While BDC basically uses batch input sessions and CALL TRANSACTION method.

 

BDC is the traditional way of coding transactions for uploading the legacy data, SAP is changing all transactions to Object oriented programming. Since BAPI is Object based and supports all the new transactions it is preferred over BDC. Moreover, BAPI’s processes data faster than BDC.

 

BAPI is a SAP-supplied function module with a defined interface, which allows you to interact with various business objects. SAP guarantees the integrity of your database for anything updated using a BAPI. BDC is a method of driving screens programmatically, for updating SAP data. BAPIs are generally faster than BDCs. .A BAPI is faster because it is updating the DB ""directly"". Whereas BDC with call transaction goes through the whole screen sequence like any user would do, simply put, fills screens.

 

However - there is not always a BAPI for a particular transaction and not all functions that are performed by a transaction can be done by a BAPI. BDCs produce error sessions which can be processed by the user, while BAPIs don't. It is recommended to choose the BAPI first, if there is no BAPI then go for BDC.

 

Interface

 

Interfaces are part of WRICEF - with the help of Interface the ECC system can communicate to other SAP and Non-SAP systems. An interface coordinates communication and input/output between systems that need to be linked together but reside on different operating systems; use different database solutions and different computer languages; or that are legacy systems that are no longer supported by the vendor, while at the same time avoiding having to make sweeping changes to the existing applications or data structures, all while ensuring business continuity.

 

SAP PO – Middleware

 

In SAP PO, the integration knowledge is shipped in the form of pre-defined integration scenarios. Furthermore, SAP PO provides a set of integrated tools for creating and managing all integration relevant information. The architecture focuses on the relevant application integration information centrally, with the usage type PI. The benefits of SAP PO are as follows:

 

·   * Message monitoring, trouble shooting, scheduling, error handling, governance, common data model, out of the box solution, performance monitoring, error monitoring

·   * Can integrate applications from one or multiple systems

·   * Applications can be company-internal, cross-company, SAP or non-SAP applications

·   * The modelling, administration, and automation of user-driven processes within SAP

·   * The process can be continued as a result of a particular action or event

·   * Execution of processes can be useful when integrating applications across system boundaries (without user actions), relevant functions within SAP are reused for this purpose and core function of the runtime is that it can save the state of a previously modelled process and call it up at a later stage

 

 

Comparision Table :

 

        Activities

           LSMW

              SAP PO

Message Monitoring

Very basic

Predelivered  message monitoring

SAP Vanilla

Custom code essential

( To map the source structure & target structure )

Custom code not needed- SAP ECC

Automation

Manual automation

Manual automation

Event or schedule automation

Performance

Slow

High

Prioritization

No

Yes

Mapping code

Yes

Cannot be used as common data model

Yes

Can use as common data model

Complex mapping

No

Yes

Error monitoring tool

No

Has  out of box solution

Archive

No

Yes

Action to BAPI

Indirect

Direct call

Action to IDOC

Indirect

Direct call

Action to programs

Indirect

Direct call

Action to BDC

Indirect

No

User log in

Need to have ECC access

Not necessary to have ECC access

Error log

Legacy way

Modern evolution technology

File serialization in chunks

No

Yes

BO Methods

Cannot use all the methods provided in a Business object through LSMW

Can access all the methods

Multiple data transfer

No

Yes

Import & export data

Only Import

Import & Export

Evolution

Legacy way

Modern way

 

 

 

 

Comparison Summary

 

LSMW, is a tool that supports data migration from legacy systems (non-SAP systems) to SAP systems in an initial load or ADHOC methodology.

 

The LSMW comprises the following main functions:

 

- Reads data (legacy data in spread sheet tables and/or sequential files)

- Converts data (from the source into the target format)

- Imports data (to the database used by the SAP application)

 

The LSMW supports a one-time transfer of data (initial data load and ADHOC) and also offers restricted support of permanent interfaces. The LSMW, however, does not include any functions for monitoring of permanent interfaces. The tool does not support any data export interfaces (outbound interfaces).

 

LSMW indirectly calls the BAPI, IDOC, Standard & customized SAP programs by means of customized code, whereas SAP PI directly calls BAPI, IDOC and SAP programs. Since the call is direct & meta data residences in the SAP PI, it is preferable to send the data to SAP ECC from SAP PI. Apart from that, SAP PI has an out of the box solution for error handling & monitoring, message and end to end data flow monitoring.

 

In SAP PI, the scheduling, holding and storing of the message is possible, whereas in LSMW it is not possible. In the case of BDC, the LSMW is a better way than SAP PI, considering the commit and transaction security.

 

Recommendation

- Usage of SAP PI, for persistent interfaces

-Usage of LSMW for only BDC programs and where initial and ADHOC is involved

Implementing the Customer-exit EXIT_SAPLKKAG_003 SAP ENHANCEMENT(KKAG0002)

$
0
0

Sometimes, the customer gives a unique requirement to substitute the Revenue accounts with cost accounts making all revenues to go to WIP(Work in Progress),whenever the sales order goes into release status.This user exit helps us to do so. For detailed description about the parameters, please check

the SAP Note 67423.

 

Please refer to the following implementation code for details:

 

 

 

 

image1.png

   image1.png

  •   The problem with this exit is that it is called repeatedly for each line item in the table export_cospa - which contains the entries to be changed.Therefore,    to  control its behavior it is required to keep a global variable g_count.

 

  • In this implementation, the customer exit substitutes all the revenue accounts , in the range 30000 to 39999 to cost account 40200.

Uploading font metrics using Load AFM File function

$
0
0

Uploading font metrics using Load AFM File function

 

Summary

The SAP system is delivered with the font metrics data that is required for all standard SAPscript forms. Sometimes we want to use a typeface that is not included in the SAP standards; in that case we need to upload font metrics data. There are two ways to upload font metrics.  Here am describing the step by step procedure to upload the font metrics using the method Load AFM File function.

 

Author: Abyson Joseph Chavara          

Company: Applexus Technologies (P) LTD       

Created on:  27 August 2013

   
 

Table of Contents

 

Introduction.

Methods for uploading font metrics.

Step by step procedure to upload the font metrics using Load AFM File function.
      Step 1: Copy the *.afm file(s)

      Step 2:  Create a font family.

      Step 3: Load AFM File.

      Step 4:  Setting Attributes.

      Step 5:  Generate font

      Step 6:  Repeat the upload procedure.

      Step 7:  Specify the print controls.

Copyright

 

Introduction

The SAP system is delivered with the font metrics data that is required for all standard SAPscript forms. If in some cases we want to use a typeface that is not included in the SAP standard or we need to create our own form and printing program to use your special typeface. In that cases we need to upload font metrics data. Uploading font metrics makes them available to SAPscript for filling text during output.

 

Methods for uploading font metrics

 

There are two ways to upload font metrics.  We can choose the method, depending on the type of font metrics information available with us.

 

Method 1: Load AFM File function

We can use this SAPscript Load AFM File function to upload the font metrics, if we have an .afm font metrics files in Adobe Font Metrics ASCII format.

 

Method 2: SAPLPD/RSTXLMET method

   We could use the SAPLPD/RSTXLMET method for uploading font metrics for any font that is installed in Microsoft Windows.

 

 

Here I am describing the steps in uploading font metrics using the method Load AFM File function.

 

 

Step by step procedure to upload the font metrics using Load AFM File function

 

To upload font metrics we need an .afm font metrics files in Adobe Font Metrics ASCII format.

 

Step1: Copy the *.afm file(s)

Copy the *.afm file(s) (ASCII format) to a directory that is accessible from the frontend computer you are working on.

 

Step2: Create a font family

Create a SAPscript font family for the font, if one does not already exist. Choose Administration >>CCMS >>Print >>Font Maintenance or run transaction SE73 and then Font Families and Change. Choose Create to add a new font family. You can use any name you want for the font family. Leave Substitute family fields blank unless there is an alternative SAP font family to this one. The substitute family is used in the event that this font is not defined in the target device type of an output request. For Character set, enter the number of the character set to use for printing this font. For example: enter 1705 for a printer that outputs Greek characters (see the screen shot below).

 

 

Step 3: Load AFM File

Return to the initial font maintenance screen. Choose Printer fonts and Change. Position the cursor on the device type (printer) for which the font metrics are intended. Here I have selected the device type 'ZCHE_09' which I have created before in SPAD. Choose Load AFM File, enter the path name of the .afm file in the upload dialog window, and choose Transfer to upload the file. The system asks you to create a transport request. Use this request to transport the new font to other SAP systems.

 

 

Step 4:  Setting Attributes

Fill out the fields in the dialog box displayed. Select the attributes (bold and italic) appropriate for the file you uploaded. For the font size, enter 000 if the font is to be used with the POST, SWIN, or HPL2 OTF drivers. 000 means that this font is scalable and these printers are all capable of using the AFM data to scale the font to any required size. For devices that use other OTF drivers (STN2 and so on), upload the AFM files separately for each font size that you need. For this, specify the actual font size. Finally, enter a unique name(s) for the print controls to be used to switch to this font in portrait and landscape mode. The names must have the format SF<xxx> and must be unique among the print controls for the current device type.

 

 

Click on the device type and press F2 to open the list of printer fonts. The new font that you have uploaded should appear in the list as shown below.

 

 

Step 5:  Generate font

 

Generate the font by choosing Edit >> Generate font.

 


 

If the system displays the message PostScript character xxxx is unknown, this means that the uploaded information included a character that SAP could not identify. Either delete this character from the uploaded font or substitute the character name that SAP uses for the character. 

 

Try to find the character among the characters supported by SAP. To display the SAP character definitions, create a new SAP session and run transaction SPAD. Then choose Full administration and SAP Characters (Screen shot shown below). Enter the character name xxxx (replace with name shown in the message) in the sap characters field and click display.

 

 

If you find an equivalent SAP character, then choose Edit metrics (red circled in the screen shot below) in the Change printer fonts screen.

 

 

 

The edit fontmetrics screen will be displayed as below. Replace the unknown original name of the character with the R/3 name. This makes the character printable from R/3.

 

 

 

If you do not find an equivalent character, then you must delete the unknown character from the uploaded font metrics. The character will not be printable from R/3. Choose Edit metrics from the Change printer fonts screen. Then delete the line that defines the character. Also reduce the number of characters that appears at the start of the AFM file.

 

Repeat this step until all unknown characters have been handled and the font has been successfully generated.

 

Step 6: Repeat the upload procedure

 

Repeat the upload procedure until you have added all of your *.afm files. You only need to create the font family once.

 

Step 7: Specify the print controls

 

Specify the print controls for switching to this font in portrait and landscape mode by choosing the Maint. Print control (red circled in the below screen shot).

 

 

Your font is now ready for use.

 

Thanks an Regards,

Abyson Joseph Chavara.

 

 

Copyright

© Copyright 2011 SAP AG. All rights reserved.

No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice.

Some software products marketed by SAP AG and its distributors contain proprietary software components of other software vendors.

Microsoft, Windows, Excel, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation.

IBM, DB2, DB2 Universal Database, System i, System i5, System p, System p5, System x, System z, System z10, System z9, z10, z9, iSeries, pSeries, xSeries, zSeries, eServer, z/VM, z/OS, i5/OS, S/390, OS/390, OS/400, AS/400, S/390 Parallel Enterprise Server, PowerVM, Power Architecture, POWER6+, POWER6, POWER5+, POWER5, POWER, OpenPower, PowerPC, BatchPipes, BladeCenter, System Storage, GPFS, HACMP, RETAIN, DB2 Connect, RACF, Redbooks, OS/2, Parallel Sysplex, MVS/ESA, AIX, Intelligent Miner, WebSphere, Netfinity, Tivoli and Informix are trademarks or registered trademarks of IBM Corporation.

Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.

Adobe, the Adobe logo, Acrobat, PostScript, and Reader are either trademarks or registered trademarks of Adobe Systems Incorporated in the United States and/or other countries.

Oracle is a registered trademark of Oracle Corporation.

UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group.

Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc.

HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C®, World Wide Web Consortium, Massachusetts Institute of Technology.

Java is a registered trademark of Sun Microsystems, Inc.

JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape.

SAP, R/3, SAP NetWeaver, Duet, PartnerEdge, ByDesign, SAP Business ByDesign, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and other countries.

Business Objects and the Business Objects logo, BusinessObjects, Crystal Reports, Crystal Decisions, Web Intelligence, Xcelsius, and other Business Objects products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of Business Objects S.A. in the United States and in other countries. Business Objects is an SAP company.

All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.

Copy the content dynamically between two dictionary tables (with backup)

$
0
0

Hi,

 

I attacha utility tocopy anycontents of adictionary tableto anotherin a dynamic way(common fieldsare insertedintodestination table). You have the optionto cleanthe target tableand make abackupof itbefore.

 

 

CODE:

 

*&---------------------------------------------------------------------*
*& REPORT  ZCOPY_TABLE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT ZCOPY_TABLE.

"CREATING A PIVOTTABLE IS:
"DEFINE THE FIELD SYMBOL THAT WILL CONTAIN THE INTERNAL TABLE
FIELD-SYMBOLS: <WA_TABLE_O>.
FIELD-SYMBOLS: <TBL_O> TYPE STANDARD TABLE.
FIELD-SYMBOLS: <WA_TABLE_D>.
FIELD-SYMBOLS: <TBL_D> TYPE STANDARD TABLE.

"DEFINES THE TYPE POINTER THAT WILL POINT TO THE INTERNAL TABLE

DATA: T_TABLE_O TYPE REF TO DATA.
DATA: WA_TABLE_O TYPE REF TO DATA.
DATA: G_NOMBRE_TABLE_O TYPE TABNAME16.

DATA: T_TABLE_D TYPE REF TO DATA.
DATA: WA_TABLE_D TYPE REF TO DATA.
DATA: G_NOMBRE_TABLE_D TYPE TABNAME16.

DATA: MSG TYPE STRING OCCURS 0 WITH HEADER LINE.
DATA: ANSWER TYPE STRING.
DATA: DBFIELDS TYPE STANDARD TABLE OF DBFIELD WITH HEADER LINE.
DATA: BEGIN OF DBFIELDS_AUX OCCURS 0.
DATA: NAME TYPE DBFIELD-NAME.
DATA: END OF  DBFIELDS_AUX.
DATA: DEF_PATH(50) TYPE C VALUE 'C:\'.

TYPE-POOLS: TRUXS.

SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-001.
   PARAMETERS: G_TABL_O TYPE TABNAME16.
   PARAMETERS: G_TABL_D TYPE TABNAME16.
   SELECTION-SCREEN SKIP 1.
   PARAMETERS: BACKUP AS CHECKBOX DEFAULT 'X'.
   PARAMETERS: P_FILE(128) TYPE C LOWER CASE.
   SELECTION-SCREEN SKIP 1.
   PARAMETERS: DEL_TABL AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK BL1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
  CALL FUNCTION 'WS_FILENAME_GET'
  EXPORTING
  DEF_FILENAME           = P_FILE
  DEF_PATH               = DEF_PATH
  MASK                   = ',*.*,*.*.'
  MODE                   = 'O'
  TITLE                  = 'SELECT PATH & FILENAME: '
  IMPORTING
  FILENAME               = P_FILE
  EXCEPTIONS
  INV_WINSYS             = 1
  NO_BATCH               = 2
  SELECTION_CANCEL       = 3
  SELECTION_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.

START-OF-SELECTION.

IF BACKUP IS NOT INITIAL AND P_FILE IS INITIAL.
   MESSAGE 'PLEASE FILL THE FILE PATH' TYPE  'I'.
   EXIT.
ENDIF.

IF G_TABL_D(1) NE 'Z'.
   MESSAGE 'ONLY TABLES Z IN TABLE DESTINATION' TYPE 'I'.
   EXIT.
ENDIF.

CREATE DATA T_TABLE_O TYPE STANDARD TABLE OF (G_TABL_O).
ASSIGN T_TABLE_O->* TO <TBL_O>.

CREATE DATA  WA_TABLE_O LIKE LINE OF <TBL_O>.
ASSIGN WA_TABLE_O->* TO <WA_TABLE_O>.

CREATE DATA T_TABLE_D TYPE STANDARD TABLE OF (G_TABL_D).
ASSIGN T_TABLE_D->* TO <TBL_D>.

CREATE DATA  WA_TABLE_D LIKE LINE OF <TBL_D>.
ASSIGN WA_TABLE_D->* TO <WA_TABLE_D>.

IF BACKUP IS NOT INITIAL.
   PERFORM BACKUP_TABLE.
ENDIF.

IF DEL_TABL IS NOT INITIAL.
    CONCATENATE 'CAN YOU DELETE CONTENT OF TABLE' G_TABL_D '?' INTO MSG SEPARATED BY SPACE.
    CALL FUNCTION 'POPUP_TO_CONFIRM'
      EXPORTING
*      TITLEBAR                    = ' '
*      DIAGNOSE_OBJECT             = ' '
        TEXT_QUESTION               = MSG
*      TEXT_BUTTON_1               = 'JA'(001)
*      ICON_BUTTON_1               = ' '
*      TEXT_BUTTON_2               = 'NEIN'(002)
*      ICON_BUTTON_2               = ' '
*      DEFAULT_BUTTON              = '1'
*      DISPLAY_CANCEL_BUTTON       = 'X'
*      USERDEFINED_F1_HELP         = ' '
*      START_COLUMN                = 25
*      START_ROW                   = 6
*      POPUP_TYPE                  =
*      IV_QUICKINFO_BUTTON_1       = ' '
*      IV_QUICKINFO_BUTTON_2       = ' '
     IMPORTING
       ANSWER                      = ANSWER
*    TABLES
*      PARAMETER                   =
*    EXCEPTIONS
*      TEXT_NOT_FOUND              = 1
*      OTHERS                      = 2
              .
    CLEAR MSG.
    IF ANSWER NE '1'.
      MESSAGE 'COPY HAS BEEN CANCELLED' TYPE 'I'.
      EXIT.
    ELSE.
      DELETE FROM (G_TABL_D).
      COMMIT WORK.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
ENDIF.

SELECT * FROM (G_TABL_O) INTO CORRESPONDING FIELDS OF TABLE <TBL_O>.
IF SY-SUBRC = 0.
   LOOP AT <TBL_O> INTO <WA_TABLE_O>. "ITERAMOS SOBRE LA TABLE ORIGEN
    MOVE-CORRESPONDING <WA_TABLE_O> TO <WA_TABLE_D>. "SE PASAN LOS CAMPOS AL WORK-AREA DE DESTINO(EN MI CASO SE PASABAN SÓLO CIERTOS CAMPO)
    INSERT INTO (G_TABL_D) VALUES <WA_TABLE_D>."SE INSERTA EN LA TABLE DE DICCIONARIO
    IF SY-SUBRC NE 0.
      CLEAR MSG.
      MOVE SY-TABIX TO MSG.
      CONCATENATE 'ERROR WHEN INSERT THE REGISTRY LINE:' MSG INTO MSG.
      APPEND MSG.
    ENDIF.
   ENDLOOP.
   LOOP AT MSG.
   WRITE: MSG.
   SKIP.
   ENDLOOP.
   IF MSG IS INITIAL.
     WRITE: 'ALL RECORDS ARE COPIED'.
   ENDIF.
ENDIF.

FORM BACKUP_TABLE.

SELECT * FROM (G_TABL_D) INTO CORRESPONDING FIELDS OF TABLE <TBL_D>.
IF SY-SUBRC NE 0.
   EXIT.
ENDIF.

MOVE G_TABL_D TO DBFIELDS_AUX-NAME.

CALL FUNCTION 'DB_GET_TABLE_FIELDS'
EXPORTING
   TABNAME = DBFIELDS_AUX-NAME
TABLES
   DBFIELDS = DBFIELDS.
IF SY-SUBRC = 0.
   LOOP AT DBFIELDS.
     MOVE DBFIELDS-NAME TO DBFIELDS_AUX.
     APPEND DBFIELDS_AUX.
   ENDLOOP.
ELSE.
   EXIT.
ENDIF.

IF <TBL_D> IS ASSIGNED.

  CALL FUNCTION 'WS_DOWNLOAD'
  EXPORTING
   FILENAME                      = P_FILE
   FILETYPE                      = 'DAT' " DAT OR ASCI
  TABLES
   DATA_TAB                      = <TBL_D>
   FIELDNAMES                    = DBFIELDS_AUX
  EXCEPTIONS
   FILE_OPEN_ERROR               = 1
   FILE_WRITE_ERROR              = 2
   INVALID_FILESIZE              = 3
   INVALID_TYPE                  = 4
   NO_BATCH                      = 5
   UNKNOWN_ERROR                 = 6
   INVALID_TABLE_WIDTH           = 7
   GUI_REFUSE_FILETRANSFER       = 8
   CUSTOMER_ERROR                = 9
   NO_AUTHORITY                  = 10
   OTHERS                        = 11
  .
  IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
  ELSE.
    MESSAGE 'FILE WAS SAVED' TYPE 'I'.
  ENDIF.
  ELSE.
    MESSAGE 'NO DATA' TYPE 'I'.
  ENDIF.
ENDFORM.

 

*****************

 

Best regards.

Julio.

Getting Started with SAP NetWeaver AS ABAP 7.4 SP03 on SAP HANA [Trial]

$
0
0

This guide describes how to set up your local environment for the SAP NetWeaver AS ABAP 7.4 SP03 on SAP HANA trial provided as virtual appliance by the SAP Cloud Appliance Library.

View this Document

Viewing all 935 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>