Use of OBLIGATORY on SELECTION_SCREEN
Hello,
I'm collecting a date on a selection-screen and if I use OBLIGATORY, the system makes sure there is an entry in the LOW field but not in the HIGH field.
Is there a way to have the system check the HIGH field?
Thx.
Andy Jacobs
Hi Andrew.
You can put a check for Low as well as High fields of the select option: say your select option is for p_date
AT SELECTION-SCREEN ON p_date-low.
if P_date-low is initial.
message e001 with 'Enter value'.
endif.
AT SELECTION-SCREEN ON p_date-high.
if P_date-high is initial.
message e001 with 'Enter value'.
endif.
Regards,
Sudhakar.
Similar Messages
-
Problem while creating sales order using BAPI
Hi all,
i am creating a sales order from the purchase order data.
when my client will send a PO in EDI format, my 3rd party edi tool will convert that edi formatted PO to text format. then i will upload that text formatted PO to my program then i will create a SO from those uploaded PO data using BAPI BAPI_SALESORDER_CREATEFROMDAT2.
but,no sales order is being created.& also i am not getting any return message.by debugging also, i am not getting the error.plz suggest where i am doing mistake.below is the coding.
DATA:
gfilename LIKE rlgrap-filename.
*--Internal tables
DATA: BEGIN OF i_item OCCURS 50. "Create Material Document Item
INCLUDE STRUCTURE BAPISDITM .
DATA: END OF i_item .
DATA: BEGIN OF i_partner OCCURS 20. "Return parameter
INCLUDE STRUCTURE BAPIPARNR.
DATA: END OF i_partner.
DATA: BEGIN OF i_schedule OCCURS 20. "Return parameter
INCLUDE STRUCTURE BAPISCHDL .
DATA: END OF i_schedule.
DATA: BEGIN OF i_cond OCCURS 20. "Return parameter
INCLUDE STRUCTURE BAPICOND .
DATA: END OF i_cond.
DATA: BEGIN OF i_part OCCURS 0, " Internal table for split data
part(20),
END OF i_part.
DATA: BEGIN OF i_return OCCURS 20. "Return parameter
INCLUDE STRUCTURE bapiret2.
DATA: END OF i_return.
*-- Work areas
DATA: BEGIN OF wa_header . "sales Document Header Data
INCLUDE STRUCTURE BAPISDHD1.
DATA: END OF wa_header .
*DATA: BEGIN OF wa_return . "Output Structure
INCLUDE STRUCTURE BAPIRET2.
*DATA: END OF wa_return .
DATA: begin of sorder.
INCLUDE STRUCTURE BAPIVBELN.
DATA: end of sorder.
data:begin of t_upload,
ebeln(10), "PO no(seagate)
aedat like sy-datum , "PO date
bsart(4) , "PO type
vdatu like sy-datum , "requested delivery date
kunnr(10) , "customer no-sold-to-party
kunak like vbak-kunnr, "bill-to-party
name1_s(20), "name1 of sold-to-party
name2_s(15), "name2 of sold-to-party
land1_s(3), "country
ort01_s(10), "city
regio_s(3), "region(state/province)
pstlz_s(10), "postal code
adrnr_s(10), "address
bstkd_e(10), "end customer purchase order
posex(6), "end customer PO line no(item no)
kdmat(18), "end customer material no(part no)
kunag(10), "ship-to-party
name1_c(20), "name1 of ship-to-party
name2_c(15), "name2 of ship-to-party
land1_c(3), "country
ort01_c(10), "city
regio_c(3), "region(state/province)
pstlz_c(10), "postal code
adrnr_c(10), "address
posnr(6), "item no(seagate PO line no)
pstyv(4), "item category
matnr(18), "material no(seagate 9 digit part no)
zmeng(13), "Target quantity in sales unit
vrkme like vbap-vrkme, "sales unit
meins(3), "UOM
posnr_tot like vbap-posnr,"Total no. of line items
werks(4), "plant
vstel like vbap-vstel, "shipping point
empst(10), "receiving point
shtyp(4), "shipment type
route(6), "route
vsbed(2), "shipping conds
rkfkf like vbap-rkfkf, "method of billing for co/ppc orders
zterm(4), "terms of payment key
inco1(3), "F.O.B inco term1
inco2(3), "F.O.B inco term2
end of t_upload.
Data: wa_upload like t_upload,
i_upload like standard table of t_upload.
Data:v_kunnr like kna1-kunnr,
v_posnr like vbap-posnr,
v_matnr like vbap-matnr,
v_zmeng like vbap-zmeng,
v_kunag like kna1-kunnr.
*---Constants
CONSTANTS: c_comma TYPE c VALUE ',', " For splitting data at commas
c_01(2) TYPE c VALUE '01', " For movement code in Bapi
c_b TYPE c VALUE 'B', " For mvt. Indicator in Bapi
c_creat(5) TYPE c VALUE 'CREAT', " For button text
c_clear(5) TYPE c VALUE 'CLEAR', " For clear button
c_mvmt(4) TYPE c VALUE 'MVMT',
c_ok(2) TYPE c VALUE 'OK',
c_error(5) TYPE c VALUE 'Error'.
*--SELECTION SCREEN DESIGN--
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME.
PARAMETERS:
p_auart LIKE vbak-auart, " order type
p_vkorg LIKE vbak-vkorg, " sales org
p_vtweg LIKE vbak-vtweg, " dist channel
p_spart LIKE vbak-spart, " division
p_vkgrp LIKE vbak-vkgrp, " sales group
p_vkbur LIKE vbak-vkbur, "sales office
p_file(256) default 'c:/saleorder.txt'. "File name
SELECTION-SCREEN END OF BLOCK blk1.
SELECTION-SCREEN PUSHBUTTON 15(10) v_create USER-COMMAND creat.
SELECTION-SCREEN PUSHBUTTON 40(10) v_clear USER-COMMAND clear.
INITIALIZATION -
INITIALIZATION.
v_create = c_creat .
v_clear = c_clear.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM selectfile USING p_file.
*--AT SELECTION_SCREEN--
AT SELECTION-SCREEN .
IF sy-ucomm = c_clear.
PERFORM f_clear.
ELSE.
IF sy-ucomm <> c_mvmt.
**--- Validating the input data.
PERFORM f_check_inputs.
ELSEif sy-ucomm = c_creat.
*--- Validating the input data.
PERFORM f_check_inputs.
*-- Uploading the PO data.
PERFORM f_PO_upload.
*---checking the PO data
PERFORM f_check_upload_data.
*---create sales order from PO data
PERFORM f_Sales_order_create.
ENDIF.
FORM f_PO_upload.
gfilename = p_file.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
filename = gfilename
filetype = 'DAT'
TABLES
data_tab = i_upload
EXCEPTIONS
conversion_error = 1
file_open_error = 2
file_read_error = 3
invalid_type = 4
no_batch = 5
unknown_error = 6
invalid_table_width = 7
gui_refuse_filetransfer = 8
customer_error = 9
OTHERS = 10.
IF sy-subrc <> 0.
MESSAGE i398(00) WITH '(WS_UPLOAD)'
' Errors occured with exception '
sy-subrc.
ENDIF.
ENDFORM. " f_PO_upload
*& Form selectfile
text
-->P_P_FILE text
FORM selectfile CHANGING value(filename) TYPE c.
CALL FUNCTION 'WS_FILENAME_GET'
EXPORTING
def_filename = gfilename
def_path = 'C:\'
mask = ',*.txt.'
mode = 'O'
title = 'Select File Name'
IMPORTING
filename = filename
EXCEPTIONS
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
OTHERS = 5.
ENDFORM. " selectfile
FORM f_Sales_order_create.
PERFORM f_fill_header.
PERFORM f_fill_partner.
PERFORM f_fill_item.
PERFORM f_call_BAPI.
ENDFORM. " f_Sales_order_create
*& Form f_fill_header
text
--> p1 text
<-- p2 text
FORM f_fill_header.
move p_auart to wa_header-doc_type.
move p_vkorg to wa_header-sales_org.
move p_vtweg to wa_header-distr_chan.
move p_spart to wa_header-division.
move p_vkgrp to wa_header-sales_grp.
move p_vkbur to wa_header-sales_off.
Read table i_upload into wa_upload index 1.
move wa_upload-ebeln to wa_header-purch_no_c.
move wa_upload-aedat to wa_header-purch_date.
move wa_upload-bsart to wa_header-po_method.
move wa_upload-vdatu to wa_header-req_date_h.
move wa_upload-bstkd_e to wa_header-purch_no_s.
*move wa_upload-route to wa_header-route.
move wa_upload-vsbed to wa_header-ship_cond.
move wa_upload-empst to wa_header-rec_point.
move wa_upload-shtyp to wa_header-ship_type.
move wa_upload-zterm to wa_header-pmnttrms.
move wa_upload-inco1 to wa_header-incoterms1.
move wa_upload-inco2 to wa_header-incoterms2.
ENDFORM. " f_fill_header
*& Form f_fill_partner
text
--> p1 text
<-- p2 text
FORM f_fill_partner.
if not wa_upload-kunnr is initial.
select single kunnr from kna1 into v_kunnr
where kunnr = wa_upload-kunnr.
if sy-subrc <> 0.
Message E014 with 'customer does not exist'.
else.
move 'AG' to i_partner-partn_role.
move wa_upload-kunnr to i_partner-partn_numb.
move wa_upload-land1_s to i_partner-country.
move wa_upload-name1_s to i_partner-name.
move wa_upload-name2_s to i_partner-name_2.
move wa_upload-ort01_s to i_partner-city.
move wa_upload-regio_s to i_partner-region.
move wa_upload-pstlz_s to i_partner-postl_code.
move wa_upload-adrnr_s to i_partner-address.
append i_partner.
endif.
endif.
if not wa_upload-kunag is initial.
select single kunnr from kna1 into v_kunag
where kunnr = wa_upload-kunag.
if sy-subrc <> 0.
Message E015 with 'end customer does not exist'.
else.
move 'WE' to i_partner-partn_role.
move wa_upload-kunag to i_partner-partn_numb.
move wa_upload-land1_c to i_partner-country.
move wa_upload-name1_c to i_partner-name.
move wa_upload-name2_c to i_partner-name_2.
move wa_upload-ort01_c to i_partner-city.
move wa_upload-regio_c to i_partner-region.
move wa_upload-pstlz_c to i_partner-postl_code.
move wa_upload-adrnr_c to i_partner-address.
append i_partner.
endif.
endif.
ENDFORM. " f_fill_partner
*& Form f_fill_item
text
--> p1 text
<-- p2 text
FORM f_fill_item.
loop at i_upload into wa_upload.
if not wa_upload-matnr is initial.
select single maramatnr msegmenge into (v_matnr, v_zmeng) from
mara inner join mseg on maramatnr = msegmatnr
where mara~matnr = wa_upload-matnr.
if sy-subrc <> 0.
Message E016 with 'material no does not exist'.
elseif v_zmeng LT wa_upload-zmeng.
Message E017 with 'order quantity is greater than the quantity present'.
endif.
endif.
move wa_upload-posnr to i_item-itm_number.
move wa_upload-pstyv to i_item-item_categ.
move wa_upload-matnr to i_item-material.
move wa_upload-zmeng to i_item-target_qty.
move wa_upload-meins to i_item-target_qu.
move wa_upload-werks to i_item-plant.
*move wa_upload-meins to wa_vbap-meins.
*move wa_upload-posnr_tot to wa_vbap-posnr_tot.
move wa_upload-posex to i_item-po_itm_no.
move wa_upload-kdmat to i_item-cust_mat22.
move wa_upload-inco1 to i_item-incoterms1.
move wa_upload-inco2 to i_item-incoterms2.
move wa_upload-zterm to i_item-pmnttrms.
move wa_upload-empst to i_item-rec_point.
move wa_upload-shtyp to i_item-ship_type.
move wa_upload-route to i_item-route.
append i_item.
PERFORM f_fill_schedule_line.
PERFORM f_fill_conditions.
ENDLOOP.
ENDFORM. " f_fill_item
*& Form f_fill_schedule_line
text
--> p1 text
<-- p2 text
FORM f_fill_schedule_line.
move wa_upload-matnr to i_schedule-itm_number.
move sy-datum to i_schedule-req_date.
move wa_upload-zmeng to i_schedule-req_qty.
append i_schedule.
ENDFORM. " f_fill_schedule_line
*& Form f_fill_conditions
text
--> p1 text
<-- p2 text
FORM f_fill_conditions.
move wa_upload-matnr to i_cond-itm_number.
move sy-datum to i_cond-conpricdat.
append i_cond.
ENDFORM. " f_fill_conditions
*& Form f_clear
text
--> p1 text
<-- p2 text
FORM f_clear.
clear:p_auart,
p_vkorg,
p_vtweg,
p_spart,
p_vkgrp,
p_vkbur.
ENDFORM. " f_clear
*& Form f_call_BAPI
text
--> p1 text
<-- p2 text
FORM f_call_BAPI.
clear:i_item,i_partner,i_schedule.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
SALESDOCUMENTIN =
ORDER_HEADER_IN = wa_header
ORDER_HEADER_INX =
SENDER =
BINARY_RELATIONSHIPTYPE =
INT_NUMBER_ASSIGNMENT =
BEHAVE_WHEN_ERROR =
LOGIC_SWITCH =
TESTRUN =
CONVERT = ' '
IMPORTING
SALESDOCUMENT = sorder
TABLES
RETURN =
ORDER_ITEMS_IN = i_item
ORDER_ITEMS_INX =
ORDER_PARTNERS = i_partner
ORDER_SCHEDULES_IN = i_schedule
ORDER_SCHEDULES_INX =
ORDER_CONDITIONS_IN = i_cond.
ORDER_CFGS_REF =
ORDER_CFGS_INST =
ORDER_CFGS_PART_OF =
ORDER_CFGS_VALUE =
ORDER_CFGS_BLOB =
ORDER_CFGS_VK =
ORDER_CFGS_REFINST =
ORDER_CCARD =
ORDER_TEXT =
ORDER_KEYS =
EXTENSIONIN =
PARTNERADDRESSES =
if not ( sorder-vbeln is initial ).
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
write: /'Order number:', sorder.
else.
loop at i_return.
write: / i_return-id, i_return-number, i_return-message(80).
endloop.
*write: /'Error'.
endif.
*loop at i_return.
*write: / i_return-id, i_return-number, i_return-message(80).
*endloop.
ENDFORM. " f_call_BAPIHI
Pricing will be carried basing on the pricing
procedure.
Case1: Prices will be carried out automatically if
necessary condition records are maintained for the
condition type.
For this you can go to Sales Order-> Item Conditions
In the screen you can click on command button Analysis,
which gives you the list of condition types associated
to the pricing procedure. By clicking on the condition
type you can know the action that has taken place.
Case2: Manually forcing prices for Items.
To do this, you have to populate ORDER_CONDITIONS_IN &
ORDER_CONDITIONS_INX. Also note to identify the item
numbers, you manually pass the item number for each item
in the sales order, use the same item number for
populating conditions.
Parameters required:
ORDER_CONDITIONS_IN:
ITM_NUMBER, COND_TYPE, COND_VALUE, CURRENCY
ORDER_CONDITIONS_INX:
ITM_NUMBER, COND_TYPE, UPDATEFLAG, COND_VALUE,CURRENCY.
Hope the above info helps you. Do revert back if you
need more info.
Kind Regards
Eswar -
Skip validation of 'OBLIGATORY fields populated or not'? so that user GO_BACK
Hello
I placed a handful fields on selection screen, wherein there are push buttons are there and input free text fields.
Based on these button cliks and controlling the other fields visibility. So, user thinks that there are 2 screens. I also placed a BACK button, bcz user when cliks BACK button then the user thinks he/she is navigating from 2nd creen to 1st screen.
I made these free text input feilds as OBLIGATORY addition. So, when user cliks BACK button am getting error that 'Pls. enter required fields'
Pls. let me know how can I skip this error upon clikcing of BACK button, I mean, in this case we don't need to chk mandatory.
Thank youIts not possible if you use the obligatory functionality. It defeats the purpose of obligatory. Instead don't use obligatory but check if the field is initial by your own and then display custom error message.
you can skip this check if the sy-ucomm is for the BACK button.
Thanks,
Vikram.M -
Difference between user_sy_privs and session_privs views
Hi,
could you tell me exactly if the difference between the user_sy_privs view and the session_privs view is this one
-the user_sy_privs shows the system privileges the current user is really using during its session
-the session_privs view shows the system privileges the current user can use during its session(he does not use them obligatory)
Thanks a lot for your answer
Regards
Nathalie"USER_SYS_PRIVS lists *system* privileges granted to the current user."
http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_4459.htm#sthref2365
"SESSION_PRIVS lists the privileges that are currently available to the user."
http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_4238.htm#sthref2060
SQL> select * from user_sys_privs
2 /
USERNAME PRIVILEGE ADM
HOEK UNLIMITED TABLESPACE NO
1 row selected.
SQL> select * from session_privs
2 /
PRIVILEGE
ALTER SYSTEM
AUDIT SYSTEM
CREATE SESSION
ALTER SESSION
[snip]
READ ANY FILE GROUP
CHANGE NOTIFICATION
CREATE EXTERNAL JOB
161 rows selected.
this reply was made possible by using:
http://www.oracle.com/pls/db102/homepage
http://www.oracle.com/pls/db112/homepage
and free downloading and installing of:
http://www.oracle.com/technetwork/database/express-edition/overview/index.html -
When converting exchange rates xml from http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml
I'm getting problem with xmlns in root element.
CALL TRANSFORMATION triggers CX_XSLT_ABAP_CALL_ERROR, but only if there is xmlns attribute in first line in input xml:
<gesmes:Envelope xmlns:gesmes="http://www.gesmes.org/xml/2002-08-01" xmlns="http://www.ecb.int/vocabulary/2002-08-01/eurofxref">
Without this xmlns=..... (or when modifying e.g. abcxmlns= ) works following xslt fine:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:sap="http://www.sap.com/sapxsl" version="1.0">
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<xsl:copy>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="Cube/Cube">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<ROOT2>
<xsl:value-of select="@time"/>
</ROOT2>
<ROOT1>
<xsl:apply-templates select="Cube"/>
</ROOT1>
</asx:values>
</asx:abap>
</xsl:template>
<xsl:template match="Cube/Cube/Cube">
<loop>
<AMOUNT>
<xsl:value-of select="1"/>
</AMOUNT>
<CCYCODE>
<xsl:value-of select="@currency"/>
</CCYCODE>
<VALUE>
<xsl:value-of select="@rate"/>
</VALUE>
</loop>
</xsl:template>
</xsl:transform>
I'd appreciate if someone migh advise me how to alternate the xslt or tell me what the xmlns in input does.
Cheers
Edited by: Viktor Kunc on Sep 29, 2008 3:25 PMIf a namespace is specified on root level, it propagates down to all children, see:
http://www.w3.org/TR/REC-xml-names/scoping
The namespace is part of a name. So, if you have an element <Cube> as child of the root element <root xmlns="http://www.gesmes.org/xml/2002-08-01">, then
<xsl:apply-templates select="Cube"/>
won't be applied, since the qualified name of the element is not Cube but {http://www.gesmes.org/xml/2002-08-01}Cube
If you want the XSLT to work with and without namespace equally well, you have to work with local names in XPath expressions:
<xsl:apply-templates select="local-name() = 'Cube'"/>
The same holds for all XPath functions working with element names.
Usually, however, the namespace is part of the contract with the client and is
either obligatory to be used
or obligatory to be omitted.
But not both.
Regards,
Rüdiger -
Item Text in Service notification
Hi Expert,
I am working on Service notification, i am creating notification by using BAPI_ALM_NOTIF_CREATE, I an filling NOTITEM(Notification item for creation) table with valid REFOBJECTKEY and discription in DESCRIPT field. This is not updating the discription in line item. This is creating line item without text.
but for other notification type its updating the description.
Thanks
VikrantHow are you assigning the data? I don't see in your description if you are using the obligatory fields, and there's no single descript field.
This is the bapi template, as you can see notif_type and notifheader are obligatory, the rest is optional.
CALL FUNCTION 'BAPI_ALM_NOTIF_CREATE'
EXPORTING
* EXTERNAL_NUMBER =
notif_type =
notifheader =
* TASK_DETERMINATION = ' '
* SENDER =
* ORDERID =
* IMPORTING
* NOTIFHEADER_EXPORT =
* TABLES
* NOTITEM =
* NOTIFCAUS =
* NOTIFACTV =
* NOTIFTASK =
* NOTIFPARTNR =
* LONGTEXTS =
* KEY_RELATIONSHIPS =
* RETURN = -
I thought I'd share the fix to my problem for others that may be getting the same "no sim" message on their original iPhone.
I purchased a second hand iPhone on ebay in the UK and ordered a pay as you go sim from O2 (the 'official' iPhone carrier here in the UK). The phone arrived last weekend, the sim on Tuesday.
I put the sim in the phone (using the obligatory paper clip) and turned it on, to be met with a "no sim installed" message. I tried re-seating the sim, a sim from an Orange phone, restoring the iPhone from DFU mode, just about everything from this and other forums but no joy.
I contacted O2 who told me to go to a shop. The shop was useless, they followed a script which involved them ringing the same help desk that had advised me to go to the shop, then suggested I contact Apple.
I called Apple (in Ireland) and spoke to a very helpful guy who checked that I had done all of the things that I could. He eventually suggested that I go to the nearest genius bar as it sounded like a hardware problem.
Yesterday I had a meeting in London so stopped in the Regent Street Apple store. I was seen within 10 minutes (even though I had not made an appointment). The genius diagnosed a hardware problem and changed the phone within 5 minutes, got me to activate it using my O2 sim and confirmed that I had data and voice connectivity.
I now have a new, working iPhone. My advice to anyone with the same problem is to ignore the carrier support lines (who initially try to send you a new sim without actually understanding the problem) but go to an Apple store (but make an appointment first).See here:
http://discussions.apple.com/thread.jspa?threadID=2477751&start=0&tstart=60 -
Hi its urgent...help on selection screen parameters
Hi all,
I need help on selection screen parameters.
requirement is that,
i am having input fields for material, plant ,start date and end date and a check box and an input field for getting the txt file.
when i select the checkbox, it should ignore the mandatory fileds in the selection screen.
and when i get the file input, it should take the input data material, plant, start date and end date from the flat file and populate the corresponding input fields in selection screen.
How to do this..
thanks in advance.Hi ..
While declare the Matnr, Plant etc dont use the OBLIGATORY addition.
instead of the based on the value of check box validate them .
AT SELECTION-SCREEN.
IF c_box = ' '.
<< validate for mandatory fields>>
endif.
<b>REWARD IF HELPFUL.</b> -
Hi Experts, I am getting some error in the following code,can u suggest me a way to overcome tht error.
*& Report ZSELSCREEN *
REPORT ZSELSCREEN MESSAGE-ID Y6.
TABLES MARA.
SELECTION-SCREEN SKIP 1.
selection-screen BEGIN OF BLOCK BLOCK0 WITH FRAME TITLE TEXT-000.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF LINE.
selection-screen PUSHBUTTON 10(20) TEXT-003 USER-COMMAND ENGL.
selection-screen PUSHBUTTON 50(20) TEXT-004 USER-COMMAND GERM.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK BLOCK0.
selection-screen SKIP 2.
SELECTION-SCREEN BEGIN OF BLOCK BLOCK1 WITH FRAME TITLE TEXT-001 NO
INTERVALS.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : P_EX1 RADIOBUTTON GROUP RAD1.
SELECTION-SCREEN COMMENT 5(30) TEXT-EX1.
SELECTION-SCREEN END OF LINE.
PARAMETERS : P_DATE1 TYPE D DEFAULT 'SY-DATUM'.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : P_EX2 RADIOBUTTON group RAD1.
SELECTION-SCREEN COMMENT 5(30) TEXT-EX2.
SELECTION-SCREEN END OF LINE.
SELECT-OPTIONS S_JDATE2 FOR MARA-LAEDA.
SELECTION-SCREEN skip.
SELECTION-SCREEN BEGIN OF line.
parameters: P_EX3 RADIOBUTTON GROUP RAD1.
SELECTION-SCREEN COMMENT 5(30) TEXT-EX3.
SELECTION-SCREEN END OF LINE.
PARAMETERS : p_JDATE3 LIKE MARA-LAEDA.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : P_EX4 RADIOBUTTON GROUP RAD1.
SELECTION-SCREEN COMMENT 5(30) TEXT-EX4.
SELECTION-SCREEN END OF LINE.
SELECT-OPTIONS S_JDATE4 FOR MARA-LAEDA NO-EXTENSION no intervals.
SELECTION-SCREEN END OF BLOCK BLOCK1.
SELECTION-SCREEN BEGIN OF BLOCK BLOCK02 WITH frame TITLE TEXT-002 NO
INTERVALS.
SELECTION-SCREEN BEGIN OF LINE.
parameter: P_EX5 AS CHECKBOX.
SELECTION-SCREEN COMMENT 5(30) TEXT-EX5.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : P_EX7 AS CHECKBOX.
SELECTION-SCREEN COMMENT 5(30) TEXT-EX7.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS : P_EX6 AS checkbox.
SELECTION-SCREEN COMMENT 5(30) TEXT-EX6.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK BLOCK02.
AT SELECTION-SCREEN.
IF ( P_EX1 = 'X' ) AND (( P_JDATE1 = '' ) OR P_JDATE1 IS INITIAL )).
MESSAGE E017 WITH 'SELECTION OPTION WIHT DEFAULT FIELD HAS NO VALUE'.
ELSEIF ( P_EX1 = 'X')AND NOT (( P_JDATE1 = 'IEQ? ') OR ( P_JDATE1 IS
INITIAL)).
MESSAGE I017 WITH 'WE ARE NOW USING EXAMPLE 01'.
ENDIF.
IF ( P_EX2 = 'X') AND (( P_JDATE2 = 'IEQ?') OR P_JDATE2 IS INITIAL )).
MESSAGE E017 WITH 'SELECTION OPTION USING FOR FIELD HAS NO VALUE'.
ELSEIF ( P_EX2 = 'X')AND NOT ((P_JDATE2 = 'IEQ?') (OR P_JDATE2 IS
INITIAL)).
MESSAGE I017 WITH 'WE ARE NOW USING EXAMPLE 02'.
ENDIF.
IF ( P_EX3 = 'X') AND (( P_JDATE3 = 'IEQ?') OR P_JDATE3 IS INITIAL )).
MESSAGE E017 WITH 'PARAMETER WITH LIKE STATEMENT HAS NO FIELD VALUE'.
ELSEIF ( P_EX3 = 'X')AND NOT ((P_JDATE3 = 'IEQ?') (OR P_JDATE3 IS
INITIAL)).
MESSAGE I017 WITH 'WE ARE NOW USING EXAMPLE 03'.
ENDIF.
IF ( P_EX4 = 'X') AND (( P_JDATE4 = 'IEQ?') OR P_JDATE4 IS INITIAL )).
MESSAGE E017 WITH 'SELECTION OPTION WIHT NO INTERNAL VALUE OR HAS NO
VALUE'.
ELSEIF ( P_EX4 = 'X')AND NOT ((P_JDATE4 = 'IEQ?') (OR P_JDATE4 IS
INITIAL)).
MESSAGE I017 WITH 'WE ARE NOW USING EXAMPLE 04'.
ENDIF.
IF P_EX5.
PERFORM GET_PRICE_DATA.
ELSEIF P_EX6.
PERFORM GET_COST_DATA.
ELSEIF P_EX7.
PERFORM GET_REVENUE_DATA.
ENDIF.
now when i m executing the above code i m getting an error tht
IF ( P_EX1 = 'X' ) AND (( P_JDATE1 = '' ) OR P_JDATE1 IS INITIAL )) is unknown, it is neither in one of the defined tables or defined by the data statement .
can u help me to solve this problem.
Regards,
AbhinabHello Abhinab
Aside from Graham's suggestion another major reason for poor programming is due to poor organization of the coding.
I assume that for each radiobutton you wanted to check if either the date parameter or the date select-option is filled.
AT SELECTION-SCREEN.
" Assumption: p_jdate1 should be s_jdate1
IF ( p_ex1 = 'X' ) AND ( ( p_jdate1 = '' ) OR ( p_jdate1 IS INITIAL ) ).
MESSAGE e017 WITH 'SELECTION OPTION WIHT DEFAULT FIELD HAS NO VALUE'.
ELSEIF ( p_ex1 = 'X') AND NOT ( ( s_jdate1 = 'IEQ? ') OR ( s_jdate1 IS
INITIAL ) ).
MESSAGE i017 WITH 'WE ARE NOW USING EXAMPLE 01'.
ENDIF.
Since p_jdate1 must be filled you could just use the OBLIGATORY option of the PARAMETER statement.
S_JDATE1 is an itab with header line. Thus, you need to check its body whether it is filled or not:
PARAMETERS : p_jdate1 TYPE d DEFAULT 'SY-DATUM' OBLIGATORY.
AT SELECTION-SCREEN.
IF ( p_ex1 = 'X' ).
IF ( s_jdate1[] IS INITIAL ).
ELSE.
MESSAGE i017 WITH 'WE ARE NOW USING EXAMPLE 01'.
ENDIF.
ENDIF.
Regards
Uwe -
Selection-Subcreens & Error messages
Hi experts.
I have a report where i use selection-subscreens. Depending on wich subcreen i am, i need some select-options to be obligatory but i can't use the obligatory condition because it will give an error when navigating to other screen if there's no input.
So what i did is that at selection screen, i check the user command and when it's 'ONLI' (= report launched) if the required data is not field i send an error message like this :
CASE mytab_dynnr.
WHEN 100.
IF p_cont IS INITIAL.
MESSAGE text-e01 TYPE 'E'.
ENDIF.
WHEN 200.
ENDCASE.
The thing is that when sending this message then, the input filled can't be editable. I have to change screen and come back to edit again.
How can i avoid that ?
Thanks for your help and time.
For more information here is my selection screen and initialization :
SELECTION-SCREEN BEGIN OF SCREEN 100 AS SUBSCREEN.
SELECT-OPTIONS p_cont FOR but000-partner NO INTERVALS.
SELECTION-SCREEN END OF SCREEN 100.
SELECTION-SCREEN BEGIN OF SCREEN 200 AS SUBSCREEN.
SELECT-OPTIONS p_cont2 FOR but000-partner NO INTERVALS.
PARAMETERS p_test_c TYPE c AS CHECKBOX.
SELECTION-SCREEN : SKIP.
PARAMETERS: rt1 RADIOBUTTON GROUP rad2 ,
p_temp TYPE bu_partner.
SELECTION-SCREEN SKIP.
PARAMETERS: rt2 RADIOBUTTON GROUP rad2 DEFAULT 'X'.
*PARAMETERS : p_temp TYPE bu_partner.
*ULINE.
SELECT-OPTIONS p_meta FOR but000-zzmeta_customer NO INTERVALS.
SELECT-OPTIONS s_sold FOR but000-partner NO INTERVALS.
SELECT-OPTIONS s_inst FOR but000-partner NO INTERVALS.
SELECTION-SCREEN END OF SCREEN 200.
SELECTION-SCREEN BEGIN OF SCREEN 300 AS SUBSCREEN.
SELECT-OPTIONS p_cont3 FOR but000-partner NO INTERVALS.
PARAMETERS p_test_d TYPE c AS CHECKBOX.
SELECTION-SCREEN SKIP.
SELECT-OPTIONS p_meta2 FOR but000-zzmeta_customer NO INTERVALS.
SELECT-OPTIONS s_sold2 FOR but000-partner NO INTERVALS.
SELECT-OPTIONS s_inst2 FOR but000-partner NO INTERVALS.
SELECTION-SCREEN END OF SCREEN 300.
SELECTION-SCREEN: BEGIN OF TABBED BLOCK mytab FOR 10 LINES,
TAB (20) button1 USER-COMMAND push1,
TAB (20) button2 USER-COMMAND push2,
TAB (20) button3 USER-COMMAND push3,
END OF BLOCK mytab.
AT SELECTION-SCREEN.
CASE sy-dynnr.
WHEN 1000.
CASE sy-ucomm.
WHEN 'PUSH1'.
mytab-dynnr = 100.
WHEN 'PUSH2'.
mytab-dynnr = 200.
WHEN 'PUSH3'.
mytab-dynnr = 300.
WHEN 'ONLI'.
PERFORM screen_control USING mytab-dynnr.
WHEN OTHERS.
ENDCASE.
ENDCASE.
INITIALIZATION.
button1 = text-i01.
button2 = text-i02.
button3 = text-i03.
mytab-prog = sy-repid.
mytab-dynnr = 100.
mytab-activetab = 'PUSH1'.
w_repid = sy-repid.Instead of only message,
MESSAGE text-e01 TYPE 'E'.
Use:
message text-e01 type 'S' DISPLAY LIKE 'E'.
leave list-processing.
Regards,
Naimesh Patel -
Hi,
SELECTION-SCREEN: BEGIN OF BLOCK b1.
PARAMETERS:
p_datum LIKE sy-datum OBLIGATORY .
SELECT-OPTIONS:
p_vbeln FOR vbap-vbeln NO INTERVALS.
SELECTION-SCREEN: END OF BLOCK b1.
what is the use of Obligatory and no intervals?
Thanks,hi use validation for this ...u will get the result...
TABLES: vbak, ltak.
DATA:
err_sw.
PARAMETERS: rb1 RADIOBUTTON GROUP rb1 USER-COMMAND sel DEFAULT 'X'.
PARAMETERS: rb2 RADIOBUTTON GROUP rb1.
SELECTION-SCREEN: SKIP 1.
SELECTION-SCREEN: BEGIN OF BLOCK b1 WITH FRAME TITLE text-t01.
SELECT-OPTIONS: s_auart FOR vbak-auart DEFAULT 'ZRE'
NO INTERVALS MODIF ID rb1.
SELECT-OPTIONS: s_date FOR vbak-erdat MODIF ID rb1.
SELECTION-SCREEN: END OF BLOCK b1.
SELECTION-SCREEN: BEGIN OF BLOCK b2 WITH FRAME TITLE text-t02.
SELECT-OPTIONS: s_tanum FOR ltak-tanum MODIF ID rb2.
SELECT-OPTIONS: s_bdatu FOR ltak-bdatu MODIF ID rb2.
SELECTION-SCREEN: END OF BLOCK b2.
*____________________________________________ Screen Actions
AT SELECTION-SCREEN OUTPUT.
IF rb1 = 'X'.
PERFORM hide_rb2_options.
ELSE.
PERFORM hide_rb1_options.
ENDIF.
INITIALIZATION.
START-OF-SELECTION.
CLEAR err_sw.
IF rb1 = 'X'.
IF s_auart IS INITIAL
OR s_date IS INITIAL.
MESSAGE i208(00) WITH 'Required field not entered'.
err_sw = 'X'.
ENDIF.
ELSE.
IF s_tanum IS INITIAL
OR s_bdatu IS INITIAL.
MESSAGE i208(00) WITH 'Required field not entered'.
err_sw = 'X'.
ENDIF.
ENDIF.
CHECK err_sw NE 'X'.
WRITE:/ 'Hi!'.
*& Form hide_rb2_options
FORM hide_rb2_options.
LOOP AT SCREEN.
CASE screen-group1.
WHEN 'RB1'.
screen-active = 1.
MODIFY SCREEN.
WHEN 'RB2'.
screen-active = 0.
MODIFY SCREEN.
ENDCASE.
ENDLOOP.
ENDFORM. " hide_rb2_options
*& Form hide_rb1_options
FORM hide_rb1_options.
LOOP AT SCREEN.
CASE screen-group1.
WHEN 'RB2'.
screen-active = 1.
MODIFY SCREEN.
WHEN 'RB1'.
screen-active = 0.
MODIFY SCREEN.
ENDCASE.
ENDLOOP.
ENDFORM. " hide_rb1_options
regards,
venkat. -
Obligatory parameter when using standard BAPI
Hello,
We are creating a OData service using standard BAPI, BAPI_PO_GETITEMSREL.
we are getting following error after executing the purchase order collection:
Kindly help.
Regards,
AjayThis is the error again:
Receiver channel 'CC_Contrct_Recivr' for party '', service 'BS_SHD_901' (internal name 'RfcClient[CC_Contrct_Recivr]')
Client data: {jco.client.lang=EN, jco.client.snc_mode=0, jco.client.client=900, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=337710, jco.client.sysnr=55, jco.client.ashost=172.17.48.55}
Repository data: {jco.client.lang=EN, jco.client.snc_mode=0, jco.client.client=900, jco.client.passwd=******, jco.webas.ignore_jdsr_error=1, jco.client.user=333333, jco.client.sysnr=55, jco.client.ashost=172.17.48.55}
Current pool size: 5, maximum pool size : 50 -
Attaching text file using SO_NEW_DOCUMENT_ATT_SEND_API1
hello guys, i'm a newbie here.
I'm having trouble attaching an existing text file using function 'SO_NEW_DOCUMENT_ATT_SEND_API1'. It seems i can't find the right combination of parameters that are being passed to this function.
first, i'm using WS_UPLOAD to upload the text file to an internal table then i'm creating all the neccessary internal tables that will be use by this function..
By the way, i'm trying to send mail w/ attachments to external mail and SAPids. Below is my code.
REPORT ZHR_TESTEMAIL .
TABLES: USR02, PA0105, SOSU, SOUC, RLGRAP, IBIPPARMS, DYNPREAD, RSCSEL.
DATA: FOLD_YR(2) TYPE C,
FOLD_TYPE(3) TYPE C,
G_HEADER LIKE SOOD2,
G_FOLMAM LIKE SOFM2,
METHOD1 LIKE SY-UCOMM,
G_DOCUMENT LIKE SOOD4,
G_USER LIKE SOUDNAMEI1,
FOLD_NUMBER(12) TYPE C,
G_NEW_PARENT LIKE SOODK,
G_OWNER LIKE SOUD-USRNAM,
G_REF_DOCUMENT LIKE SOOD4,
G_USER_DATA LIKE SOUDATAI1,
G_AUTHORITY LIKE SOFA-USRACC,
G_OBJCNT LIKE SOLI OCCURS 0 WITH HEADER LINE,
G_OBJHEAD LIKE SOLI OCCURS 0 WITH HEADER LINE,
G_OBJPARA LIKE SELC OCCURS 0 WITH HEADER LINE,
G_OBJPARB LIKE SOOP1 OCCURS 0 WITH HEADER LINE,
G_RECIPIENTS LIKE SOOS1 OCCURS 0 WITH HEADER LINE,
G_REFERENCES LIKE SOXRL OCCURS 0 WITH HEADER LINE,
G_ATTACHMENTS LIKE SOOD5 OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF G_FILES OCCURS 10 ,
TEXT(4096) TYPE C,
END OF G_FILES.
DATA: BEGIN OF IT_WS_FILE OCCURS 0,
WS_FILE LIKE RLGRAP-FILENAME,
END OF IT_WS_FILE.
DATA: BEGIN OF IT_SAPID OCCURS 0,
SAPID LIKE USR02-BNAME,
END OF IT_SAPID.
DATA: BEGIN OF IT_EMAIL OCCURS 0,
EMAILADD LIKE PA0105-USRID_LONG,
END OF IT_EMAIL.
DATA: BEGIN OF IT_TSP01 OCCURS 0.
INCLUDE STRUCTURE TSP01.
DATA: END OF IT_TSP01.
DATA: BEGIN OF TAB2 OCCURS 50,
TEXT(200) TYPE C,
END OF TAB2.
DATA: V_DOCDATA TYPE SODOCCHGI1,
V_OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE,
V_OBJHEAD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
V_OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
V_OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE,
V_OBJHEX LIKE SOLIX OCCURS 0 WITH HEADER LINE,
IT_RECVRS TYPE SOMLRECI1 OCCURS 0 WITH HEADER LINE,
IT_CONTNT TYPE SOLISTI1 OCCURS 0 WITH HEADER LINE,
IT_BODY LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE,
V_TLIN TYPE I,
V_LINE TYPE I.
DATA: BEGIN OF IT_TEXTLINE OCCURS 500,
TEXTLINE(5000),
END OF IT_TEXTLINE.
DATA: FYL LIKE RLGRAP-FILENAME,
GV_SUBNO LIKE SOSU-SUBNO,
GV_EMAIL LIKE PA0105-USRID_LONG,
GV_NEXTDAY LIKE SY-DATUM,
YEAR(4) TYPE C,
RECFLAG TYPE C.
SELECTION-SCREEN BEGIN OF BLOCK PARAM WITH FRAME TITLE TEXT-001.
PARAMETERS: SUBJ(254) TYPE C OBLIGATORY, "Subject
DESC(254) TYPE C. "Message
SELECT-OPTIONS: SAPID FOR USR02-BNAME NO INTERVALS. "Recipient's SAP ID
SELECT-OPTIONS: EMAILADD FOR PA0105-USRID_LONG NO INTERVALS.
SELECTION-SCREEN END OF BLOCK PARAM.
SELECTION-SCREEN BEGIN OF BLOCK PARAM2 WITH FRAME TITLE TEXT-002.
SELECT-OPTIONS: WS_FILE FOR DYNPREAD-FIELDNAME NO INTERVALS.
SELECTION-SCREEN END OF BLOCK PARAM2.
SELECTION-SCREEN BEGIN OF BLOCK PARAM3 WITH FRAME TITLE TEXT-003.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: RBUT1 RADIOBUTTON GROUP A USER-COMMAND BUT. "Local PC
SELECTION-SCREEN COMMENT 5(20) FOR FIELD RBUT1.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: RBUT2 RADIOBUTTON GROUP A. "Server
SELECTION-SCREEN COMMENT 5(20) FOR FIELD RBUT2.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETERS: RBUT3 RADIOBUTTON GROUP A. "Spool
SELECTION-SCREEN COMMENT 5(20) FOR FIELD RBUT3.
PARAMETERS: SPOOLNUM LIKE RSPOTYPE-RQNUMBER. "Spool Number
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK PARAM3.
SELECTION-SCREEN BEGIN OF BLOCK PROC WITH FRAME TITLE TEXT-004.
SELECTION-SCREEN BEGIN OF LINE.
PARAMETER: BPROC AS CHECKBOX USER-COMMAND BCK. "Background Processing
SELECTION-SCREEN COMMENT 5(50) FOR FIELD BPROC.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN END OF BLOCK PROC.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR WS_FILE-LOW.
DATA: WS_FILE_TEMP TYPE IBIPPARMS-PATH.
CLEAR: WS_FILE_TEMP.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SY-REPID
DYNPRO_NUMBER = SY-DYNNR
FIELD_NAME = 'WS_FILE'
IMPORTING
FILE_NAME = WS_FILE_TEMP.
WS_FILE-LOW = WS_FILE_TEMP.
AT SELECTION-SCREEN.
SELECT SAPNAM FROM SOUC
INTO TABLE IT_SAPID
WHERE SAPNAM IN SAPID
AND DELETED = ''.
GV_NEXTDAY = SY-DATUM + 1.
LOOP AT EMAILADD.
IT_EMAIL-EMAILADD = EMAILADD-LOW.
APPEND IT_EMAIL.
CLEAR: IT_EMAIL.
ENDLOOP.
IF NOT BPROC IS INITIAL.
CLEAR: RBUT1, RBUT3.
RBUT2 = 'X'.
ELSE.
CLEAR: RBUT2.
ENDIF.
IF NOT RBUT3 IS INITIAL.
REFRESH: WS_FILE.
ENDIF.
IF SAPID IS INITIAL AND EMAILADD IS INITIAL.
MESSAGE E000(ZZ) WITH TEXT-201.
ELSEIF NOT SAPID IS INITIAL AND EMAILADD IS INITIAL.
CLEAR IT_SAPID.
READ TABLE IT_SAPID.
SELECT SINGLE SUBNO FROM SOSU
INTO GV_SUBNO
WHERE USRNO IN ( SELECT USRNO FROM SOUC
WHERE SAPNAM = IT_SAPID-SAPID ).
IF SY-SUBRC NE 0.
MESSAGE E000(ZZ) WITH TEXT-202.
ENDIF.
CLEAR: IT_SAPID.
ELSEIF NOT SAPID IS INITIAL AND NOT EMAILADD IS INITIAL.
CLEAR: IT_SAPID, IT_EMAIL.
READ TABLE IT_SAPID.
READ TABLE IT_EMAIL.
SELECT SINGLE SUBNO FROM SOSU
INTO GV_SUBNO
WHERE USRNO IN ( SELECT USRNO FROM SOUC
WHERE SAPNAM = IT_SAPID-SAPID ).
IF SY-SUBRC NE 0.
SUBMIT RSSOADM0 WITH USRNAM EQ IT_SAPID-SAPID
WITH NEW_SUBS EQ IT_EMAIL-EMAILADD
WITH SUB_ESC EQ 'U'
WITH EDAT EQ SY-DATUM
WITH BDAT EQ SY-DATUM
WITH BDAT EQ GV_NEXTDAY
WITH EDAT EQ '99991231'
WITH BTIM EQ SY-UZEIT
WITH ETIM EQ '240000'
WITH FORW_ALL EQ 'X'
WITH PSTHR2 EQ ''
AND RETURN.
ENDIF.
CLEAR: IT_SAPID.
ELSEIF NOT EMAILADD IS INITIAL AND SAPID IS INITIAL.
RECFLAG = 'X'.
ENDIF.
START-OF-SELECTION.
PERFORM B_SENDMAIL.
FORM B_SENDMAIL.
YEAR = SY-DATUM+0(4).
LOOP AT WS_FILE.
CLEAR: FYL.
FYL = WS_FILE-LOW.
REFRESH: TAB2.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = FYL
FILETYPE = 'BIN'
TABLES
DATA_TAB = TAB2.
IT_TEXTLINE[] = TAB2[].
DOCUMENT_DATA (SUBJECT OF MAIL)
V_DOCDATA-OBJ_NAME = DESC.
V_DOCDATA-OBJ_DESCR = SUBJ.
V_DOCDATA-OBJ_LANGU = SY-LANGU.
V_DOCDATA-SENSITIVTY = 'C'.
V_DOCDATA-OBJ_PRIO = '1'.
BODY OF MAIL
IT_BODY-LINE = 'Collection Report'.
APPEND IT_BODY.
CONTENTS_TXT (Attachments)
IT_CONTNT[] = IT_TEXTLINE[].
DESCRIBE TABLE IT_CONTNT LINES V_LINE.
READ TABLE IT_CONTNT INDEX V_LINE.
PACKING_LIST
V_OBJPACK-DOC_SIZE = ( V_LINE - 1 ) * 255 + STRLEN( IT_CONTNT ).
V_OBJPACK-TRANSF_BIN = 'X'.
V_OBJPACK-HEAD_START = 1.
V_OBJPACK-HEAD_NUM = 0.
V_OBJPACK-BODY_START = 1.
V_OBJPACK-BODY_NUM = V_LINE.
V_OBJPACK-DOC_TYPE = 'TXT'.
V_OBJPACK-OBJ_NAME = 'ATTACHMENT'.
V_OBJPACK-OBJ_DESCR = 'Attached Document'.
APPEND V_OBJPACK.
CLEAR V_OBJPACK.
RECEIVERS of mail
IF RECFLAG IS INITIAL.
LOOP AT IT_SAPID.
IT_RECVRS-RECEIVER = IT_SAPID-SAPID.
IT_RECVRS-REC_TYPE = 'B'.
IT_RECVRS-COM_TYPE = ''.
IT_RECVRS-EXPRESS = 'X'.
IT_RECVRS-NO_FORWARD = ''.
IT_RECVRS-NO_PRINT = ''.
APPEND IT_RECVRS.
CLEAR IT_RECVRS.
ENDLOOP.
ELSE.
LOOP AT EMAILADD.
IT_RECVRS-RECEIVER = EMAILADD-LOW.
IT_RECVRS-REC_TYPE = 'U'.
IT_RECVRS-COM_TYPE = 'INT'.
IT_RECVRS-EXPRESS = 'X'.
APPEND IT_RECVRS.
CLEAR IT_RECVRS.
ENDLOOP.
ENDIF.
OBJECT_HEADER (Filename)
CONCATENATE 'Collection Report' '_'
SY-DATUM+4(4) YEAR '.TXT'
INTO V_OBJHEAD-LINE.
V_OBJHEAD-LINE = FYL+16(25).
APPEND V_OBJHEAD.
CLEAR V_OBJHEAD.
Function Module For Sending Mail with Attachment
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = V_DOCDATA
TABLES
PACKING_LIST = V_OBJPACK
OBJECT_HEADER = V_OBJHEAD
CONTENTS_HEX = IT_CONTNT
CONTENTS_TXT = IT_BODY
RECEIVERS = IT_RECVRS
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 = 0.
MESSAGE S000(ZZ) WITH TEXT-005.
ELSE.
MESSAGE S000(ZZ) WITH TEXT-006.
ENDIF.
ENDLOOP.
end of my code *
please help me guys... when i run this program, DOCUMENT_NOT_SENT is what i always get..
waiting for ur reply... thank you vey much and godbless.Hi,
Try this sample code.
FORM SEND_TO_EMAIL USING zFName.
DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.
DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.
DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.
DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.
DATA: DOC_CHNG LIKE SODOCCHGI1.
DATA: TAB_LINES LIKE SY-TABIX.
DATA: ctmp(50) TYPE C.
Creation of the document to be sent
DOC_CHNG-OBJ_NAME = 'JOURNAL'.
CONCATENATE 'SAP Payroll Journal file Period' pybegda INTO ctmp
SEPARATED BY SPACE.
DOC_CHNG-OBJ_DESCR = cTmp.
OBJTXT = 'SAP Payroll Journal'.
APPEND OBJTXT.
CONCATENATE 'For Period' pybegda INTO ctmp
SEPARATED BY SPACE.
OBJTXT = ctmp.
APPEND OBJTXT.
CONCATENATE 'Attached File :' zFname INTO ctmp
SEPARATED BY SPACE.
OBJTXT = ctmp.
APPEND OBJTXT.
OBJTXT = 'Please find the attachment.'.
APPEND OBJTXT.
DESCRIBE TABLE OBJTXT LINES TAB_LINES.
READ TABLE OBJTXT INDEX TAB_LINES.
DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).
Creation of the entry for the compressed document
CLEAR OBJPACK-TRANSF_BIN.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 0.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'RAW'.
APPEND OBJPACK.
Creation of the document attachment
<b>LOOP AT xMail.
CONDENSE xMail-aline.
OBJBIN = xMail-aline.
APPEND OBJBIN.
CLEAR OBJBIN.
ENDLOOP.</b>
DESCRIBE TABLE OBJBIN LINES TAB_LINES.
OBJHEAD = zFname. APPEND OBJHEAD.
Creation of the entry for the compressed attachment
OBJPACK-TRANSF_BIN = 'X'.
OBJPACK-HEAD_START = 1.
OBJPACK-HEAD_NUM = 1.
OBJPACK-BODY_START = 1.
OBJPACK-BODY_NUM = TAB_LINES.
OBJPACK-DOC_TYPE = 'RAW'.
OBJPACK-OBJ_NAME = 'DATA'.
OBJPACK-OBJ_DESCR = 'SAP Payroll File'.
OBJPACK-DOC_SIZE = TAB_LINES * 255.
APPEND OBJPACK.
Completing the recipient list
LOOP AT PENERIMA.
CONDENSE PENERIMA-PNRM.
RECLIST-RECEIVER = PENERIMA-PNRM.
RECLIST-REC_TYPE = 'U'.
APPEND RECLIST.
ENDLOOP.
Sending the document
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
DOCUMENT_DATA = DOC_CHNG
PUT_IN_OUTBOX = ' '
TABLES
PACKING_LIST = OBJPACK
OBJECT_HEADER = OBJHEAD
CONTENTS_BIN = OBJBIN
CONTENTS_TXT = OBJTXT
RECEIVERS = RECLIST
EXCEPTIONS
TOO_MANY_RECEIVERS = 1
DOCUMENT_NOT_SENT = 2
OPERATION_NO_AUTHORIZATION = 4
OTHERS = 99.
CASE SY-SUBRC.
WHEN 0.
WRITE: / 'Result of the send process:'.
LOOP AT RECLIST.
WRITE: / RECLIST-RECEIVER(48), ':'.
IF RECLIST-RETRN_CODE = 0.
WRITE / 'The document was sent'.
ELSE.
WRITE / 'The document could not be sent'.
ENDIF.
ENDLOOP.
WHEN 1.
WRITE: / 'Too many receiver'.
WHEN 2.
WRITE: / 'Document could not be sent to any recipient'.
WHEN 4.
WRITE: / 'No send authorization'.
WHEN OTHERS.
WRITE: / 'Error occurred while sending'.
ENDCASE.
ENDFORM. -
Issue in creating sales order using BAPI's...?
Hi Guru's,
i had generated the sales order using the BAPI..but could please guide me how to declare the data declaratin same fields as globally and how to move internal table and how to append ....
thanks in advance...
REPORT z_bapi_salesorder_create.
Sales document type
PARAMETERS: p_auart TYPE auart OBLIGATORY.
Sales organization
PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
Distribution channel
PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
Division.
PARAMETERS: p_spart TYPE spart OBLIGATORY.
Sold-to
PARAMETERS: p_sold TYPE kunnr OBLIGATORY.
Ship-to
PARAMETERS: p_ship TYPE kunnr OBLIGATORY.
Material
PARAMETERS: p_matnr TYPE matnr OBLIGATORY.
Quantity.
PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.
Plant
PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
Data declarations.
DATA: v_vbeln LIKE vbak-vbeln.
DATA: header LIKE bapisdhead1.
DATA: headerx LIKE bapisdhead1x.
DATA: item LIKE bapisditem OCCURS 0 WITH HEADER LINE.
DATA: itemx LIKE bapisditemx OCCURS 0 WITH HEADER LINE.
DATA: partner LIKE bapipartnr OCCURS 0 WITH HEADER LINE.
DATA: return LIKE bapiret2 OCCURS 0 WITH HEADER LINE.
DATA: lt_schedules_inx TYPE STANDARD TABLE OF bapischdlx
WITH HEADER LINE.
DATA: lt_schedules_in TYPE STANDARD TABLE OF bapischdl
WITH HEADER LINE.
Start-of-selection.
START-OF-SELECTION.
Header data
Sales document type
header-doc_type = p_auart.
headerx-doc_type = 'X'.
Sales organization
header-sales_org = p_vkorg.
headerx-sales_org = 'X'.
Distribution channel
header-distr_chan = p_vtweg.
headerx-distr_chan = 'X'.
Division
header-division = p_spart.
headerx-division = 'X'.
headerx-updateflag = 'I'.
Partner data
Sold to
partner-partn_role = 'AG'.
partner-partn_numb = p_sold.
APPEND partner.
Ship to
partner-partn_role = 'WE'.
partner-partn_numb = p_ship.
APPEND partner.
ITEM DATA
itemx-updateflag = 'I'.
Line item number.
item-itm_number = '000010'.
itemx-itm_number = 'X'.
Material
item-material = p_matnr.
itemx-material = 'X'.
Plant
item-plant = p_plant.
itemx-plant = 'X'.
Quantity
item-target_qty = p_menge.
itemx-target_qty = 'X'.
APPEND item.
APPEND itemx.
Fill schedule lines
lt_schedules_in-itm_number = '000010'.
lt_schedules_in-sched_line = '0001'.
lt_schedules_in-req_qty = p_menge.
APPEND lt_schedules_in.
Fill schedule line flags
lt_schedules_inx-itm_number = '000010'.
lt_schedules_inx-sched_line = '0001'.
lt_schedules_inx-updateflag = 'X'.
lt_schedules_inx-req_qty = 'X'.
APPEND lt_schedules_inx.
Call the BAPI to create the sales order.
CALL FUNCTION 'BAPI_SALESDOCU_CREATEFROMDATA1'
EXPORTING
sales_header_in = header
sales_header_inx = headerx
IMPORTING
salesdocument_ex = v_vbeln
TABLES
return = return
sales_items_in = item
sales_items_inx = itemx
sales_schedules_in = lt_schedules_in
sales_schedules_inx = lt_schedules_inx
sales_partners = partner.
Check the return table.
LOOP AT return WHERE type = 'E' OR type = 'A'.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
WRITE: / 'Error in creating document'.
ELSE.
Commit the work.
COMMIT WORK AND WAIT.
call FUNCTION 'BAPI_TRANSACTION_COMMIT'.
WRITE: / 'Document ', v_vbeln, ' created'.
ENDIF.*& Report ZAREPAS30
REPORT zarepas30.
DATA : gs_vbeln TYPE vbak-vbeln,
gs_order_header_in TYPE bapisdhd1,
gs_order_header_inx TYPE bapisdhd1x,
gt_order_items_in TYPE STANDARD TABLE OF bapisditm,
gwa_itab1 TYPE bapisditm,
gt_order_items_inx TYPE STANDARD TABLE OF bapisditmx,
gwa_itab2 TYPE bapisditmx,
gt_order_partners TYPE STANDARD TABLE OF bapiparnr,
gwa_itab3 TYPE bapiparnr,
gt_return TYPE STANDARD TABLE OF bapiret2,
gwa_itab4 TYPE bapiret2.
Sales document type
PARAMETERS: p_auart TYPE auart OBLIGATORY.
Sales organization
PARAMETERS: p_vkorg TYPE vkorg OBLIGATORY.
Distribution channel
PARAMETERS: p_vtweg TYPE vtweg OBLIGATORY.
Division.
PARAMETERS: p_spart TYPE spart OBLIGATORY.
Requested Delivery Date
PARAMETERS: p_edatu TYPE edatu OBLIGATORY.
Sold-to
PARAMETERS: p_sold TYPE kunnr OBLIGATORY.
Ship-to
PARAMETERS: p_ship TYPE kunnr OBLIGATORY.
Material
PARAMETERS: p_matnr TYPE matnr OBLIGATORY.
Quantity.
PARAMETERS: p_menge TYPE kwmeng OBLIGATORY.
Plant
PARAMETERS: p_plant TYPE werks_d OBLIGATORY.
Start-of-selection.
START-OF-SELECTION.
Header data
Sales document type
gs_order_header_in-doc_type = p_auart.
gs_order_header_inx-doc_type = 'X'.
Sales organization
gs_order_header_in-sales_org = p_vkorg.
gs_order_header_inx-sales_org = 'X'.
Distribution channel
gs_order_header_in-distr_chan = p_vtweg.
gs_order_header_inx-distr_chan = 'X'.
Division
gs_order_header_in-division = p_spart.
gs_order_header_inx-division = 'X'.
Reguested Delivery Date
gs_order_header_in-req_date_h = p_edatu.
gs_order_header_inx-req_date_h = 'X'.
gs_order_header_inx-updateflag = 'I'.
Partner data
Sold to
gwa_itab3-partn_role = 'AG'.
gwa_itab3-partn_numb = p_sold.
APPEND gwa_itab3 TO gt_order_partners .
ship to
gwa_itab3-partn_role = 'WE'.
gwa_itab3-partn_numb = p_ship.
APPEND gwa_itab3 TO gt_order_partners .
ITEM DATA
gwa_itab2-updateflag = 'I'.
Line item number.
gwa_itab1-itm_number = '000010'.
gwa_itab2-itm_number = 'X'.
Material
gwa_itab1-material = p_matnr.
gwa_itab2-material = 'X'.
Plant
gwa_itab1-plant = p_plant.
gwa_itab2-plant = 'X'.
Quantity
gwa_itab1-target_qty = p_menge.
gwa_itab2-target_qty = 'X'.
APPEND gwa_itab1 TO gt_order_items_in.
APPEND gwa_itab2 TO gt_order_items_inx.
Line item number.
gwa_itab1-itm_number = '000020'.
gwa_itab2-itm_number = 'X'.
Material
gwa_itab1-material = p_matnr.
gwa_itab2-material = 'X'.
Plant
gwa_itab1-plant = p_plant.
gwa_itab2-plant = 'X'.
Quantity
gwa_itab1-target_qty = p_menge.
gwa_itab2-target_qty = 'X'.
APPEND gwa_itab1 TO gt_order_items_in.
APPEND gwa_itab2 TO gt_order_items_inx.
CALL FUNCTION 'BAPI_SALESORDER_CREATEFROMDAT2'
EXPORTING
order_header_in = gs_order_header_in
ORDER_HEADER_INX = gs_order_header_inx
IMPORTING
SALESDOCUMENT = gs_vbeln
tables
RETURN = gt_return
ORDER_ITEMS_IN = gt_order_items_in
ORDER_ITEMS_INX = gt_order_items_inx
order_partners = gt_order_partners.
Check the return table.
LOOP AT gt_return into gwa_itab4 WHERE type = 'E' OR type = 'A'.
EXIT.
ENDLOOP.
IF sy-subrc = 0.
WRITE: / 'Error occured while creating sales order '.
ELSE.
Commit the work.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
WRITE: / 'Document ', gs_vbeln, ' created'.
ENDIF. -
How to make use of logical database in reports?
hi,
I am working on a Cash Flow Forecast report, which requires the usage of 'PSJ' Logical Database for the selection screen with Profit Center(PRCTR) as one field and the other field being Period ( in MM/YYYY format).
I have not worked on Logical Database before. Since, its for the first time I am working on LDB, I require help on it.
How to proceed for this, can someone help me with it?
On receiving further inputs, I will proceed and might come up with some more queries.
Regards,
RaviHi Hari,
Thanks a lot for being so patient. yeah, I will just send you a code snippet of mine. My code is of 3000 Lines. Hence, I will send few parts of it. Just go through and let me know if you need any further information from my side.
Here is the snippet:
*& TABLES
TABLES: PROJ, "Project definition.
PRPS, "WBS Element Master Data
COSP, "CO: External Table.
COFP, "CO: External Table.
SETLEAF, "Value in sets.
FAGLFLEXT, "Profit Center.
S031, "Statistics: Movements for Current Stocks.
SETHEADERT, "short Description of Sets.
AFVC, "Operation within an Order.
AUFK, "Order master data.
PRHI, "Work Breakdown Structure.
AFKO, "Order header data PP orders.
NRIV, "Number range Intervals.
SKB1, "G/L Account Master (company code).
FMCI. "Commitments Item master data.
Type Pool
TYPE-POOLS: SLIS.
FIELD-SYMBOLS: <DYN_TABLE> TYPE STANDARD TABLE,
<DYN_WA>,
<DYN_FIELD>.
DATA: COUNT TYPE I,
D_PERIOL LIKE COFP-PERIO,
D_PERIOH LIKE COFP-PERIO,
D_GJAHRL LIKE COFP-GJAHR,
D_GJAHRH LIKE COFP-GJAHR,
D_GJAHR LIKE COFP-GJAHR,
D_PERIO LIKE COFP-PERIO,
OBJNR LIKE COSP-OBJNR,
PKOKR LIKE PRPS-PKOKR,
G_NRLEVEL LIKE NRIV-NRLEVEL,
G_BELNR LIKE COFP-BELNR,
I_OBJ-OBJNR LIKE COFP-OBJNR,
G_OPNGBAL LIKE FAGLFLEXT-HSL01,
G_PAYROLL LIKE COSP-WKG001,
G_PYROL_TAX LIKE COFP-WKGBTR,
G_PENSION LIKE COFP-WKGBTR,
G_BTLDGR LIKE COFP-WKGBTR,
G_REIMPYMT LIKE COFP-WKGBTR,
G_INTCORCPT LIKE COFP-WKGBTR,
G_CAPEXP LIKE COFP-WKGBTR,
G_SLSLDGR LIKE COFP-WKGBTR,
G_REIMRCPT LIKE COFP-WKGBTR,
G_TOTPYMNTS LIKE COFP-WKGBTR VALUE 0,
G_TOTRECPTS LIKE COFP-WKGBTR VALUE 0,
G_MVMTFRMNTH LIKE COFP-WKGBTR VALUE 0,
G_CLSGBAL LIKE COFP-WKGBTR VALUE 0.
DATA: LYEAR(4) TYPE N,
LMONTH1(2) TYPE N,
MON1(2) TYPE N.
DATA: HYEAR(4) TYPE N.
DATA: LMONTH(2) TYPE N.
DATA: HMONTH(2) TYPE N.
DATA: TOTAL(10) TYPE N.
DATA: SUM(10) TYPE N.
DATA: G_PSPID LIKE PROJ-PSPID.
DATA: TOTAL1 LIKE COFP-WKGBTR,
TOTAL2 LIKE COFP-WKGBTR.
DATA: G_KOKRS LIKE COFP-KOKRS,
G_FIPOS LIKE SKB1-FIPOS,
G_POSIT LIKE COFP-POSIT,
G_BUKRS LIKE COFP-BUKRS.
DATA: L_RACCT LIKE FAGLFLEXT-RACCT VALUE '0000220000',
H_RACCT LIKE FAGLFLEXT-RACCT VALUE '0000227999'.
DATA: I TYPE I VALUE '74'.
DATA: P TYPE I VALUE '62'.
*& SELECT-OPTIONS
PARAMETERS : S_PRCTR LIKE PROJ-PRCTR. "Profit Center
SELECT-OPTIONS: SL_SPMON FOR S031-SPMON OBLIGATORY. "Period
*INITIALIZATION
INITIALIZATION.
SL_SPMON-SIGN = C_IN.
SL_SPMON-OPTION = C_BT.
SL_SPMON-LOW = SL_SPMON.
SL_SPMON-HIGH = SL_SPMON.
APPEND SL_SPMON.
AT SELECTION-SCREEN
Event which occurs each time the user hits enter on the selection
Screen.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR SL_SPMON-LOW.
PERFORM MONAT_F4.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR SL_SPMON-HIGH.
PERFORM MONAT_F4.
SELECT SINGLE * FROM PROJ WHERE PRCTR = S_PRCTR.
IF SY-SUBRC <> 0 AND NOT ( S_PRCTR IS INITIAL ).
MESSAGE E019.
ENDIF.
ALL WBS ELEMENT SELECTION
SELECT PSPID INTO TABLE I_PROJTAB FROM PROJ WHERE PRCTR = S_PRCTR.
IF SY-SUBRC = 0.
LOOP AT I_PROJTAB.
CALL FUNCTION 'GET_TREE_FROM_PRHI'
EXPORTING
I_POSID = I_PROJTAB-PSPID
I_PSPNR = 00000000
NO_BUFFER = ' '
TABLES
PSP_TREE = I_PRHI
EXCEPTIONS
INPUT_ERROR = 1
PSP_HIERARCHY_ERROR = 2
PSP_NOT_FOUND = 3
OTHERS = 4
ENDLOOP. " PROJTAB
ENDIF.
SELECT * FROM PRPS INTO TABLE I_PRPSVC FOR ALL ENTRIES IN I_PRHI
WHERE PSPNR = I_PRHI-POSNR.
SELECT * FROM AFVC INTO TABLE I_AFVC FOR ALL ENTRIES IN I_PRPSVC
WHERE PROJN = I_PRPSVC-PSPNR.
SELECT * FROM AUFK INTO TABLE I_AUFK FOR ALL ENTRIES IN I_PRPSVC
WHERE PSPEL = I_PRPSVC-PSPNR AND AUTYP NE C_TWENTY.
SELECT OBJNR FROM PRPS INTO TABLE I_OBJ FOR ALL ENTRIES IN I_PRHI
WHERE PSPNR = I_PRHI-POSNR.
IF SY-SUBRC <> 0.
MESSAGE E010.
ENDIF.
I hope that's of some use.
Thanks & Regards,
Ravi
Maybe you are looking for
-
My Adobe Illustrator CS6 is not opening.
My Adobe Illustrator CS6 is not opening. every time I try to open it it gives me this window "To open "Adobe Illustrator CS6.app" you need to install the legacy Java SE 6 runtime." Has anyone comme across this and is there a solution for this I need
-
Facebook share & URL LINTER can't get the information of my WebSite
I'm very frustrated because I can't make my iWeb Page correctly shared on facebook. I have worked a lot on that page, and included in it interesting html codes; I even have used iWeb SEO Tool to added some title tags. However, when I try to share any
-
Why have my Mail rules decided to stop working?
Emails are all going straight to my main inbox all of a sudden, rather than being filed away in their appropriate folders (per the Rules I've set up). I've not changed any settings and can't see why the rules suddenly have decided to go on holiday! M
-
HT204053 i have old macbook pro and having problem finding where to down load icloud
How do add icloud to my Macbook pro wher do i go?
-
Helo all, We are replicating HR organization to SRM.All organization units and users have been replicated.But we have filled the attributes manually.My questions are: -Can we automate the 'attribute' replication/update as well?Any BADI that we can us