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: 

Getting error in Address .... Endaddress in sapscript

former_member589517
Participant
0 Kudos

Hi,

I am getting error at country command line i.e Parameter is too long : sin and it is ignoring country command line ...not printing country.so, suggest so that I can print country name.

/: ADDRESS DELIVERY PARAGRAPH AS

/: TITLE &LFA1-ANRED&

/: NAME &LFA1-NAME1&, &LFA1-NAME2&,

/: STREET &LFA1-STRAS&

/: POBOX &LFA1-PFACH& CODE &LFA1-PSTL

/: CITY &LFA1-ORT01&, &LFA1-ORT02&

/: POSTCODE &LFA1-PSTLZ&

/ :REGION &LFA1-REGIO&

/: IF &NAST-KSCHL& EQ 'NEU'

/: COUNTRY &T005T-LANDX&

/: ELSE

/: COUNTRY &LFA1-LAND1&

/: ENDIF

/: FROMCOUNTRY &ADRC-COUNTRY&

/: ENDADDRESS

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

You can't put the IF ENDIF within the ADDRESS and ENDADDRESS in SAPscript. You need something like;

/: IF &NAST-KSCHL& EQ 'NEU'

/: ADDRESS DELIVERY PARAGRAPH AS

/: TITLE &LFA1-ANRED&

/: NAME &LFA1-NAME1&, &LFA1-NAME2&,

/: STREET &LFA1-STRAS&

/: POBOX &LFA1-PFACH& CODE &LFA1-PSTL

/: CITY &LFA1-ORT01&, &LFA1-ORT02&

/: POSTCODE &LFA1-PSTLZ&

/ :REGION &LFA1-REGIO&

/: COUNTRY &T005T-LANDX&

/: FROMCOUNTRY &ADRC-COUNTRY&

/: ENDADDRESS

/: ELSE

/: ADDRESS DELIVERY PARAGRAPH AS

/: TITLE &LFA1-ANRED&

/: NAME &LFA1-NAME1&, &LFA1-NAME2&,

/: STREET &LFA1-STRAS&

/: POBOX &LFA1-PFACH& CODE &LFA1-PSTL

/: CITY &LFA1-ORT01&, &LFA1-ORT02&

/: POSTCODE &LFA1-PSTLZ&

/ :REGION &LFA1-REGIO&

/: COUNTRY &LFA1-LAND1&

/: FROMCOUNTRY &ADRC-COUNTRY&

/: ENDADDRESS

/: ENDIF

Not very elegant I know, but this is SAPscript after all.

Regards,

Nick

8 REPLIES 8

manthanraja
Active Participant
0 Kudos

Try using LAND1 instead of LANDX .

even in case of the first landx .. (the one used with if)

That will solve your problem ..

BR

Manthan Raja

Former Member
0 Kudos

Hi,

You can't put the IF ENDIF within the ADDRESS and ENDADDRESS in SAPscript. You need something like;

/: IF &NAST-KSCHL& EQ 'NEU'

/: ADDRESS DELIVERY PARAGRAPH AS

/: TITLE &LFA1-ANRED&

/: NAME &LFA1-NAME1&, &LFA1-NAME2&,

/: STREET &LFA1-STRAS&

/: POBOX &LFA1-PFACH& CODE &LFA1-PSTL

/: CITY &LFA1-ORT01&, &LFA1-ORT02&

/: POSTCODE &LFA1-PSTLZ&

/ :REGION &LFA1-REGIO&

/: COUNTRY &T005T-LANDX&

/: FROMCOUNTRY &ADRC-COUNTRY&

/: ENDADDRESS

/: ELSE

/: ADDRESS DELIVERY PARAGRAPH AS

/: TITLE &LFA1-ANRED&

/: NAME &LFA1-NAME1&, &LFA1-NAME2&,

/: STREET &LFA1-STRAS&

/: POBOX &LFA1-PFACH& CODE &LFA1-PSTL

/: CITY &LFA1-ORT01&, &LFA1-ORT02&

/: POSTCODE &LFA1-PSTLZ&

/ :REGION &LFA1-REGIO&

/: COUNTRY &LFA1-LAND1&

/: FROMCOUNTRY &ADRC-COUNTRY&

/: ENDADDRESS

/: ENDIF

Not very elegant I know, but this is SAPscript after all.

Regards,

Nick

former_member589517
Participant
0 Kudos

