Selection Screen Data Validation
Hi All.
I have made a program with vendor and purchase order inputs. If I give the correct vendor and PO it works fine. I want to implement validation. For that I have an internal table with vendor and all the PO's raised on him. Now I have to validate 1. vendor, 2. PO and 3. if a PO not of that vendor is entered then to display a message. I tried some option but the error message comparing the vendor and PO doesn't work. Can anyone give an idea please. Tks & Best Regards.
Hi,
Validate Vendor in LFA1-LIFNR , PO in EKKO-EBELN
and combination as :
select EBELN LIFNR
from EKKO
into table itab
where EBELN = p_ebeln
and LIFNR = p_lifnr.
if sy-subrc ne 0.
Message 'error message'.
endif.
Regards,
Sachchidanand
Similar Messages
-
Selection screen data validation problem
Hello all,
Transaction FBL3N has an authority check on company. If the user enters a company for which they have no authority, a message displays and they can then exclude that company. The following steps can be repeated as many times as are required to ensure that all selection-screen values can be used. The program, RFITEMGL, is doing all of the authorization using the code of the logical database that is part of the program.
I added the following logic in my program, which works fine, except when the entered values fail the authority check, I can't get off of screen 1000 and get to the sub-screen to exclude the unauthorized values unless I first change the range on screen 1000.
For an example:
If I enter range '100 ' through '900 ', and there is an unauthorized company, '200' in that range, I can't add '200' as an excluded value without first changing the range to '100 ' to ' 199 ' on screen 1000.
Any thoughts on a solution? I tried looking at the logical database code without much success.
at selection-screen on s_bukrs.
check if person entering company has authority
data: i_t001 type table of t001.
data: w_t001 type t001.
select * from t001
into table i_t001
where bukrs in s_bukrs.
loop at i_t001 into w_t001.
authority-check object 'F_BKPF_BUK'
id 'BUKRS' field w_t001-bukrs
id 'ACTVT' field '03'.
if sy-subrc ne 0.
message e000(zf) with 'Company'
w_t001-bukrs
'not authorized'.
endif.
endloop.
Thanks
BruceHi,
Yes this is normal way as you entered wrong value in s_bukrs unless and until you change that you cannot proceed further.
instead of at selection-screen on s_bukrs.
use at selection-screen.
if s_bukrs is not initial.
do processing .,
and display info message'
endif.
or ., instead of error message use dispaly like 'E'
like.,
at selection-screen on s_bukrs.
check authority.,
MESSAGE 'You are not Authorized to use the Company Code' type 'S' display like 'E'.
hope this helps you,
Thanks & Regards. -
Tabstrip on selection screen and validations
Hi,
I need to validate the selection screen data which is entered in tab strips.
I need help in writing the validation for the data as below:
If the MATERIAL (on tab1) is blank then the fields on tab2 are mandatory.
AND if the MATERIAL (on tab1) is blank then the fields on tab2 are NOT mandatory.
The code is as follows
REPORT ztest123.
TABLES kna1.
TABLES : sscrfields, vbap.
DATA gv_activetab(6) TYPE c .
SELECTION-SCREEN BEGIN OF SCREEN 001 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
PARAMETERS p_matnr TYPE mara-matnr.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN END OF SCREEN 001.
SELECTION-SCREEN BEGIN OF SCREEN 002 AS SUBSCREEN.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
SELECT-OPTIONS: so_kunnr FOR kna1-kunnr NO INTERVALS NO-EXTENSION.
SELECT-OPTIONS: so_datum FOR vbap-erdat NO-EXTENSION." DEFAULT sy-datum.
SELECTION-SCREEN END OF BLOCK b2.
SELECTION-SCREEN END OF SCREEN 002.
SELECTION-SCREEN BEGIN OF TABBED BLOCK tabb1 FOR 5 LINES.
SELECTION-SCREEN TAB (15) tabs1 USER-COMMAND ucomm1 DEFAULT SCREEN 001.
SELECTION-SCREEN TAB (15) tabs2 USER-COMMAND ucomm2.
SELECTION-SCREEN END OF BLOCK tabb1.
AT SELECTION-SCREEN .
CASE sscrfields-ucomm.
WHEN 'UCOMM1'.
tabb1-prog = sy-repid.
tabb1-dynnr = 001.
tabb1-activetab = 'TABS1'.
gv_activetab = 'TABS1' .
WHEN 'UCOMM2'.
tabb1-prog = sy-repid.
tabb1-dynnr = 002.
tabb1-activetab = 'TABS2'.
gv_activetab = 'TABS2'.
ENDCASE.
START-OF-SELECTION.
CASE gv_activetab.
WHEN 'TABS1'.
WRITE: 'Material ' .
WHEN 'TABS2'.
WRITE: 'Plant '.
ENDCASE.you have to do 2 things
1) set fields mandatory
IF p_matnr IS INITIAL.
LOOP AT SCREEN.
IF screen-name EQ 'SO_KUNNR-LOW'.
screen-required = 1.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
ENDIF.
2) ensure the program is not run without a value, because the point 1 will be done only if user goes through tabstrip 2
AT SELECTION-SCREEN .
IF sscrfields-ucomm EQ 'ONLI'.
IF p_matnr IS INITIAL.
IF so_kunnr-low IS INITIAL.
sscrfields-ucomm = 'UCOMM2'.
ENDIF.
ENDIF.
ENDIF.
CASE sscrfields-ucomm.
WHEN 'UCOMM1'. -
Error which validating selection screen data in subroutine
Hi,this is my code
selection-screen begin of block b_selection with frame title text-001.
SELECT-OPTIONS: s_belnr for rbkp-belnr, "Invoice number
s_gjahr for rbkp-gjahr NO-EXTENSION NO INTERVALS, "Fiscal year
s_stat for rbkp-rbstat OBLIGATORY NO-EXTENSION DEFAULT c_status, "Invoice status
s_blart for rbkp-blart OBLIGATORY DEFAULT c_doc_type, "Document type
s_lifnr for rbkp-lifnr. "Vendor
selection-screen end of block b_selection.
at selection-screen.
select belnr gjahr from rbkp into table i_inv_data
where belnr IN s_belnr
and gjahr IN s_gjahr
and blart IN s_blart
and rbstat IN s_stat.
and lifnr IN s_lifnr.
if i_inv_data[] is initial.
message e000 with 'No record matching the search criteria'(001).
endif.
This is working fine...now when I try to modularise it, it is nt working
selection-screen begin of block b_selection with frame title text-001.
SELECT-OPTIONS: s_belnr for rbkp-belnr, "Invoice number
s_gjahr for rbkp-gjahr NO-EXTENSION NO INTERVALS, "Fiscal year
s_stat for rbkp-rbstat OBLIGATORY NO-EXTENSION DEFAULT c_status, "Invoice status
s_blart for rbkp-blart OBLIGATORY DEFAULT c_doc_type, "Document type
s_lifnr for rbkp-lifnr. "Vendor
selection-screen end of block b_selection.
at selection-screen.
perform sub_validate_data.
FORM SUB_VALIDATE_DATA.
select belnr gjahr from rbkp into table i_inv_data
where belnr IN s_belnr
and gjahr IN s_gjahr
and blart IN s_blart
and rbstat IN s_stat.
and lifnr IN s_lifnr.
if i_inv_data[] is initial.
message e000 with 'No record matching the search criteria'(001).
endif.
ENDFORM. " SUB_VALIDATE_DATA
the error which I m getting is ' IN s_belnr should be followd by an internal table'Please tell how can I modularize this code and put the checking part in subroutineIf I remove the period after s_stat your code is compiling without problems:
SELECTION-SCREEN BEGIN OF BLOCK b_selection WITH FRAME TITLE text-001.
SELECT-OPTIONS: s_belnr FOR rbkp-belnr,
s_gjahr FOR rbkp-gjahr NO-EXTENSION NO INTERVALS,
s_stat FOR rbkp-rbstat OBLIGATORY NO-EXTENSION DEFAULT 'X',
s_blart FOR rbkp-blart OBLIGATORY DEFAULT 'X',
s_lifnr FOR rbkp-lifnr.
SELECTION-SCREEN END OF BLOCK b_selection.
AT SELECTION-SCREEN.
PERFORM sub_validate_data.
*& Form SUB_VALIDATE_DATA
* text
FORM sub_validate_data.
SELECT belnr gjahr FROM rbkp INTO TABLE i_inv_data
WHERE belnr IN s_belnr
AND gjahr IN s_gjahr
AND blart IN s_blart
AND rbstat IN s_stat
AND lifnr IN s_lifnr.
IF i_inv_data[] IS INITIAL.
MESSAGE e000(oo) WITH 'No record matching the search criteria'(001).
ENDIF.
ENDFORM. " SUB_VALIDATE_DATA
Check, if you have an additional period somewhere else, or any other subtle differenec.
Michael -
Selection-screen fields validation for dialog
Hello ABAP Gurus
Requirements: this is a report wherein , depending upon the correct select-options , user will pick some field values from table and some will be entered by the user in the next se51 custom screen for creation of a record in a ztable .
the problem is :without validating select-options values , it calls the se51 screen 100.
How to keep the cursor at the selection-screen field until & unless user enters the correct i/p s .if i/p are correct then only it should call screen 100 otherwise remain in the selection screen only .
*& Report ZSD_REP_QUOT_BANK_CREATE *
REPORT ZSD_REP_QUOT_BANK_CREATE NO STANDARD PAGE HEADING LINE-SIZE 255.
TABLES: VBAK,VBAP,VBRK,ZSD_TABL_QOTBANK,MARA,KONV.
DATA: OK_CODE LIKE SY-UCOMM,
SAVE_OK_CODE LIKE SY-UCOMM,
WA_ITAB LIKE ZSD_TABL_QOTBANK,
ANSWER TYPE C,
COPIED ,
STS TYPE N,
EMGRP LIKE MARA-EXTWG,
QTY LIKE ZSD_TABL_QOTBANK-QTY,
UPRICE LIKE ZSD_TABL_QOTBANK-UPRICE,
TOT LIKE ZSD_TABL_QOTBANK-TOT,
INO LIKE VBAP-POSNR.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-000.
SELECT-OPTIONS: S_QTNO FOR ZSD_TABL_QOTBANK-QTNO
NO INTERVALS NO-EXTENSION OBLIGATORY,
S_ITNO FOR ZSD_TABL_QOTBANK-ITNO
NO INTERVALS NO-EXTENSION OBLIGATORY.
S_MATNO FOR ZSD_TABL_QOTBANK-MATNO
NO INTERVALS NO-EXTENSION. "
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN.
SELECT SINGLE VBTYP
INTO VBAK-VBTYP
FROM VBAK
WHERE VBELN IN S_QTNO.
IF SY-SUBRC EQ 0 AND VBAK-VBTYP NE 'B'.
MESSAGE I005(ZQOTBANK).
SET CURSOR FIELD S_QTNO-LOW.
SUBMIT (SY-REPID) VIA SELECTION-SCREEN.
ENDIF.
CLEAR WA_ITAB.
SELECT SINGLE QTNO ITNO
INTO WA_ITAB
FROM ZSD_TABL_QOTBANK
WHERE QTNO IN S_QTNO
AND ITNO IN S_ITNO.
IF SY-SUBRC EQ 0.
MESSAGE I001(ZQOTBANK).
SET CURSOR FIELD S_QTNO-LOW.
SET CURSOR FIELD S_ITNO-LOW.
SUBMIT (SY-REPID) VIA SELECTION-SCREEN.
ENDIF.
*START-OF-SELECTION.
END-OF-SELECTION.
CALL SCREEN 0100.
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS '0100'.
SET TITLEBAR '0100'.
ZSD_TABL_QOTBANK-QTNO = S_QTNO-LOW.
SELECT SINGLE BUKRS_VF VKORG VTWEG SPART KUNNR ERDAT BNDDT
KNUMV
INTO (ZSD_TABL_QOTBANK-CCODE,
ZSD_TABL_QOTBANK-SORG,
ZSD_TABL_QOTBANK-DISTCHAN,
ZSD_TABL_QOTBANK-DIV,
ZSD_TABL_QOTBANK-CUSTNO,
ZSD_TABL_QOTBANK-QTDAT,
ZSD_TABL_QOTBANK-QTVALDAT,
VBAK-KNUMV)
FROM VBAK
WHERE VBELN IN S_QTNO
AND VBTYP = 'B'.
IF SY-SUBRC EQ 0.
SELECT SINGLE KWMENG POSNR MATNR
INTO (QTY , INO , ZSD_TABL_QOTBANK-MATNO)
FROM VBAP
WHERE VBELN IN S_QTNO.
SELECT SINGLE EXTWG
INTO EMGRP
FROM MARA
WHERE MATNR EQ ZSD_TABL_QOTBANK-MATNO.
ZSD_TABL_QOTBANK-ITNO = INO.
ZSD_TABL_QOTBANK-EMATGRP = EMGRP.
ZSD_TABL_QOTBANK-QTY = QTY.
SELECT SINGLE KBETR
INTO UPRICE
FROM KONV
WHERE KNUMV = VBAK-KNUMV
AND KPOSN = INO
AND KSCHL = 'PR00'.
ENDIF.
ZSD_TABL_QOTBANK-UPRICE = UPRICE.
TOT = QTY * UPRICE .
ZSD_TABL_QOTBANK-TOT = TOT .
CLEAR: QTY, UPRICE, TOT.
QTY = ZSD_TABL_QOTBANK-CGL_QTY.
UPRICE = ZSD_TABL_QOTBANK-CGL_UPRICE .
TOT = QTY * UPRICE .
ZSD_TABL_QOTBANK-CGL_TOT = TOT .
CLEAR: QTY, UPRICE, TOT.
QTY = ZSD_TABL_QOTBANK-BHEL_QTY.
UPRICE = ZSD_TABL_QOTBANK-BHEL_UPRICE .
TOT = QTY * UPRICE .
ZSD_TABL_QOTBANK-BHEL_TOT = TOT .
CLEAR: QTY, UPRICE, TOT.
QTY = ZSD_TABL_QOTBANK-BHEL_QTY.
UPRICE = ZSD_TABL_QOTBANK-BHEL_UPRICE .
TOT = QTY * UPRICE .
ZSD_TABL_QOTBANK-BHEL_TOT = TOT .
CLEAR: QTY, UPRICE, TOT.
QTY = ZSD_TABL_QOTBANK-ALSTOM_QTY.
UPRICE = ZSD_TABL_QOTBANK-ALSTOM_UPRICE .
TOT = QTY * UPRICE .
ZSD_TABL_QOTBANK-ALSTOM_TOT = TOT .
CLEAR: QTY, UPRICE, TOT.
QTY = ZSD_TABL_QOTBANK-SIEMENS_QTY.
UPRICE = ZSD_TABL_QOTBANK-SIEMENS_UPRICE .
TOT = QTY * UPRICE .
ZSD_TABL_QOTBANK-SIEMENS_TOT = TOT .
CLEAR: QTY, UPRICE, TOT.
QTY = ZSD_TABL_QOTBANK-TELK_QTY.
UPRICE = ZSD_TABL_QOTBANK-TELK_UPRICE .
TOT = QTY * UPRICE .
ZSD_TABL_QOTBANK-TELK_TOT = TOT .
CLEAR: QTY, UPRICE, TOT.
QTY = ZSD_TABL_QOTBANK-OTH_QTY.
UPRICE = ZSD_TABL_QOTBANK-OTH_UPRICE .
TOT = QTY * UPRICE .
ZSD_TABL_QOTBANK-OTH_TOT = TOT .
CLEAR: QTY, UPRICE, TOT.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
CASE OK_CODE.
WHEN 'SAVE'.
INSERT ZSD_TABL_QOTBANK.
IF SY-SUBRC EQ 0.
MESSAGE I000(ZQOTBANK).
COMMIT WORK.
CALL SELECTION-SCREEN 1000.
ELSE.
MESSAGE E001(ZQOTBANK).
CALL SELECTION-SCREEN 1000.
ENDIF.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Module EXIT_COMMAND INPUT
text
MODULE EXIT_COMAND INPUT.
SAVE_OK_CODE = OK_CODE.
CLEAR OK_CODE.
CASE SAVE_OK_CODE.
WHEN 'CANCEL'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = 'Quotation Bank Entry'
TEXT_QUESTION = 'Do you want to Cancel ?'
TEXT_BUTTON_1 = 'Yes'
TEXT_BUTTON_2 = 'No'
DEFAULT_BUTTON = '2'
IMPORTING
ANSWER = ANSWER.
IF ANSWER = '1'.
LEAVE PROGRAM.
ELSE.
CALL SELECTION-SCREEN 1000.
ENDIF.
WHEN 'EXIT'.
CALL FUNCTION 'POPUP_TO_CONFIRM'
EXPORTING
TITLEBAR = 'Quotation Bank Entry'
TEXT_QUESTION = 'Do you want to Exit ?'
TEXT_BUTTON_1 = 'Yes'
TEXT_BUTTON_2 = 'No'
DEFAULT_BUTTON = '2'
IMPORTING
ANSWER = ANSWER.
IF ANSWER = '1'.
LEAVE PROGRAM.
ELSE.
CALL SELECTION-SCREEN 1000.
ENDIF.
ENDCASE.
ENDMODULE. " EXIT_COMMAND INPUT
Thnx in AdvancePut the statement
CALL SCREEN 100
in the event <b>AT SELECTION-SCREEN</b> and NOT in <b>END-OF-SELECTION</b>.
Regards,
Subramanian V. -
To display selection screen date parameter in smart form
Hi to all
My requirement is to display date parameters which are given at selection screen (module pool program ) on the smart forms.
I just want to dispaly this on selection.
SO_BLDAT-LOW
SO_BLDAT-HIGH
Please guide.
Regards
AnubhavHi,
If you are calling the smartform from the module program then export the parameters from the calling FM
and import the same in the smartform.
Regards,
Sandeep -
Selection Screen - Date and Time
Hi,
I have given a selection screen where the user needs to key in the input in the following format
dd.mm.yyyy hh:mm:ss.
Reason is that the database fetching these elements accepts only in this criteria.
Now as they look into automating this program, they would want to automatically take the current system date and time - 24 hours .
How do I achieve this in the above format? If this is not possible, let me know if i can make the selection screen with normal sap date format and convert it to the above format on passing to the select statement.
Regards
SamHi Sam,
See this. Is this your requirement.
With this we are able to get Current time-stamp to selection parameter.
REPORT ZTEST.
DATA: L_TS TYPE TZNTSTMPS,
L_TS_C TYPE CHAR14.
PARAMETERS:
P_TMSTMP TYPE TMSTMP OBLIGATORY MEMORY ID TEST.
INITIALIZATION.
GET TIME STAMP FIELD L_TS.
MOVE L_TS TO L_TS_C.
SET PARAMETER ID 'TEST' FIELD L_TS_C.
The output is
Jogeswara Rao K -
Selection screen parameter validation using search help/check table
Hi experts,
I have a select-option that is tied to a search help and check table (type tq80-qmart). Is there a way to automatically validate the field based on what comes up in the F4 search help? What I mean is, when the user hits F4 on the parameter, the list pops up with several records that the user can choose. When the program is executed, I want the program to show an error if the value is NOT in that F4 list.
I know this can be done in AT SELECTION SCREEN event with a select, but I was wondering if there was a way ABAP does it automatically. Any help will be greatly appreciated.
Thanks,
JuanHello Juan,
SAP does have a standard way of allowing the the user to select from the list via LISTBOX.
But list box is restricted to parameters only, you cannot attach list boxes to select-options.
I think the best place to do this validation would be th AT SELECTION-SCREEN event & from your original post it seems you know what code to write -
Filtering of the data based upon the selection screen data using ldb
Hi Experts ,
I am using ldb pnpce, for my report ,and i created my own report category with selection paramaters
action type and payroll area
now the problem is when i am giving the action type as Z0 ,the data to be extracted is not getting filtered
based upon the action type ,the data consists the records having different action types other than Z0
Please give me some solution for thisThanks Durga ,but the link wat ever u was for hiding the selection screen fields
but my question is when am using get pernr event my data is not getting filtered with the selection screen paramater value
i,e m giving action type as only hiring ,but m getting the data for all the action types ,its not filtering based upon my selection -
Displaying selection screen data on alv header in multiple rows and columns
Hi
Presently in my requirement , whatever the data entered in selection screen should display on alv header and item details on alv grid display.
for eg...
on alv header
customer no : 1000 to 2000 sales order no: 111
name : gff to ff sales org:
city: country:
item details below this
plz guide me how to solve this issue.
Thanks & Regards,
PradeepHi,
Check this code this may help you.
<code>
TYPE-POOLS : SLIS.
TABLES VBRK.
TYPES : BEGIN OF TY_VBRK,
VBELN TYPE VBRK-VBELN,
VKORG TYPE VBRK-VKORG,
VTWEG TYPE VBRK-VTWEG,
SPART TYPE VBRK-SPART,
FKDAT TYPE VBRK-FKDAT,
END OF TY_VBRK,
BEGIN OF TY_VBRP,
VBELN TYPE VBRP-VBELN,
POSNR TYPE VBRP-POSNR,
MATNR TYPE VBRP-MATNR,
ARKTX TYPE VBRP-ARKTX,
FKIMG TYPE VBRP-FKIMG,
NETWR TYPE VBRP-NETWR,
END OF TY_VBRP,
BEGIN OF TY_TARGET,
VBELN TYPE VBRK-VBELN,
VKORG TYPE VBRK-VKORG,
VTWEG TYPE VBRK-VTWEG,
SPART TYPE VBRK-SPART,
FKDAT TYPE VBRK-FKDAT,
POSNR TYPE VBRP-POSNR,
MATNR TYPE VBRP-MATNR,
ARKTX TYPE VBRP-ARKTX,
FKIMG TYPE VBRP-FKIMG,
NETWR TYPE VBRP-NETWR,
END OF TY_TARGET.
DATA : T_VBRK TYPE TABLE OF TY_VBRK,
W_VBRK TYPE TY_VBRK,
T_VBRP TYPE TABLE OF TY_VBRP,
W_VBRP TYPE TY_VBRP,
T_TARGET TYPE TABLE OF TY_TARGET,
W_TARGET TYPE TY_TARGET,
FIELD CATALOG ******************
T_FCAT TYPE SLIS_T_FIELDCAT_ALV,
W_FCAT TYPE SLIS_FIELDCAT_ALV,
*************************************SUB TOTALS AND SORTING***********
T_SORT TYPE SLIS_T_SORTINFO_ALV,
W_SORT TYPE SLIS_SORTINFO_ALV,
*************************************FOR LIST HEADER******************
T_LIST_HEAD TYPE SLIS_T_LISTHEADER,
W_LIST_HEAD TYPE SLIS_LISTHEADER,
T_LIST_HEAD1 TYPE SLIS_T_LISTHEADER,
W_LIST_HEAD1 TYPE SLIS_LISTHEADER,
*************************************FOR LIST HEADER******************
W_LAYOUT TYPE SLIS_LAYOUT_ALV,
************************************FOR EVENTS************************
T_EVENT TYPE SLIS_T_EVENT,
W_EVENT TYPE SLIS_ALV_EVENT.
*********************************SELECT OPTIONS***********************
SELECT-OPTIONS : S_VBELN FOR VBRK-VBELN DEFAULT 90005316 TO 90005330.
**RETRIVING DATA************************
PERFORM DATA_RETRIVE.
**BUILDING THE FIELD CATALOG************
PERFORM BUILD_FCAT.
**BUILDING THE TABLE FOR LIST HEADER****
PERFORM BUILD_LIST_HEAD.
*******************************CALLING THE FUNCTION MODULE************
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_TOP_OF_PAGE = 'LIST_TOP_OF_PAGE'
IT_FIELDCAT = T_FCAT
IT_SORT = T_SORT
TABLES
T_OUTTAB = T_TARGET.
*& Form DATA_RETRIVE
FORM DATA_RETRIVE .
SELECT VBELN VKORG VTWEG SPART FKDAT FROM VBRK INTO CORRESPONDING FIELDS
OF TABLE T_VBRK WHERE VBELN IN S_VBELN.
IF SY-SUBRC EQ 0.
SORT T_VBRK BY VBELN.
SELECT VBELN POSNR MATNR ARKTX FKIMG NETWR FROM VBRP INTO TABLE
T_VBRP FOR ALL ENTRIES IN T_VBRK WHERE VBELN = T_VBRK-VBELN.
ENDIF.
LOOP AT T_VBRP INTO W_VBRP.
LOOP AT T_VBRK INTO W_VBRK WHERE VBELN = W_VBRP-VBELN.
W_TARGET-VBELN = W_VBRK-VBELN.
W_TARGET-VKORG = W_VBRK-VKORG.
W_TARGET-VTWEG = W_VBRK-VTWEG.
W_TARGET-SPART = W_VBRK-SPART.
W_TARGET-FKDAT = W_VBRK-FKDAT.
W_TARGET-POSNR = W_VBRP-POSNR.
W_TARGET-MATNR = W_VBRP-MATNR.
W_TARGET-ARKTX = W_VBRP-ARKTX.
W_TARGET-FKIMG = W_VBRP-FKIMG.
W_TARGET-NETWR = W_VBRP-NETWR.
APPEND W_TARGET TO T_TARGET.
ENDLOOP.
ENDLOOP.
SORT T_TARGET BY VBELN.
ENDFORM. " DATA_RETRIVE
*& Form BUILD_FCAT
FORM BUILD_FCAT .
W_FCAT-COL_POS = 1.
W_FCAT-FIELDNAME = 'VBELN'.
W_FCAT-SELTEXT_M = 'BILLING NO'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 2.
W_FCAT-FIELDNAME = 'VKORG'.
W_FCAT-SELTEXT_M = 'SALES ORGANIZATION'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 3.
W_FCAT-FIELDNAME = 'VTWEG'.
W_FCAT-SELTEXT_M = 'DISTRIBUTION CHANNEL'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 4.
W_FCAT-FIELDNAME = 'SPART'.
W_FCAT-SELTEXT_M = 'DIVISION'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 5.
W_FCAT-FIELDNAME = 'FKDAT'.
W_FCAT-SELTEXT_M = 'CREATION DATE'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 6.
W_FCAT-FIELDNAME = 'POSNR'.
W_FCAT-SELTEXT_M = 'BILLING ITEM'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 7.
W_FCAT-FIELDNAME = 'MATNR'.
W_FCAT-SELTEXT_M = 'MATERIAL NUM'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 8.
W_FCAT-FIELDNAME = 'ARKTX'.
W_FCAT-SELTEXT_M = 'DESCRIPTION'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 9.
W_FCAT-FIELDNAME = 'FKIMG'.
W_FCAT-SELTEXT_M = 'QUANTITY'.
APPEND W_FCAT TO T_FCAT.
W_FCAT-COL_POS = 10.
W_FCAT-FIELDNAME = 'NETWR'.
W_FCAT-SELTEXT_M = 'NET VALUE'.
W_FCAT-DO_SUM = 'X'.
APPEND W_FCAT TO T_FCAT.
ENDFORM. " BUILD_FCAT
*& Form BUILD_LIST_HEAD
FORM BUILD_LIST_HEAD .
DATA : L_DATE(10),
L_TIME(8).
W_LIST_HEAD-TYP = 'S'.
W_LIST_HEAD-KEY = 'Sales org :'.
W_LIST_HEAD-INFO = S_VBELN-LOW .
APPEND W_LIST_HEAD TO T_LIST_HEAD.
CLEAR W_LIST_HEAD.
W_LIST_HEAD-TYP = 'S'.
W_LIST_HEAD-KEY = 'TO '.
W_LIST_HEAD-INFO = S_VBELN-HIGH.
APPEND W_LIST_HEAD TO T_LIST_HEAD.
CLEAR W_LIST_HEAD.
ENDFORM. " BUILD_LIST_HEAD
*& Form LIST_TOP_OF_PAGE
FORM LIST_TOP_OF_PAGE .
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = T_LIST_HEAD.
ENDFORM. " LIST_TOP_OF_PAGE
<code>
Regards -
Selection screen :data retrieval
how to pass the contents of each individual input fieldfrom the selection screen to the ABAP program.My selection screen is
SELECTION-SCREEN BEGIN OF BLOCK ID WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS:
EBELN FOR EKKO-EBELN NO INTERVALS,
AEDAT FOR EKKO-AEDAT.
SELECTION-SCREEN END OF BLOCK ID.
i need value of ebeln(purchase order) which i select on selection screen as i have to use it in query in same program.Hi,
You can get the details in an internal table<b> i_ekko</b> as shown below.Use this table for further procesing in your program.
SELECTION-SCREEN BEGIN OF BLOCK ID WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS:
S_EBELN FOR EKKO-EBELN NO INTERVALS,
S_AEDAT FOR EKKO-AEDAT.
SELECTION-SCREEN END OF BLOCK ID.
DATA: i_ekko type standard table of ekko with header line.
SELECT * FROM EKKO INTO TABLE i_lfa1 WHERE ebeln IN s_ebeln AND aedat IN s_aedat.
*Always reward points for helpful answers.
Regards,
Amit
Message was edited by:
Amit Kumar -
Urgent :Show all records till selection screen date
Hi Techis
i want to show all records till selected date , selection screen consist of date also and my select statement is given below so any body pls tell me what changes i hav to make so that all records till particular date should b shwn
Select statement is
SELECT BUKRS KUNNR
BLDAT
GSBER
DMBTR
BUDAT
GJAHR
SGTXT
SAKNR
SHKZG
PRCTR FROM BSID INTO corresponding fields of TABLE IT_FINAL WHERE BUKRS IN S_BUKRS AND
SAKNR IN S_SAKNR AND
GSBER IN S_GSBER AND
PRCTR IN S_PRCTR AND
BUDAT IN S_BUDAT AND
KOSTL IN S_KOSTL.
and selection screen is ...
SELECTION-SCREEN BEGIN OF BLOCK AGE WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS : S_BUKRS FOR BSID-BUKRS," OBLIGATORY DEFAULT 'TCIL'
S_KUNNR FOR KNA1-KUNNR,
S_SORTL FOR KNA1-SORTL,
S_SAKNR FOR BSID-SAKNR DEFAULT '15110013',
S_KTOKD FOR KNA1-KTOKD ,"OBLIGATORY DEFAULT 'LTOB'
S_GSBER FOR BSID-GSBER,
S_PRCTR FOR BSID-PRCTR,
S_KOSTL FOR BSID-KOSTL,
S_GJAHR FOR BKPF-GJAHR," OBLIGATORY.
S_BUDAT FOR BSID-BUDAT DEFAULT SY-DATUM."OPEN ITEM DATE
*PARAMETERS : P_BUDAT LIKE BSID-BUDAT DEFAULT SY-DATUM." OBLIGATORY.
SELECTION-SCREEN END OF BLOCK AGE.
rewars for help ful ansHi Santosh,
If your requirement is up to the selection date you'd better use a parameter (which can only hold one value).
Then define a range in your program:
DATA:
zlt_budat_range TYPE RANGE OF budat,
zls_budat_range LIKE LINE OF zlt_budat_range.
zls_budat_range-sign = 'I'.
zls_budat_range-option = 'LE'.
zls_budat_range-low = pa_budat.
APPEND zls_budat_range TO zlt_budat_range.
.....AND budat IN zlt_budat_range.
Regards,
John. -
SELECTION-SCREEN FIELD VALIDATION
Hi All!
I am trying to write this ABAP program in 4.7 Enterprise. I wish to selectively display (based on radio buttons) selection screen blocks and make them mandatory in runtime. I use code like this:
AT SELECTION-SCREEN ON SAL_ORG. (this is one of the fields that will be obligatory)
IF RD2 EQ 'X'.
IF SAL_ORG IS INITIAL.
MESSAGE 'THIS FIELD IS MANDATORY' TYPE 'I'.
ENDIF.
ENDIF.
Now, if I execute this as is, then I will get this message as soon as the block is displayed, not just after hitting the execution button. Can you please tell me how I should put a condition on this checking. I know it is triggered by SY-UCOMM = 'ONLI' but i am not sure where to put the condition.
Thanks in advance!hello J.C.!
this is what worked for me finally:
AT SELECTION-SCREEN.
CHECK sy-ucomm EQ 'ONLI'.
IF RD2 EQ 'X'.
IF SAL_ORG IS INITIAL.
MESSAGE 'THIS FIELD IS MANDATORY' TYPE 'I'.
ENDIF.
ENDIF.
SAP says sscrfields-ucomm is unrecognized. can you please tell me what it is actually? why did you prefer using it instead of SY-UCOMM? If possible, please direct me to some good reference on calling selection screen.
I have given your answer 10 points by the way. I am very new here, so i don't know what exactly it's role is, but i figured it is something significant. -
Selection screen data in column heading
Hi,
My requirement is to show the value entered in the selection screen in the report output column heading using text elements.
I am using text element to show the column heading. how can i add a variable to the text element and pass the value to it ?
Thanks,
Prasad.Hi,
Its not possible to pass on the variables with the text elements, as text elements are used storing the text written by you in the program and not the values of the variable.
hence if you want to display the column heading with the variable you can directly write text element first and then write the variable,
write : text-001, w_variable.
Regards,
Siddarth -
At selection screen output validation
Hi to all experts.
i have requirement when user selects the download radio button then only the file path should be made mandatory . can be doneHi Dude,
For screen fields handling we have a structure called SCREEN..by using this structure we have to handle this...
parameters: ps_parm as listbox visible length 10
user-command abc.
* Radio buttons
parameters: rb1 radiobutton group ab modif id bl2,
rb2 radiobutton group ab modif id bl2,
rb3 radiobutton group ab modif id bl3.
initialization.
* Populate list box values
name = 'PS_PARM'.
value-key = '1'. value-text = 'Line 1'. append value to list.
value-key = '2'. value-text = 'Line 2'. append value to list.
at selection-screen output.
* Set list box with value
call function 'VRM_SET_VALUES'
exporting
id = name
values = list.
* Control the display of screen components
loop at screen.
if ps_parm = 1.
if screen-name = 'RB1' or screen-name = 'RB2' .
screen-invisible = 0.
elseif screen-name = 'RB3'.
screen-invisible = 1.
endif.
modify screen.
elseif ps_parm = 2. if screen-name = 'RB1' or screen-name = 'RB2' .
screen-invisible = 1.
elseif screen-name = 'RB3'.
screen-invisible = 0.
endif.
modify screen.
elseif ps_parm = space.
rb1 = 'X'.
clear: rb2,rb3.
if screen-name = 'RB1' or screen-name = 'RB2' or
screen-name = 'RB3'. screen-invisible = 0.
modify screen.
endif.
endif. endloop.
at selection-screen.
if sscrfields-ucomm = 'ABC'. endif.
start-of-selection.
write: / 'Parameter:', ps_parm.
Maybe you are looking for
-
Can no longer open itunes Error:2096
Ok-using itunes for windows for years. No problem. I tried to up date to the latest itunes version I am getting the message: Error:2096 Quicktime is reguired to run itunes. Please uninstall and then reinstall itunes. I have done this several times. I
-
!!!Urgent!!! purchase order
when i am checking po is existing its getting correct value then i need to check if the po exists and its item doesnt exit it should show me an error as an list how cani do it
-
Delivery status of a sales order
Hi, I have a requirement wherein I need to extract the delivery status from a sales order. VA03 --> Header Info --> Status In this screen you have the various processing status. From that I need to pick up the delivery status.The corresponding field
-
Gray screen (no verbose mode, na target mode, no nothing)
My late 2007 Macbook Pro just freezed on the spinning ball while browsing Internet. After forced shutdown, I now have the gray screen (without the Apple logo or the spinner) and it won't go past it, while maxing out RPMs on the fans. Strange thing is
-
I am a Volunteer here, not employed by HP. You too can become an HP Expert! Details HERE! If my post has helped you, click the Kudos Thumbs up! If it solved your issue, Click the "Accept as Solution" button so others can benefit from the question you