Issue related to ADDRESS ... ENDADDRESS in SAP Script
Hi All,
I have a issue using ADDRESS .... ENDADDRESS in SAP Script.
ADDRESS PARAGRAPH AS
TITLE &WA_LFA1-ANRED&
NAME &WA_LFA1-NAME1&, &WA_LFA1-NAME2&
STREET &WA_LFA1-STRAS& HOUSE &WA_ADRC2-STR_SUPPL3&
POBOX &WA_LFA1-PFACH& CODE &WA_LFA1-PSTL2&
CITY &WA_LFA1-ORT01&, &WA_LFA1-ORT02&
POSTCODE &WA_LFA1-PSTLZ&
COUNTRY &WA_LFA1-LAND1&
REGION &WA_LFA1-REGIO&
FROMCOUNTRY &WA_T001-LAND1&
ENDADDRESS
I am using above code for printing vendor address.
Though Name3 & Name4 are not declared but their values are getting displayed if value is available.
Though Street2, Street3 are not declared but their values are getting displayed if value is available.
Even title should not be displayed if available also.
I want only below fields to be displayed:
Name 1
Name 2
Street/House Number
Street 4
Postal Code/City
Country Name (This one declared below ADDRESS ... ENDADDRESS)
I don't want to dislay other fields if they have value also.
How it is possible!
Thanks in advance.
Thanks,
Deep.
Hi Deep,
Basically the variables that u havent mentioned in the sap script will never be printed.
In the code u have not mentioned the variables Name3, Name4, Street2, Street3...so they will never be displayed.
Please check your code again...i think somewhere u must have written
&WA_LFA1-NAME3&
&WA_LFA1-NAME3&
etc
if so please remove them. Otherwise the code u have written is perfectly fine.
or else in ur driver program, dont move all the values to workarea...move only the values that u need to display and use them in ur script.
Regards,
Radhika
Similar Messages
-
Regarding Address EndAddress in SAP Script
<i>Hi Abapers,
I am having a problem while displaying the address in SAP Script through Address EndAddress.
Problem is it is displaying the data correctly but it display the Region Code. Now the requirement is to display the Region Description instead of the Region Code.
Can you please provide me any solution for this.
I am sending the Address EndAddress which I have written in my code.</i>
/: ADDRESS DELIVERY PARAGRAPH ZC
/: NAME &VBDKL-ZBTNAME1&, &VBDKL-ZBTNAME2&, &VBDKL-ZBTNAME3&, &VBDKL-
/: STREET &VBDKL-ZBTSTRAS&
/: CITY &VBDKL-ZBTORT01&, &VBDKL-ZBTORT02&
/: POSTCODE &VBDKL-ZBTPSTLZ&
/: COUNTRY &VBDKL-ZBTSLAND&
/: REGION &VBDKL-ZBTREGIO&
/: FROMCOUNTRY &VBDKL-ZBTLLAND&Hi
ADDRESS and ENDADDRESS is used to specify the address which will
be formatted according to the target country i.e the recipient country.
e.g. /:ADDRESS sales PARAGRAPH C
/:NAME &KNA1-NAME1&
/:STREET &KNA1-STRAS&
/:POSTCODE &KNA1-PSTLZ&
/:CITY &KNA1-ORT01&
/:COUNTRY &KNA1-LAND1&
/:FROMCOUNTRY 'DE'
formatting address
http://help.sap.com/saphelp_46c/helpdata/en/d1/803238454211d189710000e8322d00/frameset.htm
http://help.sap.com/saphelp_40b/helpdata/en/d1/803238454211d189710000e8322d00/content.htm
<b>Reward if usefull</b> -
Address -Endaddress in Sap Script
Hi
Requirement is to add District field in new line in SAP Script.
I am using Address End address :
/: ADDRESS
/: TITLE &DKADR-ANRED&
/: NAME &DKADR-NAME1&, &DKADR-NAME2&, &DKADR-NAME3&, &DKADR-NAME4&
/: STREET &DKADR-STRAS&
/: POBOX &DKADR-PFACH& CODE &DKADR-PSTL2&
/: CITY &DKADR-ORT02& , &DKADR-ORT01&
/: POSTCODE &DKADR-PSTLZ&
/: COUNTRY &DKADR-LAND1&
/: REGION &DKADR-REGIO&
/: FROMCOUNTRY &DKADR-INLND&
/: ENDADDRESS
So basically I would like to put &DKADR-ORT02& in new line.
I cannot use District field.If I use CITY field again it is not showing the value.
How do we add this new field?Try like this not sure it will work or not.
/: ADDRESS
/: TITLE &DKADR-ANRED&
/: NAME &DKADR-NAME1&, &DKADR-NAME2&, &DKADR-NAME3&, &DKADR-NAME4&
/: STREET &DKADR-STRAS&
/: POBOX &DKADR-PFACH& CODE &DKADR-PSTL2&
<b>/: CITY &DKADR-ORT02&</b>
<b>/: CITY &DKADR-ORT01&</b>
/: POSTCODE &DKADR-PSTLZ&
/: COUNTRY &DKADR-LAND1&
/: REGION &DKADR-REGIO&
/: FROMCOUNTRY &DKADR-INLND&
/: ENDADDRESS
Regards,
SaiRam -
How to add field on into standard address window in SAP script
Hello Exports,
I want to add Vendor number field in between the Vendor name and vendor address in the address window in sap script.
Address is written in standard Address and Entendres. I need to add the vendor number in thsi Address and Endaddress.
Please guide in this.goto the Vendor Name field .
Hit enter.
A new line is created.
Give your Vendor Num field there.
Bhupal -
How ADDRESS-ENDADDRESS works in script
Hi experts,
Could you please throw some light on how ADDRESS-ENDADDRESS works in script.
Please let me know how the following code executes and what is the impact of the FROMCOUNTRY statemnet in that code . Also le tne know various other options it has:
ADDRESS DELIVERY PARAGRAPH AS
ADDRESSNUMBER &PEKKO-ADRN2(K)&
FROMCOUNTRY &LFA1-LAND1&
ENDADDRESS
Thanks in advance.
Br
RamCheck the link for format
http://help.sap.com/saphelp_47x200/helpdata/en/d1/80318f454211d189710000e8322d00/frameset.htm
The SAP function module ADDRESS_INTO_PRINTFORM gets called
Check its documentation in SE37
This will help!
Regards,
Prashant -
Problem in address printing in sap script in Russian language
hi all
I am trying to get a PO output using a sap script. The problem is that the vendor address in not coming in the required Russian language. The language in PO is Russian and the logon langauge is also Russian.
The script uses ADDRESS ENDADDRESS statement to print the address in form. This statement
uses the function module ADDRESS_INTO_PRINTFORM to print the address. The address can be obtained in the required language from this function module but I want the address in Russian language uses the ADDRESS ENDADDRESS statement.
Please let me know if any body has faced this kind of problem earlier.
Thanks.Hi,
pls check that u have provided the following parameters in ADDRESS ENDADDRESS.
/:address
/:COUNTRY recipient country [language code]
/: COUNTRY_IN_REC_LANG
/: LANG_FOR_COUNTRY language key
/:endaddress
language codes can be know in table T002.
Hopes this helps!!
thanks -
Dear All,
As per current layout already printing / display below information .
Name Already Printing
Street/House Already Printing
District Already Printing
City Already Printing
Region Already Printing
Post Code Already Printing
now I want
Name Already Printing
Street/House Already Printing
Street2 Need To Print
Street3 Need To Print
District Already Printing
City Already Printing
Region Already Printing
Post Code Already Printing
I have selected the data from adrc table.and it is selecting properly.
Now I have wrote in adress window is
street2 &adrc-str_suppl1&
street3 &adrc-str_suppl2&
but it is not printing in form.
when i debugg it. It shows ;TEXT command street2 stree3 is not defined.
please tell me what should i do?Hi
In SAP address details can be set in the minutest way but everything is not displayed while useing ADDRESS and ENDADDRESS because it gives priorities to fields. e.g. it will not display street or ther things if POBOX is given. These setting can be changed where you maintain the address. One method to solve your peoblem if you are using ADDESS and ENDADDRESS is to use LOCATION just before STREET field.
where you can assign Street to LOCATION and street2 to STREET.
Try if it solves your problem.
regards
Vijai -
Query related to alv grid and sap script
Hi All,
I have a requirement where i should read the values which are selected on the alv grid list output and those values i need to display on the script(layout).
Help me out guru's its an urgency...
thanks in advance .
regards
ravi ganjiHi Ravi,
I have done it exactly like your requirement. This program contains ALV and Smartform.
But whatever may be, both are layouts and having driver program. So just finish your driver program and Script layout and then use this program.
I have written this code to print contact letters from VA42. So, modify this code to insert your transaction code.
Let me know if you have any questions.
Here is the code.
REPORT ILETTER MESSAGE-ID CM.
TYPE POOLS (ALV)
TYPE-POOLS:
slis.
Customized Types
TYPES:
BEGIN OF ty_cntrt,
box(1) TYPE c,
kunnr TYPE kunag,
vbeln TYPE vbeln_va,
vbeln1 TYPE vbeln_va,
vposn TYPE posnr,
vuntdat TYPE vudat_veda,
vbegdat TYPE vbdat_veda,
vdemdat TYPE vddat_veda,
venddat TYPE vndat_veda,
END OF ty_cntrt,
single line TYPES
BEGIN OF ty_vkorg,
vkorg TYPE vkorg,
END OF ty_vkorg.
Constants
CONSTANTS:
c_sform TYPE char10 VALUE 'SMARTFORMS',
c_tcode TYPE sy-tcode VALUE 'VA42',
c_mode TYPE c VALUE 'N',
c_updat TYPE c VALUE 'A',
c_batch TYPE sy-callr VALUE 'BATCH',
c_dclick TYPE char10 VALUE '&IC1'.
Internal tables
DATA: it_cntrt TYPE TABLE OF ty_cntrt,
it_bdc TYPE TABLE OF bdcdata,
it_mesg TYPE TABLE OF bdcmsgcoll,
it_const TYPE TABLE OF /SIE/SSG_XCM_CUC,
it_vkorg TYPE TABLE OF ty_vkorg.
Work areas
DATA: wa_cntrt TYPE ty_cntrt,
wa_bdc TYPE bdcdata,
wa_const TYPE /SIE/SSG_XCM_CUC,
w_vbak TYPE vbak,
w_veda TYPE veda,
w_xcm_pr TYPE /sie/ssg_xcm_pr,
w_vkorg TYPE ty_vkorg.
Variables
DATA: l_repid TYPE sy-repid,
l_vakey TYPE vakey,
l_variant TYPE varid-variant,
l_vbeln TYPE i,
l_vkorg TYPE i,
l_vkbur TYPE i,
l_vkgrp TYPE i,
l_ckappl(40) TYPE c,
l_ckschl(40) TYPE c,
l_cauart(40) TYPE c.
Program Constants
DATA: c_kappl TYPE kappl,
c_kschl TYPE kschl,
c_auart TYPE auart,
c_repco TYPE /sie/ssg_xcm_const,
c_value TYPE /sie/ssg_xcm_value.
ALV data declarations
DATA:
gt_fieldcat TYPE slis_t_fieldcat_alv,
gt_tab_group TYPE slis_t_sp_group_alv,
gs_layout TYPE slis_layout_alv,
gs_repid TYPE sy-repid,
gs_sort TYPE TABLE OF slis_sortinfo_alv.
Selection screen
SELECTION-SCREEN BEGIN OF BLOCK indletter WITH FRAME TITLE text-001.
skip one line
SELECTION-SCREEN SKIP.
SELECT-OPTIONS:
contract
so_vbeln FOR w_vbak-vbeln,
category
so_auart FOR w_vbak-auart NO-DISPLAY,
Sales Org
so_vkorg FOR w_vbak-vkorg OBLIGATORY,
Dis Channel
so_vtweg FOR w_vbak-vtweg,
Division
so_spart FOR w_vbak-spart,
Sales Group
so_vkgrp FOR w_vbak-vkgrp,
Sales Office
so_vkbur FOR w_vbak-vkbur OBLIGATORY,
Cancellation Procedure
so_vkues FOR w_veda-vkuesch OBLIGATORY,
Contract Signed Date
so_vuntd FOR w_veda-vuntdat,
created by
so_ernam FOR w_vbak-ernam,
Fixed Indexation formula
so_fnum FOR w_xcm_pr-fnum OBLIGATORY.
skip one line
SELECTION-SCREEN SKIP.
Indexation letter
PARAMETERS: rb_index RADIOBUTTON GROUP radi USER-COMMAND usr.
Follow up report
PARAMETERS: rb_follo RADIOBUTTON GROUP radi.
skip one line
SELECTION-SCREEN SKIP.
Manual processing checkbox
PARAMETERS: p_manpr AS CHECKBOX.
SELECTION-SCREEN END OF BLOCK indletter.
Printer block
SELECTION-SCREEN BEGIN OF BLOCK blk_par WITH FRAME TITLE text-002.
Printer
PARAMETERS: p_print LIKE nast-ldest DEFAULT 'LOCL' OBLIGATORY.
SELECTION-SCREEN END OF BLOCK blk_par.
User selection data validation
AT SELECTION-SCREEN ON so_vkorg.
Ragne for sales org
RANGES: r_vkorg FOR vbak-vkorg.
REFRESH: it_const, r_vkorg.
CLEAR wa_const.
Proceed for execution only for Sales Orgs in /SIE/SSG_XCM_CUC
LOOP AT so_vkorg.
r_vkorg-sign = 'I'.
r_vkorg-option = 'EQ'.
r_vkorg-low = so_vkorg-low.
APPEND r_vkorg.
Check Sales Org intervals entered in the selection screen
IF NOT so_vkorg-high IS INITIAL.
Get all Sales Org for interval
SELECT vkorg FROM tvko INTO TABLE it_vkorg
WHERE vkorg BETWEEN so_vkorg-low AND so_vkorg-high.
IF sy-subrc = 0.
Add all Sales org into one internal table
LOOP AT it_vkorg INTO w_vkorg.
r_vkorg-low = w_vkorg-vkorg.
APPEND r_vkorg.
CLEAR: w_vkorg.
ENDLOOP.
delete repeated records
DELETE ADJACENT DUPLICATES FROM r_vkorg COMPARING low.
ENDIF.
ENDIF.
CLEAR r_vkorg.
ENDLOOP.
Get Sales Org entries maintained in /SIE/SSG_XCM_CUC
l_repid = sy-repid.
Check Sales Org is maintained for Renewal Letter?
LOOP AT r_vkorg.
concatenate constant with Sales Org
CONCATENATE 'INX_LETTER_CREATE_' r_vkorg-low INTO c_repco.
Get constant
SELECT SINGLE value
FROM /sie/ssg_xcm_cuc
INTO c_value
WHERE repid = l_repid
AND const = c_repco
AND vkorg EQ so_vkorg-low.
Check alerady maintained?
IF sy-subrc <> 0 OR
( sy-subrc = 0 AND c_value <> 'X' ).
Issue massage 'Sales Org no permitted for renewal Letter'.
MESSAGE E012.
CLEAR: c_repco, r_vkorg.
EXIT.
ENDIF.
CLEAR: c_repco, r_vkorg.
ENDLOOP.
AT SELECTION-SCREEN.
Read single Sales Org
READ TABLE so_vkorg INDEX 1.
IF sy-subrc = 0.
CLEAR: l_ckappl, l_ckschl, l_cauart, c_kappl, c_kschl, c_auart.
for application
CONCATENATE 'INX_LETTER_V1_' so_vkorg-low INTO l_ckappl.
for output type
CONCATENATE 'INX_LETTER_Y6C4_' so_vkorg-low INTO l_ckschl.
document type
CONCATENATE 'INX_LETTER_AUART_' so_vkorg-low INTO l_cauart.
Get application
SELECT SINGLE value FROM /sie/ssg_xcm_cuc
INTO c_kappl WHERE repid = sy-repid AND const LIKE l_ckappl.
Get output type
SELECT SINGLE value FROM /sie/ssg_xcm_cuc
INTO c_kschl WHERE repid = sy-repid AND const LIKE l_ckschl.
Get document type
SELECT SINGLE value FROM /sie/ssg_xcm_cuc
INTO c_auart WHERE repid = sy-repid AND const LIKE l_cauart.
ENDIF.
find no of Sales org entries entered in the selection screen
DESCRIBE TABLE so_vkorg LINES l_vkorg.
find no of Sales office entries entered in the selection screen
DESCRIBE TABLE so_vkbur LINES l_vkbur.
find no of Sales Group entries entered in the selection screen
DESCRIBE TABLE so_vkgrp LINES l_vkgrp.
Check if enterred more than one entry
IF l_vkorg = 1 AND l_vkbur = 1.
add Sales Org, Sales office, Sales group for key
IF NOT so_vkgrp[] IS INITIAL.
CONCATENATE so_vkorg-low so_vkbur-low so_vkgrp-low INTO l_vakey.
ELSE.
CONCATENATE so_vkorg-low so_vkbur-low '%' INTO l_vakey.
ENDIF.
CONDENSE l_vakey.
Get printer name for selection.
SELECT SINGLE ldest FROM nach INTO p_print
WHERE kappl = c_kappl AND kschl = c_kschl AND vakey LIKE l_vakey.
ENDIF.
Manual processing is possible for Renewal Letter in advance only
IF p_manpr = 'X' AND rb_follo = 'X'.
MESSAGE E017.
ENDIF.
Main Processing
START-OF-SELECTION.
Check for the Follow up report
IF rb_follo = 'X'.
Call Follow up report with Selection criteria
SUBMIT /SIE/SWE_XCM_INDEX_FOLLOWUP
USING SELECTION-SET l_variant
WITH so_vbeln IN so_vbeln
WITH so_vkorg IN so_vkorg
WITH so_vtweg IN so_vtweg
WITH so_spart IN so_spart
WITH so_vkgrp IN so_vkgrp
WITH so_vkbur IN so_vkbur
WITH so_vkues IN so_vkues
WITH so_vuntd IN so_vuntd
WITH so_ernam IN so_ernam
WITH so_fnum IN so_fnum
WITH p_kappl EQ c_kappl
WITH p_kschl EQ c_kschl
WITH p_auart EQ c_auart
AND RETURN.
ELSE.
Process for Indexation Report
gs_repid = sy-repid.
Get data.
PERFORM get_data.
Filter data based on Siemens France rules
PERFORM process_data.
Check contract data is available for selection criteria
IF NOT it_cntrt[] IS INITIAL.
create ALV output header
PERFORM alv_fieldcat USING gt_fieldcat[].
create ALV layout
PERFORM alv_layout CHANGING gs_layout.
Sort ALV output
PERFORM alv_sort.
display filtered contract data
PERFORM output_data.
ELSE.
Display a message 'No records found'.
MESSAGE I011.
EXIT.
ENDIF.
ENDIF.
*& Form get_data
Retrieve contracts data from tables
--> p1 text
<-- p2 text
FORM get_data.
Get contract data from VBAK and VEDA.
SELECT avbeln aaudat a~kunnr
bvuntdat bvbegdat
bvdemdat bvenddat
INTO CORRESPONDING FIELDS OF TABLE it_cntrt
FROM vbak AS a INNER JOIN veda AS b
ON avbeln = bvbeln
WHERE a~vbeln IN so_vbeln
AND a~auart EQ c_auart
AND a~vkorg IN so_vkorg
AND a~vtweg IN so_vtweg
AND a~spart IN so_spart
AND a~vkgrp IN so_vkgrp
AND a~vkbur IN so_vkbur
AND a~ernam IN so_ernam
AND b~vposn = '000000'
AND b~vkuesch IN so_vkues
AND b~vuntdat IN so_vuntd.
ENDFORM. " get_data
*& Form process_data
text
--> p1 text
<-- p2 text
FORM process_data.
Internal tables
DATA: l_nast TYPE TABLE OF nast,
it_pr TYPE TABLE OF /sie/ssg_xcm_pr.
Work areas
DATA: w_nast TYPE nast,
wa_pr TYPE /sie/ssg_xcm_pr.
local Variables
DATA: l_datum1 TYPE sy-datum,
l_datum2 TYPE sy-datum,
l_d3last TYPE sy-datum,
l_d3next TYPE sy-datum.
current date.
l_datum1 = sy-datum.
Calcuate date after 3 months.
CALL FUNCTION 'DATE_CREATE'
EXPORTING
ANZAHL_MONATE = 3
DATUM_EIN = l_datum1
IMPORTING
DATUM_AUS = l_datum2.
l_datum2 = l_datum2 - 1.
SORT it_cntrt BY KUNNR VBELN.
Get corresponding records from /SIE/SSG_XCM_PR.
SELECT vbeln posnr fnum
FROM /SIE/SSG_XCM_PR
INTO CORRESPONDING FIELDS OF TABLE it_pr
FOR ALL ENTRIES IN it_cntrt
WHERE vbeln = it_cntrt-vbeln
AND posnr = it_cntrt-vposn
AND fnum IN so_fnum.
clear workarea
CLEAR wa_cntrt.
filter contracts agaist the table /SIE/SSG_XCM_PR records.
LOOP AT it_cntrt INTO wa_cntrt.
CLEAR wa_pr.
check contracts available in table /SIE/SSG_XCM_PR
READ TABLE it_pr INTO wa_pr WITH KEY vbeln = wa_cntrt-vbeln.
IF sy-subrc <> 0.
DELETE it_cntrt.
CLEAR wa_pr.
CONTINUE.
ELSEIF sy-subrc = 0 AND NOT wa_pr-fnum IN so_fnum.
if not available, do not consider this contract
DELETE it_cntrt.
CLEAR wa_pr.
CONTINUE.
ENDIF.
Dont consider contracts expires before today and after 3 months.
IF wa_cntrt-vdemdat > l_datum1. "current date
IF wa_cntrt-vdemdat(6) > l_datum2(6). "AND "after 3 months
delete contract
DELETE it_cntrt.
CLEAR wa_cntrt.
CONTINUE.
ENDIF.
ELSE.
DELETE it_cntrt.
CLEAR wa_cntrt.
CONTINUE.
ENDIF.
Is contract renewal letter has been sent already?
Get all records from NAST to find letter sent?
SELECT kappl objky kschl nacha datvr
FROM NAST
INTO CORRESPONDING FIELDS OF TABLE l_nast
WHERE kappl = c_kappl
AND objky = wa_cntrt-vbeln
AND kschl = c_kschl
AND nacha = '1'.
IF sy-subrc = 0.
sort renewal letter sent dates by latest is first
SORT l_nast BY datvr DESCENDING.
Get latest nast record
READ TABLE l_nast INTO w_nast INDEX 1.
IF sy-subrc = 0.
IF p_manpr <> 'X'. " ignore 3 month logic
l_d3next = wa_cntrt-vdemdat(06).
l_d3next+6(2) = '01'.
Calcuate date after 3 months.
CALL FUNCTION 'DATE_CREATE'
EXPORTING
ANZAHL_MONATE = -3
DATUM_EIN = l_d3next
IMPORTING
DATUM_AUS = l_d3last.
l_d3last = l_d3last + 1.
Check letter already sent year equals current year
IF w_nast-datvr BETWEEN l_d3last AND wa_cntrt-vdemdat.
do not consider it
DELETE it_cntrt.
CLEAR: l_d3last, wa_cntrt, w_nast, l_d3next.
CONTINUE.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
no leading zeros to contract
WRITE wa_cntrt-vbeln TO wa_cntrt-vbeln1 NO-ZERO.
modify internal table
MODIFY it_cntrt FROM wa_cntrt.
CLEAR: l_nast, w_nast.
ENDLOOP.
ENDFORM. " process_data
*& Form output_data
text
--> p1 text
<-- p2 text
FORM output_data.
Display output in a ALV Grid
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = gs_repid
I_CALLBACK_PF_STATUS_SET = 'ALV_STATUS'
I_CALLBACK_USER_COMMAND = 'USER_COMMAND'
IS_LAYOUT = gs_layout
IT_FIELDCAT = gt_fieldcat
IT_SORT = gs_sort
I_SAVE = 'A'
TABLES
T_OUTTAB = it_cntrt
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " output_data
*& Form alv_header
text
--> p1 text
<-- p2 text
FORM alv_fieldcat USING gs_fieldcat TYPE slis_t_fieldcat_alv.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
Sold-to Party header
ls_fieldcat-col_pos = 1.
ls_fieldcat-fieldname = 'KUNNR'.
ls_fieldcat-seltext_m = 'Sold-to Party'.
ls_fieldcat-outputlen = 14.
ls_fieldcat-datatype = 'CHAR'.
ls_fieldcat-key = 'X'.
APPEND ls_fieldcat TO gs_fieldcat.
CLEAR ls_fieldcat.
Contract number
ls_fieldcat-col_pos = 2.
ls_fieldcat-fieldname = 'VBELN'.
ls_fieldcat-seltext_m = 'Contract Number'.
ls_fieldcat-outputlen = 20.
ls_fieldcat-datatype = 'CHAR'.
APPEND ls_fieldcat TO gs_fieldcat.
CLEAR ls_fieldcat.
Contract Signed Date
ls_fieldcat-col_pos = 3.
ls_fieldcat-fieldname = 'VUNTDAT'.
ls_fieldcat-seltext_m = 'Contract signed date'.
ls_fieldcat-outputlen = 20.
ls_fieldcat-datatype = 'DATS'.
APPEND ls_fieldcat TO gs_fieldcat.
CLEAR ls_fieldcat.
Contract Start Date
ls_fieldcat-col_pos = 4.
ls_fieldcat-fieldname = 'VBEGDAT'.
ls_fieldcat-seltext_m = 'Contract start date'.
ls_fieldcat-outputlen = '20'.
ls_fieldcat-datatype = 'DATS'.
APPEND ls_fieldcat TO gs_fieldcat.
CLEAR ls_fieldcat.
Dismantling date
ls_fieldcat-col_pos = 5.
ls_fieldcat-fieldname = 'VDEMDAT'.
ls_fieldcat-seltext_m = 'Dismantling date'.
ls_fieldcat-outputlen = 14.
ls_fieldcat-datatype = 'DATS'.
APPEND ls_fieldcat TO gs_fieldcat.
CLEAR ls_fieldcat.
ENDFORM. " alv_header
*& Form alv_layout
text
--> p1 text
<-- p2 text
FORM alv_layout USING ls_layout TYPE slis_layout_alv.
No input
ls_layout-no_input = 'X'.
Column width is flexible
ls_layout-colwidth_optimize = 'X'.
ls_layout-box_fieldname = 'BOX'.
ls_layout-info_fieldname = 'LINE_COLOR'.
ls_layout-zebra = 'X'.
ls_layout-get_selinfos = 'X'.
ls_layout-reprep = 'X'.
ENDFORM. " alv_layout
*& Form alv_status
text
--> p1 text
<-- p2 text
FORM alv_status USING rt_extab TYPE slis_t_extab.
GUI Status and Application Toolbar
SET PF-STATUS '/SIE/SWE_XCM_INDEXLE'.
ENDFORM.
*& Form user_command
text
--> p1 text
<-- p2 text
FORM user_command USING l_ucomm LIKE sy-ucomm
l_selfield TYPE slis_selfield.
RANGES: r_kappl FOR nast-kappl,
r_objky FOR nast-objky,
r_kschl FOR nast-kschl,
r_nacha FOR nast-nacha.
DATA: l_jobname TYPE TBTCJOB-JOBNAME,
l_jobcount TYPE TBTCJOB-JOBCOUNT,
l_repid TYPE sy-repid,
l_print_params TYPE PRI_PARAMS,
l_arc_params TYPE ARC_PARAMS,
l_valid TYPE c,
l_retcode TYPE sy-subrc,
l_blines TYPE i.
CASE l_ucomm.
Process button seleted
WHEN c_sform.
process selected records.
LOOP AT it_cntrt INTO wa_cntrt.
IF wa_cntrt-box = 'X'.
place output type in the contract
PERFORM bdc_output USING wa_cntrt
CHANGING l_retcode.
IF l_retcode = 0.
add record for jobground job
r_objky-sign = 'I'.
r_objky-option = 'EQ'.
r_objky-low = wa_cntrt-vbeln.
APPEND r_objky.
ENDIF.
CLEAR: wa_cntrt, l_retcode, r_objky.
ENDIF.
ENDLOOP.
WHEN c_dclick.
set contract number id with the selected contract
SET PARAMETER ID 'AUN' FIELD l_selfield-value.
SET PARAMETER ID 'KTN' FIELD l_selfield-value.
call va42 tcode when double click on contract
CALL TRANSACTION c_tcode AND SKIP FIRST SCREEN.
ENDCASE.
DESCRIBE TABLE r_objky LINES l_blines.
IF NOT r_objky[] IS INITIAL.
IF l_blines > 0.
Background job name.
CONCATENATE 'XCM_INDEXATION' sy-uname '_' sy-uzeit
INTO l_jobname.
Application
r_kappl-sign = 'I'.
r_kappl-option = 'EQ'.
r_kappl-low = 'V1'.
APPEND r_kappl.
Message Type
r_kschl-sign = 'I'.
r_kschl-option = 'EQ'.
r_kschl-low = c_kschl.
APPEND r_kschl.
Message transmission medium
r_nacha-sign = 'I'.
r_nacha-option = 'EQ'.
r_nacha-low = '1'.
APPEND r_nacha.
l_repid = sy-repid.
Print Parameters
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
DESTINATION = p_print
MODE = c_batch
NO_DIALOG = 'X'
REPORT = l_repid
EXPIRATION = 2
IMMEDIATELY = 'X'
NEW_LIST_ID = 'X'
IMPORTING
OUT_ARCHIVE_PARAMETERS = l_arc_params
OUT_PARAMETERS = l_print_params
VALID = l_valid
EXCEPTIONS
ARCHIVE_INFO_NOT_FOUND = 1
INVALID_PRINT_PARAMS = 2
INVALID_ARCHIVE_PARAMS = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
opening the job
CALL FUNCTION 'JOB_OPEN'
EXPORTING
JOBNAME = l_jobname
IMPORTING
JOBCOUNT = l_jobcount
EXCEPTIONS
CANT_CREATE_JOB = 1
INVALID_JOB_DATA = 2
JOBNAME_MISSING = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Job submit
SUBMIT /sie/swe_xcm_index_rsnast00 TO SAP-SPOOL
USER sy-uname
WITH s_kappl IN r_kappl
WITH s_objky IN r_objky
WITH s_kschl IN r_kschl
WITH s_nacha IN r_nacha
WITH p_print EQ p_print
VIA JOB l_jobname NUMBER l_jobcount
SPOOL PARAMETERS l_print_params
WITHOUT SPOOL DYNPRO
AND RETURN.
IF sy-subrc <> 0.
display message when error in scheduling background job
MESSAGE E016 WITH 'Error scheduling Job'.
ENDIF.
Job close
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
JOBCOUNT = l_jobcount
JOBNAME = l_jobname
STRTIMMED = 'X'
EXCEPTIONS
CANT_START_IMMEDIATE = 1
INVALID_STARTDATE = 2
JOBNAME_MISSING = 3
JOB_CLOSE_FAILED = 4
JOB_NOSTEPS = 5
JOB_NOTEX = 6
LOCK_FAILED = 7
OTHERS = 8.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
ENDFORM.
*& Form bdc_output
text
--> p1 text
<-- p2 text
FORM bdc_output USING wa_cntrt TYPE ty_cntrt
CHANGING l_retcode TYPE sy-subrc.
DATA: l_nast TYPE TABLE OF nast,
it_nast TYPE TABLE OF nast,
w_nast TYPE nast,
l_cellno(2) TYPE n,
l_vbelv TYPE vbfa-vbelv,
l_vbpa TYPE vbpa,
l_yes(1),
l_temp(40) TYPE c,
l_lines TYPE i,
l_lesscnt TYPE i,
l_less(1),
l_lines1(2) TYPE n.
REFRESH: it_nast, l_nast, it_bdc.
CLEAR: l_nast, w_nast, l_yes, l_cellno,
it_nast, l_nast, it_bdc.
PERFORM dyn_scr USING 'SAPMV45A' '0102' 'X'.
PERFORM dyn_fld USING 'VBAK-VBELN' wa_cntrt-vbeln.
PERFORM dyn_fld USING 'BDC_OKCODE' '/00'.
PERFORM dyn_scr USING 'SAPMV45A' '4001' 'X'.
PERFORM dyn_fld USING 'BDC_OKCODE' '=HEAD'.
PERFORM dyn_scr USING 'SAPMV45A' '4002' 'X'.
PERFORM dyn_fld USING 'BDC_OKCODE' '=KDOK'.
SELECT *
FROM nast
INTO CORRESPONDING FIELDS OF TABLE l_nast
WHERE kappl = c_kappl
AND objky = wa_cntrt-vbeln.
IF sy-subrc = 0.
SORT l_nast BY kschl vstat.
DESCRIBE TABLE l_nast LINES l_lines.
LOOP AT l_nast INTO w_nast.
l_cellno = sy-tabix.
IF w_nast-kschl = c_kschl AND w_nast-vstat = 0.
EXIT.
ENDIF.
IF w_nast-kschl > c_kschl OR
( w_nast-kschl = c_kschl AND w_nast-vstat <> 0 ).
IF l_less = space.
l_cellno = l_cellno - 1.
ENDIF.
CLEAR l_less.
IF l_cellno = 0.
l_cellno = 1.
ENDIF.
l_lines = l_lines + 1.
l_lines1 = l_lines.
PERFORM dyn_scr USING 'SAPDV70A' '0100' 'X'.
CONCATENATE 'DNAST-KSCHL(' l_lines1 ')' INTO l_temp.
CONDENSE l_temp.
PERFORM dyn_fld USING l_temp 'Y6C4'.
CLEAR: l_temp, l_lines, l_lines1.
PERFORM dyn_fld USING 'BDC_OKCODE' '/00'.
EXIT.
ELSEIF w_nast-kschl < c_kschl.
l_less = 'X'.
l_lesscnt = l_lesscnt + 1.
ENDIF.
ENDLOOP.
ELSE.
l_cellno = '01'.
PERFORM dyn_scr USING 'SAPDV70A' '0100' 'X'.
CONCATENATE 'DNAST-KSCHL(' l_cellno ')' INTO l_temp.
CONDENSE l_temp.
PERFORM dyn_fld USING l_temp 'Y6C4'.
CLEAR l_temp.
PERFORM dyn_fld USING 'BDC_OKCODE' '/00'.
ENDIF.
IF l_less = 'X'.
l_lesscnt = l_lesscnt + 1.
l_cellno = l_lesscnt.
l_lines = l_lines + 1.
l_lines1 = l_lines.
PERFORM dyn_scr USING 'SAPDV70A' '0100' 'X'.
CONCATENATE 'DNAST-KSCHL(' l_lines1 ')' INTO l_temp.
CONDENSE l_temp.
PERFORM dyn_fld USING l_temp 'Y6C4'.
CLEAR: l_temp, l_lines, l_lines1.
PERFORM dyn_fld USING 'BDC_OKCODE' '/00'.
ENDIF.
PERFORM dyn_scr USING 'SAPDV70A' '0100' 'X'.
CONCATENATE 'DV70A-SELKZ(' l_cellno ')' INTO l_temp.
CONDENSE l_temp.
PERFORM dyn_fld USING l_temp 'X'.
CLEAR l_temp.
PERFORM dyn_fld USING 'BDC_OKCODE' '=V70P'.
PERFORM dyn_scr USING 'SAPDV70A' '0101' 'X'.
PERFORM dyn_fld USING 'NAST-LDEST' p_print.
PERFORM dyn_fld USING 'NAST-DIMME' 'X'.
PERFORM dyn_fld USING 'NAST-TDARMOD' '1'.
PERFORM dyn_fld USING 'BDC_OKCODE' '=V70B'.
PERFORM dyn_scr USING 'SAPDV70A' '0100' 'X'.
CONCATENATE 'DV70A-SELKZ(' l_cellno ')' INTO l_temp.
CONDENSE l_temp.
PERFORM dyn_fld USING l_temp 'X'.
CLEAR l_temp.
PERFORM dyn_fld USING 'BDC_OKCODE' '=V70I'.
PERFORM dyn_scr USING 'SAPDV70A' '0102' 'X'.
PERFORM dyn_fld USING 'NAST-VSZTP' '1'.
PERFORM dyn_fld USING 'BDC_OKCODE' '=V70B'.
PERFORM dyn_scr USING 'SAPDV70A' '0100' 'X'.
PERFORM dyn_fld USING 'BDC_OKCODE' '=V70S'.
CALL TRANSACTION c_tcode USING it_bdc
MODE c_mode "'N'
UPDATE c_updat "'A'
MESSAGES INTO it_mesg.
IF sy-subrc = 0.
l_retcode = 0.
ENDIF.
ENDFORM. " bdc_output
*& Form dyn_scr
text
-->P_0642 text
-->P_0643 text
-->P_0644 text
FORM dyn_scr USING P_0642
P_0643
P_0644.
MOVE: p_0642 TO wa_bdc-program,
p_0643 TO wa_bdc-dynpro,
p_0644 TO wa_bdc-dynbegin.
APPEND wa_bdc TO it_bdc.
CLEAR wa_bdc.
ENDFORM. " dyn_scr
*& Form dyn_fld
text
-->P_0654 text
-->P_0655 text
FORM dyn_fld USING P_0654
P_0655.
MOVE: p_0654 TO wa_bdc-fnam,
p_0655 TO wa_bdc-fval.
APPEND wa_bdc TO it_bdc.
CLEAR wa_bdc.
ENDFORM. " dyn_fld
*& Form alv_sort
text
FORM alv_sort.
DATA: wa_sortcat TYPE slis_sortinfo_alv.
WA_SORTCAT-SPOS = 1.
WA_SORTCAT-FIELDNAME = 'KUNNR'.
WA_SORTCAT-UP = 'X'.
WA_SORTCAT-EXPA = 'X'.
Appending gd_sortcat-tabname
APPEND WA_SORTCAT TO gs_sort.
CLEAR wa_sortcat.
WA_SORTCAT-SPOS = 2.
WA_SORTCAT-FIELDNAME = 'VBELN'.
WA_SORTCAT-UP = 'X'.
WA_SORTCAT-EXPA = 'X'.
Appending gd_sortcat-tabname
APPEND WA_SORTCAT TO gs_sort.
WA_SORTCAT-SPOS = 3.
WA_SORTCAT-FIELDNAME = 'VUNTDAT'.
WA_SORTCAT-UP = 'X'.
WA_SORTCAT-EXPA = 'X'.
Appending gd_sortcat-tabname
APPEND WA_SORTCAT TO gs_sort.
ENDFORM. " alv_sort -
How to print ADDRESS in SAP Script
Hi All,
I want to print address using ADDRESS command in SAP script. I am using folowing code:
ADDRESS PARAGRAPH AS
TITLE &ADRS-ANRED&
NAME &ADRS-NAME1&, &ADRS-NAME2&,
STREET &ADRS-STRAS&
POBOX &ADRS-PFACH& CODE &ADRS- PSTL2& CITY &ADRS-PFORT&
POSTCODE &ADRS-PSTLZ&
REGION &ADRS-REGIO&
CITY &ADRS-ORT01&, &ADRS-ORT02&
COUNTRY &ADRS-LAND1&
FROMCOUNTRY &ADRS-INLND&
ENDADDRESS
Here in output I am getting Title, name1, & name2 in different lines. But I want that Title, name1 and name2 in same line.
I tried putting title, name1 and name2 in same line but then neither title nor name1, name2 are getting displayed.
Please tell me how I can do the same.
I have heard that SAP displays the address according to country standard. Please let me know in which table the country specific setting is stored.
Regards,
VijayHi,
country code stored in this T005T. Adjust the tab positions on script then only u will get all the title, name1, name2 will get in one line.
regards,
ravi shankar reddy -
Migrating the SAP-Scripts to smartforma which are related to Finance(FI)
Hi,
Do we can migrate the SAP-Scripts to Smartform which are related to Finance(FI) & those SAP-Scripts are called by a standard print program (RFFOUS_C)
Urgent answer need please!!!
Thanks,Hello,
Yes you can migrate script to smartform there are different ways to migrate.
Use program SF_MIGRATE..
to migrate from scripts to smartforms.
Reward if helpful.
Viswam. -
Question on Printing SAP Script
Hi Group,
I have an urgency in printing a SAPScript. I would like to know how to change the printer settings to hold the page of a particular size for printing.
Please let me know the procedure to achieve this and also the transaction(s) relating to this configuration.
My requirement:
I want to create some settings to a SAP Script page and I want to use the same configuration (of the page) while running the driver program.
My Issue is:
I have a page(SAP Script) in which I want to print exactly 3 cheques for the page.
But, currently, I am able to get only one cheque getting printed and remaining 2/3 of the page is getting wasted. So I want to do the configuration accordingly to achieve my task.
Please let me know your valuable inputs.
Thanks & Regards,
Vishnu.We don't include the audit trail content in the specification print out. I recommend using a BI Publisher contextual report that you can launch from the specification. You can learn more about custom reporting in the extensibility pack reporting guide.
-
SAP Script ADDRESS....ENDADDRESS
Hi,
I have the following code in one window of my SAP Script
/: ADDRESS
/: NAME &SHIPINV-S2NAME1&, &SHIPINV-S2NAME2&, &SHIPINV-S2NAME3&
All other address nodes
/: ENDADDRESS
All the 3 names are printed successfully.
Now i want to add &SHIPINV-S2NAME4& to NAME node of ADDRESS. Since the length of the line in editor window is occupied by first 3 name fields I had to put my 4th field in next line.
/: ADDRESS
/: NAME &SHIPINV-S2NAME1&, &SHIPINV-S2NAME2&, &SHIPINV-S2NAME3&
<b>/: &SHIPINV-S2NAME4&</b> <i>is this correct ??</i>
All other address nodes
/: ENDADDRESS
But its not at all printing the 4th value (In debugger i checked the value s available in &SHIPINV-S2NAME4&). I am not sure about the syntax for next line in NAME node & also notation to use like /: or /( or space, or /= and so on. I tried many combinations but cudn't get thru it. So i am confused with NAME node of ADDRESS...ENDADDRESS
Please help me out in this case.
Thanks,
SailHello if things don't work as suggested.
Try this simple solution:
/: DEFINE &NAME1& = &SHIPINV-S2NAME1&
/: DEFINE &NAME2& = &SHIPINV-S2NAME2&
/: DEFINE &NAME3& = &SHIPINV-S2NAME3&
/: DEFINE &NAME4& = &SHIPINV-S2NAME4&
/: ADDRESS
/: NAME &NAME1& &NAME2& &NAME3& &NAME4&
By the way Have you tried with this also:
/: NAME &SHIPINV-S2NAME1& &SHIPINV-S2NAME2& ....S2NAME3& = &SHIPINV-S2NAME4&
Enjoy !!
Message was edited by:
Amarjit Singh -
Formatting issue related to SAP Scripts
Hi All,
I have a formatting issue related to SAP Scripts.
Issue is i have a variable declared as:
<b>v_kbetr LIKE BSET-KBETR.</b>
I will fetch some value into this v_kbetr in SE38.
Then in SE71[Layout set] i have put it as &v_kbetr&
Now i have written code in SE71 as below:
IF &v_kbetr& EQ ' 0.00'
0
ELSE
&v_kbetr&
ENDIF
like wise i am displaying 2 fields with same condition.
now if value for v_kbetr is 6.75 then it is getting displayed as right aligned.
Otherwise 0 will be displayed as left aligned
Now what i want is &v_kbetr& to be left aligned if value present. though i have declred as &v_kbetr(L)& it is not working.
Is there any solution for this.
Thanks,
Kumar.Hi.
Symbol values other than numeric values are normally formatted left-justified.so define this variable other than Numeric.
If you write Field(L) this will only for output, -
Gap between two characters in SAP Script Address EndAddress.
Hi Abapers,
I have one query regarding Address - EndAddress in SAPScript.
I am putting the code :
/: ADDRESS TYPE '1' PARAGRAPH ZI PRIORITY 'APL43' LINES 6
/:ADDRESSNUMBER &ZPOLGORT-ADRNR&
/:ENDADDRESS
and I am getting the output in this form
<b><i>ABC Soft c/o JSI Hong Kon g
c/o RS Logistics (Shenzhen) Limited
6/F., DZ Zhong Tian Yuan Logistics Ctr.
126/Xia Road, Futian Free Zone,
Shenzhen
China</i></b>
But the problem is there is a gap between character "n" and 'g" in first line in word Kong.
Can anybody suggest me how to solve this issue. Or is there any other issues to sort it out this problem.Hi,
Its not the problem with Address / End Address.
It could be probably maintained that way.
Please check the entry in the table where it is maintained.
reagrds, -
Printing address in chinese char- sap script
Hi
I have a requirement to print address in chinese(ZH language).
currently we need to write down the Chinese address manually on envelop if mailing address is in China.
we would like to have the logic for the output. if there is Chinese name/address maintained in customer master, then use Chinese name/address. otherwise, use original English name/address to print on statement.
in sap script they are passing address number to get this address
/: ADDRESS PARAGRAPH AF PRIORITY P LINES 10
/: ADDRESSNUMBER &DKADR-ADRNR&
/: FROMCOUNTRY &T001-LAND1&
/: ENDADDRESS
Anyone help me out
Regards
KumarHi,
you can use this with this format
/: ADDRESS [DELIVERY] [TYPE t] [PARAGRAPH a] [PRIORITY p] [LINES l]
/: TITLE title
/: NAME name1[,name2[,name3[,name4]]]
/: PERSON name of natural person [TITLE form of address]
/: PERSONNUMBER number of the personen
/: DEPARTMENT department
/: STREET street name HOUSE house number
/: LOCATION additional location information
/: POBOX po box [CODE post code / zip code] [CITY city]
/: POSTCODE post code / zip_code
/: CITY city1[,city2]
/: NO_UPPERCASE_FOR_CITY
/: REGION county / state
/: COUNTRY recipient country [LANGUAGE language code]
/: COUNTRY_IN_REC_LANG
/: LANG_FOR_COUNTRY language key
/: FROMCOUNTRY sender country
/: ADDRESSNUMBER address number
/: ENDADDRESS
In detail
COUNTRY_IN_REC_LANG
This flag tells the system to use the recipient language for the country name.
( COUNTRY_IN_REC_LANG u2018Xu2018 )
( Default: Recipient language is not used: COUNTRY_IN_REC_LANG u2018 u2018 )
LANG_FOR_COUNTRY
Default = Space
Use this parameter to explicitly set the language in which to print the country name of a foreign address. By default, the system uses the language of the sending country.
LANGUAGE
Language code of the language of the recipient country, if it differs from that of the recipient COUNTRY. Example: addresses in Switzerland. Standard SAP language codes are used; you can display these in the initial SAPscript text processing screen or in table T002.
FROMCOUNTRY
Specifies the language to be used for formatting the name of the recipient country. For most European countries, the recipient country is specified by placing the international car registration letters in front of the post code and separating them from the post code with a hyphen. You must always specify the sender country.
Maybe you are looking for
-
CR runtime SP1 and SP2 on WS 2003 and IIS 6 report is blank in reportviewer
Hi All, Could you please help me, No image problem in following scenarios, Using asp.net 3.5 WS 2003, IIS6, CR runtime 2008 with SP1 = > No images WS 2003, IIS6, CRruntime 2008 with SP2 => No images WS 2003, IIS6, CRruntime 2008(No SP) => Works all
-
I am trying to quit my safari but it won't do it.. The only response I get is the one of closing the window. I can't shut down my computer or restart it because of this. Can somebody please tell me what to do?
-
Why does the mute sign keep showing up when volume is up and phone not on vibrate?
.
-
FieldPoint and labview for linux
Can I access to Fieldpoint Ethernet modules, FP-1601, from labview 8 for linux?
-
Using Magic Wand to select & enahance path in CS2
I have an aerial image in a .JPEG file which shows a GPS track/route. I would like to enhance/alter the appeareance of this track/route in the image. For example, I would like to possibly increase the thickness of the track/route, possibibly chang