Hi,

Thanks for the reply...

Actually full code of that window is as follows : I have added that if ....endif code in both part ,if I again do this for NEU ouput type then the code will be very big. any suggestion pls...

/: IF &LFA1-KTOKK& EQ 'CPD'

/: ADDRESS

/: TITLE &ADRC-TITLE&

/: NAME &ADRC-NAME1&, &ADRC-NAME2&, &ADRC-NAME3&

/: STREET &ADRC-STREET& HOUSE &ADRC-HOUSE_NUM1&

/: POBOX &ADRC-PO_BOX& CODE &ADRC-CITY_CODE2&

/: CITY &ADRC-CITY1&, &ADRC-CITY2&

/: POSTCODE &ADRC-POST_CODE1&

/: IF &NAST-KSCHL& EQ 'NEU'

/: COUNTRY &T005T-LANDX&

/: ELSE

/: COUNTRY &ADRC-COUNTRY&

/: ENDIF

/: REGION &ADRC-REGION&

/: ENDADDRESS

/: ELSE

/: ADDRESS DELIVERY PARAGRAPH AS

/: TITLE &LFA1-ANRED&

/: NAME &LFA1-NAME1&, &LFA1-NAME2&, &LFA1-NAME3&, &LFA1-NAME4&

/: STREET &LFA1-STRAS&

/: POBOX &LFA1-PFACH& CODE &LFA1-PSTL2&

/: CITY &LFA1-ORT01&, &LFA1-ORT02&

/: POSTCODE &LFA1-PSTLZ&

/: REGION &LFA1-REGIO&

/: IF &NAST-KSCHL& EQ 'NEU'

/: COUNTRY &T005T-LANDX&

/: ELSE

/: COUNTRY &LFA1-LAND1&

/: ENDIF

/: FROMCOUNTRY &ADRC-COUNTRY&

/: ENDADDRESS

/: Endif.

0 Kudos

Hi,

You could try something like this;

/: IF &NAST-KSCHL& EQ 'NEU'

/: DEFINE &LAND1&=&T005T-LANDX&

/: ELSE

/: DEFINE &LAND1&=&ADRC-COUNTRY&

/: ENDIF

/: IF &LFA1-KTOKK& EQ 'CPD'

/: ADDRESS

/: TITLE &ADRC-TITLE&

/: NAME &ADRC-NAME1&, &ADRC-NAME2&, &ADRC-NAME3&

/: STREET &ADRC-STREET& HOUSE &ADRC-HOUSE_NUM1&

/: POBOX &ADRC-PO_BOX& CODE &ADRC-CITY_CODE2&

/: CITY &ADRC-CITY1&, &ADRC-CITY2&

/: POSTCODE &ADRC-POST_CODE1&

/: COUNTRY &LAND1&

/: REGION &ADRC-REGION&

/: ENDADDRESS

/: ELSE

/: IF &NAST-KSCHL& EQ 'NEU'

/: DEFINE &LAND1&=&T005T-LANDX&

/: ELSE

/: DEFINE &LAND1&=&&LFA1-LAND1&

/: ENDIF

/: ADDRESS DELIVERY PARAGRAPH AS

/: TITLE &LFA1-ANRED&

/: NAME &LFA1-NAME1&, &LFA1-NAME2&, &LFA1-NAME3&, &LFA1-NAME4&

/: STREET &LFA1-STRAS&

/: POBOX &LFA1-PFACH& CODE &LFA1-PSTL2&

/: CITY &LFA1-ORT01&, &LFA1-ORT02&

/: POSTCODE &LFA1-PSTLZ&

/: REGION &LFA1-REGIO&

/: COUNTRY &LAND1&

/: FROMCOUNTRY &ADRC-COUNTRY&

/: ENDADDRESS

/: Endif.

Regards,

Nick

Edited by: Nick Young on Mar 3, 2010 1:42 PM

former_member589517
Participant
0 Kudos

Hi,

I tried the above one but giving the same error :

An error occurred in the text command COUNTRY. A parameter is too long.

System Response

The command line was ignored.

in degugiing I see that when control comes to That COUNTRY command error triggers....

I appretiate for reply....

former_member589517
Participant
0 Kudos

Hi ,

I came to know one more thing that for some PO's the country text(country name) is coming but don't know how because the window doesn't contain any country text field but it contains only country key field i.e under command COUNTRY &lfa1-land1& or &adrc-country& .the window code as follows.

