If  our application makes no use of the Business Address Services but you  still want  to have country-specific addresses, we must use ABAP coding to achieve  this. It  is possible to do this in the application program or in the  initialization  coding of the interface. 
Step  1: Go to  Transaction  SFP and Create an Interface. 
 
Step 2:    Define Import parameter under Form Interface. 
 IS_CUSTOMER_ID TYPE S_CUSTOMER
 IS_COUNTRY  TYPE LAND1   
 
Step 3:    Define Global Types under Global definition as shown below. 
TYPES:
 BEGIN OF ty_adr_printform_table_line,
   line_type      TYPE ad_line_tp,
   address_line LIKE adrs-line0,
END OF ty_adr_printform_table_line. TYPES:
   ty_adr_printform_table TYPE TABLE OF ty_adr_printform_table_line.
   
 
Step 4:    Define Global Work Areas and Internal  Tables under Global    definition as shown below. 
IS_ADDRESS   TYPE ADRS1.
IT_ADDRESS_LINES TYPE TY_ADR_PRINTFORM_TABLE.
IS_ADDRESS_LINE TYPE TY_ADR_PRINTFORM_TABLE_LINE.
IS_SCUSTOM  TYPE SCUSTOM. 
  
Step 5: Write the below code in code initialization part. Check for errors and activate the interface.
SELECT SINGLE *
 FROM  scustom
   INTO  is_scustom
WHERE id EQ is_customer_id. is_address-title_text = is_scustom-form.
is_address-name1 = is_scustom-name.
is_address-street = is_scustom-street.
is_address-po_box = is_scustom-postbox.
is_address-post_code1 = is_scustom-postcode.
is_address-city1 = is_scustom-city.
is_address-region = is_scustom-region.
is_address-country = is_scustom-country. * Address Format According to Post Office Guidelines
*  Note : Refer Function module documentation for more information. CALL FUNCTION 'ADDRESS_INTO_PRINTFORM'
 EXPORTING
     address_1  = is_address
     address_type = '1'            "normal/company
      sender_country = is_country
      number_of_lines = 8
IMPORTING
 address_printform_table = it_address_lines.
   
 
 
Step    6: Save  and activate    the interface.     
Step    7: Now  create the    form as shown below. 
 
Step 8: A    pop up window would appear where we need to assign the interface name to  form  and also the description of the form. Press Save button.
 
Step  9: In  Interface we    will find the data that was created in the interface. We need to drag  the    elements that need to be displayed in output into the content area. 

Step  10: In the  Layout  part of the form, Drag and drop the Address Field.
 
Step 11:  Drag the  static text  from the library into the form and provide the descriptions of the  fields.
 
Step  12: Set  the Border properties of Address text field as shown below.
  
 
Step   13: Set   the Object properties of Address text field as shown below.
 
Step  14: Wrap  the address field into Subform as shown below.
 
Step  15: Set  Body page Object properties as shown below.
  
 
Step   16: Set   Subform Object properties as shown below.
 
Step  17: Set  Subform Object properties as shown below.
 
Step 18: Save  and activate the form.
Step  19: Test  form, by  entering Customer id and Country.
  
 
Step   20:  Execute the  form. The output is as shown below: 



 Atom Feed (xml)
 Atom Feed (xml)
 

No comments:
Post a Comment