Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Zip Codes in SAP

Former Member
0 Kudos

Hi,

I have solved the problem where in the incoming flat file has no value for zip code... now my program picks up the country checks the postal length & insert that many no. of zero's & my record is able to go in SAP... but it failing for countries like Poland where the length is 6 but in the 3rd place it asks for a "-" other e.g. is US where the postal code length is 10 ... my prg put is '0000000000' ... but the record fails & asks for a "-" in 6th place... where in SAP can I get this info? which table does it store that for US in the 6th place a "-" should come ??....

Can anybody help me in this ??

Thank You,

SB.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Look at function module ADDR_POSTAL_CODE_CHECK. In there it checks for each postal country in a CASE statement. You can make your postal code to follow that format.

Search for 'CASE t005-landk' in there.

Srinivas

13 REPLIES 13

Former Member
0 Kudos

Hi ,

I have given the answer in the previous postings..

Any ways.check for the table T005 & field PRPLZ.It has definitions for the type of postal code.It doesnt specify regarding the '-' used in the postal codes,but tells you whether the postal code for any country is purely numeric or any character can be used or not.

0 Kudos

Ok Phani PRPLZ rule 9 may be applicable for me ... "Check against country specific edit format" ... but how do I use it in my logic saying if country is PL then in 3rd place put a "-" ??.... if country is US then "-" in 6th place...

0 Kudos

Hi ,

For that purpose use FM ADDR_POSTAL_CODE_CHECK.

Enter the Country & postal code.IF you enter any other character than '-',it will give you error saying the 6th character should be '-'.

ferry_lianto
Active Contributor
0 Kudos

Hi SB,

Try table T005 and T005T.

Hope this will help.

Regards,

Ferry Lianto

Former Member
0 Kudos

Look at function module ADDR_POSTAL_CODE_CHECK. In there it checks for each postal country in a CASE statement. You can make your postal code to follow that format.

Search for 'CASE t005-landk' in there.

Srinivas

0 Kudos

Hi Sri...

Currently this is what my code doing

  • Zip code length (check if street is not blank & zip code is blank)

IF T_INPUTFILE196(35) <> '/' AND T_INPUTFILE276(10) = '/'.

READ TABLE T_POSTCODE WITH KEY LAND1 = T_INPUTFILE+331(3).

IF SY-SUBRC = 0.

V_CTR = T_POSTCODE-LNPLZ.

ENDIF.

V_CTR = V_CTR - 1.

DO V_CTR TIMES.

CONCATENATE V_PC '0' INTO V_PC.

ENDDO.

condense v_pc no-gaps.

MOVE V_PC TO T_INPUTFILE+276(10).

So how do I use the FM that u have just suggested??

0 Kudos

I cannot tell much from this code as I don't know the definitions of the variables or how they are filled in, but what I told earlier is to look at that function module at the line mentioned. See how the checks are made and may be based on that you will come up with a common logic to format the postal code.

The function module checks the given postal code for valid format, but not the reverse way. It will not build the postal code for you.

How is your input? Please give an example of how the input postal code will be and how you want that to be converted.

0 Kudos

Well in my case if street values is coming from the inputfile & the zip code value is blank , then according to the configuration set here the vendor will not be updated in SAP ... the business wants this to be handled logically ... So currently my code picks up the LAND1 value checks the postal length and put that many number of zero's in the place where zipcode comes from the inputfile... my prg is failing where country like PL (poland) or KR (Korea) is coming ... now the error coming is "The postal code should have "-" in the 3rd place" (this error for PL) ... for KR The postal code should have "-" in the 4th place" ...

0 Kudos

If you look at the code between CASE and ENDCASE, you will understand what format each country is following. It gets little complicated with some coutries where it is just using some routine to check instead of a format. But here are the ones that do have a format.


    CASE t005-landk.      " T005 <-> postal_address-country !!
      WHEN 'CDN'.
        postal_codemask = 'ANA NAN   '.
      WHEN 'NL '.
        postal_codemask = 'NNNN BB   '.
      WHEN 'PL '.
        postal_codemask = 'NN-NNN    '.
      WHEN 'S  '.
        postal_codemask = 'NNN NN    '.
      WHEN 'ROK'.
        postal_codemask = 'NNN-NNN   '.
      WHEN 'SK '.
        postal_codemask = 'NNN NN    '.
      WHEN 'CZ '.
        postal_codemask = 'NNN NN    '.

I know that N is for numeric and A is for Alpha but I don't know what B stands for in the Netherland format.

0 Kudos

Actually the '-' is not important as long as you follow the length restrictions and the rule. The fields that are important in this are T005-LNPLZ and T005-PRPLZ. As long as you follow those rules, you should be fin.

For instance, for US it can be just 5 or 9 or 5-4. Any of these values will pass the test. Simlarly you need to find out all the combinations for each country. I don't think there is any easy way to format except hardcoding for each country.

0 Kudos

ANd how do I bring the effect of field PRPLZ in my code ??

0 Kudos

Has anyone run across any documentation that outlines all the various rules by country?

nils_buerckel
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

see http://en.wikipedia.org/wiki/List_of_postal_codes

Best regards,

Nils Buerckel