/: IF &LFA1-KTOKK& EQ 'CPD'

/: ADDRESS

/: TITLE &ADRC-TITLE&

/: NAME &ADRC-NAME1&, &ADRC-NAME2&, &ADRC-NAME3&, &ADRC-NAME4&

/: STREET &ADRC-STREET& HOUSE &ADRC-HOUSE_NUM1&

/: POBOX &ADRC-PO_BOX& CODE &ADRC-CITY_CODE2&

/: CITY &ADRC-CITY1&, &ADRC-CITY2&

/: POSTCODE &ADRC-POST_CODE1&

/: COUNTRY &ADRC-COUNTRY&

/: REGION &ADRC-REGION&

/: ENDADDRESS

/: ELSE

/: ADDRESS DELIVERY PARAGRAPH AS

/: TITLE &LFA1-ANRED&

/: NAME &LFA1-NAME1&, &LFA1-NAME2&, &LFA1-NAME3&, &LFA1-NAME4&

/: STREET &LFA1-STRAS&

/: POBOX &LFA1-PFACH& CODE &LFA1-PSTL2&

/: CITY &LFA1-ORT01&, &LFA1-ORT02&

/: POSTCODE &LFA1-PSTLZ&

/: REGION &LFA1-REGIO&

/: COUNTRY &LFA1-LAND1&

/: FROMCOUNTRY &ADRC-COUNTRY&

/: ENDADDRESS

/: ENDIF.

former_member589517
Participant
0 Kudos

Hi,

As I mentioned above below is the code which prints the address on PO,but for some PO country name is coming on PO and for some PO the country name is not coming. there is no variable or field between ADDRESS and ENDADDRESS which holds country name.one thing I found that if FROMCOUNTRY and COUNTRY keys are same then it won't print country name but I check that one PO where both are different though it is not printing country name and for other PO both counties keys are differnt for this country name is printing.

case1:country keys( ex: FROMCOUNTRY= CH and COUNTRY = IT ) are different,case2 : country keys are same .For case two I added the perform works fine see at the last of code.

the problem is CASE1 where if I code it will print country name two times ( one because of code and other automaticallyfor some PO and one time for some PO.if I donot code it does not at all print the country name for some PO.

My question :Is there any configuration or something based on the country key which is maintained in SAP,so whenever it calls this ADDRESS ENDADDRESS it checks and print country name?

if it is not what would be the cause of not printing country name?

/: IF &LFA1-KTOKK& EQ 'CPD'

/: ADDRESS

/: TITLE &ADRC-TITLE&

/: NAME &ADRC-NAME1&, &ADRC-NAME2&, &ADRC-NAME3&, &ADRC-NAME4&

/: STREET &ADRC-STREET& HOUSE &ADRC-HOUSE_NUM1&

/: POBOX &ADRC-PO_BOX& CODE &ADRC-CITY_CODE2&

/: CITY &ADRC-CITY1&, &ADRC-CITY2&

/: POSTCODE &ADRC-POST_CODE1&

/: COUNTRY &ADRC-COUNTRY&

/: REGION &ADRC-REGION&

/: ENDADDRESS

/: ELSE

/: ADDRESS DELIVERY PARAGRAPH AS

/: TITLE &LFA1-ANRED&

/: NAME &LFA1-NAME1&, &LFA1-NAME2&, &LFA1-NAME3&, &LFA1-NAME4&

/: STREET &LFA1-STRAS&

/: POBOX &LFA1-PFACH& CODE &LFA1-PSTL2&

/: CITY &LFA1-ORT01&, &LFA1-ORT02&

/: POSTCODE &LFA1-PSTLZ&

/: REGION &LFA1-REGIO&

/: COUNTRY &LFA1-LAND1&

/: FROMCOUNTRY &ADRC-COUNTRY&

/: ENDADDRESS

/: ENDIF

/: IF &NAST-KSCHL& EQ 'NEU'

/: PERFORM ERS_INVOICE IN PROGRAM ZYFI_COUNTRY_NAME

/: USING &LFA1-LAND1&

/: USING &ADRC-COUNTRY&

/: USING &NAST-SPRAS&

/: CHANGING &H_TEXT&

/: ENDPERFORM

M1 &H_TEXT&

/: ENDIF

former_member589517
Participant
0 Kudos

I would appreciate for any reply to this problem.waiting for the guidence