I NEED FIELDS FROM VBFA TABLE
HI ALL,
I NEED FIELDS FROM VBFA TABLE
THE FIELDS I WANT IS :
CUSTOMER-ID
CUSTOMER NAME
CONTACT NAME
PROJECTID
ORDER NO
SALES MAN ID
ORDER PROCESS DATE
INVOICE DATE
GROSS AMOUNT
NET AMOUNT POSTAL CODE.
THANKS & REGARDS,
R.VINOD.
Hi Vinod..
Try this Code. I made all the modifications in your code .. It will solve ur issues..
REPORT zsdr_omvsa40.
TYPE-POOLS
TYPE-POOLS: slis.
TABLE DECLARATIONS
TABLES : vbak, vbkd,
zzvbak,
kna1, vbrk, vbrp, knvp .
INTERNALTABLE DECLARATION *
DATA: BEGIN OF i_vbak OCCURS 0,
vbelv LIKE vbfa-vbelv, " Sales Order no
vbeln like vbfa-vbeln, "Invoice No
erdat LIKE vbak-erdat, " Date on Which Record Was Created
kunnr LIKE vbak-kunnr,
ps_psp_pnr LIKE vbak-ps_psp_pnr, " Work Breakdown Structure Element
END OF i_vbak.
*DATA : BEGIN OF i_zzvbak OCCURS 0,
*vbeln LIKE zzvbak-vbeln,
*zssidc LIKE zzvbak-zssidc, "Salesman ID
*END OF i_zzvbak.
DATA : BEGIN OF i_vbrk OCCURS 0,
vbeln LIKE vbrk-vbeln,
fkdat LIKE vbrk-fkdat, "Invoice Date
END OF i_vbrk.
DATA : BEGIN OF i_kna1 OCCURS 0,
kunnr LIKE kna1-kunnr , " Customer Number 1
name1 LIKE kna1-name1, " Customer Name
pstlz LIKE kna1-pstlz , " Postal Code
END OF i_kna1.
DATA : BEGIN OF i_vbrp OCCURS 0,
vbeln LIKE vbrp-vbeln,
aubel LIKE vbrp-aubel,
netwr LIKE vbrp-netwr , " Net Value in Document Currency
kzwi1 LIKE vbrp-kzwi1, " Subtotal 1 from pricing procedure for condition
erdat LIKE vbrp-erdat, "Billing document.
END OF i_vbrp.
DATA : BEGIN OF i_knvp OCCURS 0,
parvw LIKE knvp-parvw , " Partner Function
kunnr LIKE knvp-kunnr ,
parnr LIKE knvp-parnr , " Number of contact person
END OF i_knvp .
DATA : BEGIN OF i_data OCCURS 0,
erdat LIKE vbak-erdat, " Date on Which Record Was Created
vbeln LIKE vbak-vbeln, " Sales Order no
fkdat LIKE vbrk-fkdat, " Invoice date.
kunnr LIKE kna1-kunnr , " Customer Number
ps_psp_pnr LIKE vbak-ps_psp_pnr, " Work Breakdown Structure Element
name1 LIKE kna1-name1, " Customer Name
netwr LIKE vbrp-netwr , " Net Value in Document Currency
kzwi1 LIKE vbrp-kzwi1, " Subtotal 1 from pricing procedure for condition
parvw LIKE knvp-parvw , " Partner Function
parnr LIKE knvp-parnr , " Number of contact person
*zssidc LIKE zzvbak-zssidc, "Salesman ID
pstlz LIKE kna1-pstlz , " Postal Code
END OF i_data.
ALV Declaraton
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
gd_tab_group TYPE slis_t_sp_group_alv,
gd_layout TYPE slis_layout_alv,
it_listheader TYPE slis_t_listheader,
gd_repid LIKE sy-repid.
Selection - Screen
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS creation FOR vbak-erdat . " Sales Order Date
SELECT-OPTIONS period FOR vbrk-fkdat . " Invoice Date
SELECT-OPTIONS order FOR vbak-vbeln . " Sales order no
SELECT-OPTIONS name FOR kna1-name1 . " Customer Name
SELECT-OPTIONS contact FOR knvp-parnr . " Contact Name.
*SELECT-OPTIONS ssid FOR zzvbak-zssidc . " Salesman ID
SELECT-OPTIONS project FOR vbak-ps_psp_pnr . " Work Breakdown Structure Element
SELECTION-SCREEN : END OF BLOCK b1.
START-OF-SELECTION
START-OF-SELECTION.
PERFORM data_retrieval.
PERFORM build_fieldcatalog.
PERFORM BUILD_LAYOUT.
PERFORM top_of_page.
PERFORM fill_listheader USING it_listheader.
PERFORM display_alv_report.
END-OF-SELECTION.
*TOP-OF-PAGE.
TOP-OF-PAGE.
END-OF-PAGE.
*& Form BUILD_FIELDCATALOG
text
FORM build_fieldcatalog.
fieldcatalog-fieldname = 'KUNNR'.
fieldcatalog-seltext_m = 'Sold to Party'.
fieldcatalog-col_pos = 0.
fieldcatalog-outputlen = 10.
fieldcatalog-emphasize = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'NAME1'.
fieldcatalog-seltext_m = 'Hlev Customer'.
fieldcatalog-col_pos = 1.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'PARNR'.
fieldcatalog-seltext_m = 'Contact name'.
fieldcatalog-col_pos = 2.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'PS_PSP_PNR'.
fieldcatalog-seltext_m = 'Project ID'.
fieldcatalog-col_pos = 3.
fieldcatalog-do_sum = 'X'.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'VBELN'.
fieldcatalog-seltext_m = 'Sales Document Type'.
fieldcatalog-col_pos = 4.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ZSSIDC'.
fieldcatalog-seltext_m = 'SSID'.
fieldcatalog-col_pos = 5.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'ERDAT'.
fieldcatalog-seltext_m = 'so date'.
fieldcatalog-col_pos = 6.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'FKDAT'.
fieldcatalog-seltext_m = 'inv date'.
fieldcatalog-col_pos = 7.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'KWZI1'.
fieldcatalog-seltext_m = 'gross amt'.
fieldcatalog-col_pos = 8.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'NETWR'.
fieldcatalog-seltext_m = 'net amt'.
fieldcatalog-col_pos = 9.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
fieldcatalog-fieldname = 'PSTLZ'.
fieldcatalog-seltext_m = 'Postal code'.
fieldcatalog-col_pos = 10.
APPEND fieldcatalog TO fieldcatalog.
CLEAR fieldcatalog.
ENDFORM. "BUILD_FIELDCATALOG
*& Form DATA_RETRIEVAL
text
FORM data_retrieval.
SELECT VBFAvbelv VBFAvbeln
VBAKerdat VBAKkunnr VBAK~ps_psp_pnr
INTO TABLE i_vbak
FROM VBFA
INNER JOIN vbak
ON VBFAVBELV = VBAKVBELN
WHERE VBAK~erdat IN creation
AND VBFA~vbelV IN ORDER
AND VBAK~ps_psp_pnr IN project
AND VBFA~VBTYP_N = 'M' "Subsequent doc is Invoice
AND VBFA~VBTYP_V = 'C' "Prec doc is Sales order
IF NOT i_vbak[] IS INITIAL.
**Change of ORDER in SELECTS HERE
SELECT vbeln fkdat FROM vbrk INTO TABLE i_vbrk
FOR ALL ENTRIES IN i_vbak
WHERE vbeln = i_vbak-vbeln
AND fkdat IN period.
IF NOT i_vbrk[] IS INITIAL.
SELECT vbeln aubel netwr kzwi1 FROM vbrp INTO TABLE i_vbrp
FOR ALL ENTRIES IN i_vbrk
WHERE VBELN = i_vbrk-vbeln.
endif.
SELECT kunnr name1 pstlz FROM kna1 INTO TABLE i_kna1 FOR ALL ENTRIES IN i_vbak
WHERE kunnr = i_vbak-kunnr
AND name1 IN name.
*SELECT vbeln zssidc FROM zzvbak INTO TABLE i_zzvbak FOR ALL ENTRIES IN i_vbak
*WHERE vbeln = i_vbak-vbeln
*AND zssidc IN ssid .
select netwr kzwi1 erdat from vbrp into table i_vbrp for all entries in i_vbak
where erdat = i_vbak-erdat.
SELECT kunnr parnr parvw FROM knvp INTO CORRESPONDING FIELDS OF TABLE i_knvp FOR ALL ENTRIES IN i_vbak
WHERE kunnr = i_vbak-kunnr
AND parvw = 'AP'
AND parnr IN contact.
ENDIF .
SORT I_VBAK BY VBELN .
SORT I_VBRK BY VBELN .
LOOP AT i_vbrp. "Invoice Item data
MOVE i_vbrp-netwr TO i_data-netwr .
MOVE i_vbrp-kzwi1 TO i_data-kzwi1.
READ table I_VBAK WITH KEY VBELN = I_VBRP-VBELN BINARY SEARCH. "Sales Order info
IF SY-SUBRC = 0.
MOVE I_VBAK-VBELV TO I_DATA-VBELN. "Sales Order no
MOVE I_VBAK-erdat TO I_DATA-erdat. " Date on Which Record Was Created
MOVE I_VBAK-kunnr TO I_DATA-KUNNR. "Customer No
MOVE I_VBAK-ps_psp_pnr TO I_DATA-ps_psp_pnr. " Work Breakdown Structure Element
endif.
READ TABLE I_VBRK WITH KEY VBELN = I_VBRP-VBELN BINARY SEARCH. "Invoice header info
IF SY-SUBRC = 0.
MOVE i_vbrk-fkdat TO i_data-fkdat.
endif.
READ TABLE I_KNA1 WITH KEY KUNNR = I_VBAK-KUNNR BINARY SEARCH. "Customer info
IF SY-SUBRC = 0.
MOVE i_kna1-kunnr TO i_data-kunnr.
MOVE i_kna1-name1 TO i_data-name1.
MOVE i_kna1-pstlz TO i_data-pstlz .
endif.
READ TABLE I_KNvp WITH KEY KUNNR = I_VBAK-KUNNR BINARY SEARCH. "Partner info
IF SY-SUBRC = 0.
MOVE i_knvp-parnr TO i_data-parnr.
endif.
APPEND i_data.
ENDLOOP.
ENDFORM. "DATA_RETRIEVAL
*& Form DISPLAY_ALV_REPORT
text
FORM display_alv_report.
GD_REPID = SY-REPID.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_INTERFACE_CHECK = ' '
I_BYPASSING_BUFFER = ' '
I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
i_callback_top_of_page = 'TOP_OF_PAGE'
I_CALLBACK_HTML_TOP_OF_PAGE = ' '
I_CALLBACK_HTML_END_OF_LIST = ' '
I_STRUCTURE_NAME =
I_BACKGROUND_ID = ' '
I_GRID_TITLE =
I_GRID_SETTINGS =
IS_LAYOUT =
it_fieldcat = fieldcatalog[]
IT_EXCLUDING =
IT_SPECIAL_GROUPS =
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
I_DEFAULT = 'X'
I_SAVE = ' '
IS_VARIANT =
IT_EVENTS =
IT_EVENT_EXIT =
IS_PRINT =
IS_REPREP_ID =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
I_HTML_HEIGHT_TOP = 0
I_HTML_HEIGHT_END = 0
IT_ALV_GRAPHICS =
IT_HYPERLINK =
IT_ADD_FIELDCAT =
IT_EXCEPT_QINFO =
IR_SALV_FULLSCREEN_ADAPTER =
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
TABLES
t_outtab = i_data.
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. "DISPLAY_ALV_REPORT
FORM FOR FILLING LISTHEADER *
FORM fill_listheader USING it_listheader TYPE slis_t_listheader.
DATA : wa_listheader TYPE slis_listheader.
wa_listheader-typ = 'H'.
wa_listheader-info = 'Noel Gifts International Limited '.
APPEND wa_listheader TO it_listheader.
wa_listheader-typ = 'S'.
wa_listheader-info = 'CUSTOMER CREDIT EXCEPTION REPORT' .
APPEND wa_listheader TO it_listheader.
CLEAR wa_listheader.
ENDFORM. "fill_listheader
*& Form top_of_page
text
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_listheader.
ENDFORM. "top_of_page
REWARD IF HELPFUL.
Similar Messages
-
I need to add a single field from with_item table . need to write select query with reference to company code , account doc no , fiscal year
Hi Arun ,
Can you explain little bit more ??
what is account doc no?
what are the transactions should be displayed in your output??
-Rajesh N -
Hi friends,
I am facing a problem in vbfa table.
I have a billing documnet number 1000 in l_value1
now based upon this billing document number i need to get the delivery number from vbfa table
can any one tell which field should i use to retrive delivery number from vbfa table.
and after the delivery number from vbfa table later i need to get the shipment number for that particular delivery number.
can any one tell me which field should i use.
Regards
Priyanka.Hi,
Use the logic in this way to get the delivery number...
select vbelv " Preceding sales and distribution
posnv " Preceding item of an SD document
vbeln " Subsequent sales and distribution
posnn " Subsequent item of an SD document
vbtyp_n " Subsequent document document category
from vbfa
into table i_vbfa
for all entries in i_value
where vbeln = i_value-vbeln and
vbtyp_v = 'J'. " Deliveryr
Edited by: Subhankar Garani on Dec 12, 2008 11:42 AM -
Fetch only required fields from SQL Table
Hi,
We have a table like below which will get data thru a job.
And I'm writing a Job/SP which will fetch 4 fields from that table and send them in a Email to Admins informing how many new employee are added newly.
How to loop thru these fields and not only there might be a chance where we will have 100 records and I need to take only first 30 of them and send.
EmpId
Empname
Deptname
Designation
Can any one has any solution on achieving this?
ThanksPlease refer the below link:
http://beyondrelational.com/modules/2/blogs/77/posts/11386/sql-server-t-sql-different-ways-to-generate-a-comma-separated-string-from-a-table.aspx
You need to use the Top30 query as your table in the script :
select top 30 EmpID,EmpName,DeptName,Designation
from tbl_name
order by EmpID
Eg: You may need to do for other columns:
--WARNING: THIS SCRIPT IS PROVIDED AS-IS AND WITHOUT
-- WARRANTY.
-- FOR DEMONSTRATION PURPOSES ONLY
--Step 01: Generate Temp table to store source data
DECLARE @NamesTable TABLE (Id INT,
Name NVARCHAR(50))
--Step 02: Generate test data
INSERT INTO @NamesTable VALUES (1,'A'),
(2,'D'),
(2,'C'),
(3,'E'),
(3,'H'),
(3,'G')
DECLARE @listIds VARCHAR(MAX) --DO NOT initialize this one!
SELECT @listIds = COALESCE(@listIds + ',' ,'') + Cast(nt.Id as varchar(10))
FROM @NamesTable nt Order by ID asc
DECLARE @listNames VARCHAR(MAX) --DO NOT initialize this one!
SELECT @listNames = COALESCE(@listNames + ',' ,'') + nt.Name
FROM @NamesTable nt Order by ID asc
SELECT 'EmpID: ' + @listIds+', EmpName: ' + @listNames -
hi gurus;
I want to read data from VBFA table nd pass its VBELV to VBAK table to get VBAK values, Iam using FM SD_DOCUMENT_FLOW_GET ND RV_ORDER_FLOW_INFORMATION, BUT i am not getting desire result. WHEN iam using FM SD_DOCUMENT_FLOW_GET, it will give result only for last row of data, its not considering body part, so tell me how to used this FM properly.
data: l_docflow type tdt_docflow.
data lw_docflow type tds_docflow OCCURS 1 WITH HEADER LINE .
SELECT VBELN KNUMV BUKRS KUNRG REGIO NETWR FKSTO FKDAT FKART INTO CORRESPONDING FIELDS OF TABLE T_VBRK
FROM VBRK WHERE BUKRS IN P_BUKRS AND FKDAT IN P_FKDAT AND VKORG IN P_VKORG AND REGIO = '07'
ORDER BY VBELN KNUMV.
SORT T_VBRK BY vbeln.
LOOP AT T_VBRK.
IF T_VBRK-FKART = 'F2' OR T_VBRK-FKART = 'YF2' OR T_VBRK-FKART = 'ZF2' OR
T_VBRK-FKART = 'ZG2' OR T_VBRK-FKART = 'ZL2' OR T_VBRK-FKART = 'YG2' OR T_VBRK-FKART = 'YL2' .
IF T_VBRK-FKSTO IS INITIAL.
CALL FUNCTION 'SD_DOCUMENT_FLOW_GET'
EXPORTING
IV_DOCNUM = T_VBRK-vbelN
IV_ITEMNUM =
IV_ALL_ITEMS =
IV_SELF_IF_EMPTY = ' '
IMPORTING
ET_DOCFLOW = l_docflow
LOOP AT l_docflow INTO lw_docflow .
IF lw_docflow-vbtyp_V = 'C' OR lw_docflow-vbtyp_V = 'K' OR lw_docflow-vbtyp_V = 'L' OR lw_docflow-vbtyp_V = 'E'.
T_VBFA-vbelv = lW_docflow-vbelv.
T_VBFA-VBELN = lW_docflow-VBELN.
T_VBFA-vbtyp_V = lW_docflow-vbtyp_V.
APPEND t_vbfa.
endif.
endloop.
ENDIF.
endloop.
loop at t_vbfa.
if t_vbfa-vbtyp_V = 'C' OR t_vbfa-vbtyp_V = 'K' OR t_vbfa-vbtyp_V = 'L' OR t_vbfa-vbtyp_V = 'E' .
SELECT VBELN BSTNK BSTDK FROM VBAK INTO CORRESPONDING FIELDS OF TABLE T_VBAK FOR ALL ENTRIES IN T_VBFA
WHERE VBELN = T_VBFA-VBELV .
endif.
ENDLOOP.Hello
Use the below function module
RV_ORDER_FLOW_INFORMATION pass the type as C and pass the number.You will get all the flow.
SELECT VBELN KNUMV BUKRS KUNRG REGIO NETWR FKSTO FKDAT FKART INTO CORRESPONDING FIELDS OF TABLE T_VBRK FROM VBRK WHERE BUKRS IN P_BUKRS AND FKDAT IN P_FKDAT AND VKORG IN P_VKORG AND REGIO = '07'
ORDER BY VBELN KNUMV.
SORT T_VBRK BY vbeln.
LOOP AT T_VBRK.
IF T_VBRK-FKART = 'F2' OR T_VBRK-FKART = 'YF2' OR T_VBRK-FKART = 'ZF2' OR
T_VBRK-FKART = 'ZG2' OR T_VBRK-FKART = 'ZL2' OR T_VBRK-FKART = 'YG2' OR T_VBRK-FKART = 'YL2' .
IF T_VBRK-FKSTO IS INITIAL.
i_vbco6-vbeln = t_vbrk-vbeln.
CALL FUNCTION 'RV_ORDER_FLOW_INFORMATION'
EXPORTING
AUFBEREITUNG = '2'
BELEGTYP = ' '
COMWA = i_vbco6
NACHFOLGER = 'X'
N_STUFEN = '50'
VORGAENGER = 'X'
V_STUFEN = '50'
IMPORTING
BELEGTYP_BACK =
TABLES
VBFA_TAB = t_vbfa
EXCEPTIONS
NO_VBFA = 1
NO_VBUK_FOUND = 2
OTHERS = 3
endif.
ENDIF.
endloop.
loop at t_vbfa.
if t_vbfa-vbtyp_V = 'C' OR t_vbfa-vbtyp_V = 'K' OR t_vbfa-vbtyp_V = 'L' OR t_vbfa-vbtyp_V = 'E' .
*clear t_vbfa.
SELECT VBELN BSTNK BSTDK FROM VBAK INTO CORRESPONDING FIELDS OF TABLE T_VBAK FOR ALL ENTRIES IN T_VBFA WHERE VBELN = T_VBFA-VBELV .
endif.
ENDLOOP.
In case of any more help is required do let me know
Regards,
Nabheet Madan -
How to print the data if we take different fields from diffrent tables
Hi ABAPers,
I take diff fields from 3 tables. Those are
these fields from EKBE
EBELN
EBELP
BELNR
BUZEI
BWART
BUDAT
AREWR
REEWR
WERKS
MWSKZ
these fields from EKKO
BUKRS
BSART
WAERS
these field from EKPO
TXZ01
MATNR
MTART
I want to print the data all fields.What logic can i write?
Please help me for this question and i am waiting for your response.
Regards,
Raja Sekhar.Hi,
First you have to fetch data from all the three tables and then consolidate into final table.
In Declaration:
1.Declare Internal Table for EKKO holding:
EBELN
BUKRS
BSART
WAERS
2.Declare Internal Table for EKPO holding:
EBELN
EBELP
TXZ01
MATNR
MTART
3.Declare Internal Table for EKBe holding:
EBELN
EBELP
BELNR
BUZEI
BWART
BUDAT
AREWR
REEWR
WERKS
MWSKZ
*==> This table has
MANDT
EBELN
EBELP
ZEKKN
VGABE
GJAHR
BELNR
BUZEI
as Primary keys field,you should have values for all the PK aotherwise you will get multiple entries*
4.Declare a Final Internal Table i_final with all the fields you want
EBELN
EBELP
BUKRS
BSART
WAERS
TXZ01
MATNR
MTART
BELNR
BUZEI
BWART
BUDAT
AREWR
REEWR
WERKS
MWSKZ
Data Fetching
select EBELN
BUKRS
BSART
WAERS
from EKKO
into table i_ekko
where .........<selection criteria>.
if not i_ekko is initial.
select EBELN
EBELP
TXZ01
MATNR
MTART
from EKPO
into table i_ekpo
for all entries in i_ekko
where EBELN = I_EKKO-EBELN
AND ......<If any other selection criteria>.
if not i_ekpo is initial.
select EBELN
EBELP
BELNR
BUZEI
BWART
BUDAT
AREWR
REEWR
WERKS
MWSKZ
from EKBE
into table i_ekbe
for all entries in i_ekpo
where ebeln = i_ekpo-ebeln
and ebelp = i_ekpo-ebelp
and ..........<If any othet selection criteria>
endif.
endif.
Consolidate
sort i_ekko by ebeln.
sort i_ekpo by ebeln ebelp.
sort i_ekbe by ebeln ebelp.
LOOP AT i_ekbe into wa_ekbe.
read table i_ekko into wa_ekko with key ebeln = wa_ekbe-vbeln binary search.
if sy-subrc = 0.
====>Move all the required firlds from I_EKKO to i_final , like
wa_final-BUKRS = wa_ekko-BUKRS.
endif.
read table i_ekpo into wa_ekpo with key ebeln = wa_ekbe-vbeln
ebelp = wa_ekbe-ebelp binary search.
if sy-subrc = 0.
====>Move all the required firlds from I_EKPO to i_final , like
wa_final-EBELP = wa_ekko-EBELP.
wa_final-TXZ01 = wa_ekko-TXZ01.
endif.
==>Also all the required fields from EKBE to final table, like
wa_final-BELNR = wa_ekbe-BELNR.
endloop. -
No records when inputting new field from linked tables.
I have linked two tables in a report. If I use only fields from one table, no problem. As soon as I add a field from the other table no records are pulled. I am using the same filed "IncidentID" in both tables as a link. If I attempt to pull the "IncidentID" from the second table no records are pulled. There does not appear to be any key fields or indexes in either table if that helps.
Here are the SQL queries. The first string is without any fields from "WorkLog". The second is after adding the field "WorkLog.Incident Number" to the form.
SELECT "HPD_Help_Desk"."Incident Number", "HPD_Help_Desk"."Reported Date", "HPD_Help_Desk"."Direct Contact Site", "HPD_Help_Desk"."Assignee", "HPD_Help_Desk"."Status", "HPD_Help_Desk"."Last Modified Date", "HPD_Help_Desk"."Description", "HPD_Help_Desk"."Priority"
FROM "HPD:Help Desk" "HPD_Help_Desk"
WHERE "HPD_Help_Desk"."Status"='Pending' AND ("HPD_Help_Desk"."Assignee"='Debbie Kiolbasa' OR "HPD_Help_Desk"."Assignee"='John L King' OR "HPD_Help_Desk"."Assignee"='Ligaya Plumlee' OR "HPD_Help_Desk"."Assignee"='Ryan Keeler')
ORDER BY "HPD_Help_Desk"."Assignee"
SELECT "HPD_Help_Desk"."Incident Number", "HPD_Help_Desk"."Reported Date", "HPD_Help_Desk"."Direct Contact Site", "HPD_Help_Desk"."Assignee", "HPD_Help_Desk"."Status", "HPD_Help_Desk"."Last Modified Date", "HPD_Help_Desk"."Description", "HPD_Help_Desk"."Priority", "HPD_WorkLog"."Incident Number"
FROM "HPD:Help Desk" "HPD_Help_Desk" INNER JOIN "HPD:WorkLog" "HPD_WorkLog" ON ("HPD_Help_Desk"."Incident Number"="HPD_WorkLog"."Incident Number") AND ("HPD_Help_Desk"."InstanceId"="HPD_WorkLog"."InstanceId")
WHERE "HPD_Help_Desk"."Status"='Pending' AND ("HPD_Help_Desk"."Assignee"='Debbie Kiolbasa' OR "HPD_Help_Desk"."Assignee"='John L King' OR "HPD_Help_Desk"."Assignee"='Ligaya Plumlee' OR "HPD_Help_Desk"."Assignee"='Ryan Keeler')
ORDER BY "HPD_Help_Desk"."Assignee"
BTW - The "Left Outer Join" receives the errors noted in above post whereas the default "Inner Join" just comes back with empty records.
Unable to use the third party tools due to restrictions on loading software. Also we are unable to access the lower level database.
Thanks -
Hi There,
In SAP GRC 10.0, our team had an issue where we could not add duplicate fields from separate table (see ERROR: Select Currency/UoM field for the selected analyzed fields). This was resolved by the SAP Note 1904313/ 1904314 (http://service.sap.com/sap/support/notes/1904313).
We upgraded our system to SAP GRC 10.1 SP05 and could now add the duplicate fields from separate tables. SAP Note 1904313/ 1904314 was part of SAP GRC 10.1 SP03 so it makes sense that we, in a higher version (SP05), would be able to do this.
The issue now is when we add the duplicate fields from different tables and run the Ad-hoc Query to test if the data source works correctly, the No Data Selected warning persists. This means that the data source provides no data for analysis, which is required to write our business rules.
Below is an example:
Basic data source with just one currency reference field EBAN-WAERS.
When you run the Ad-Hoc Query you receive data.
Basic data source with second currency reference field EKKO-WAERS.
When you run the Ad-Hoc Query no data is found.
Please also make reference to the following thread logged by my colleague (ERROR: Select Currency/UoM field for the selected analyzed fields)
Any assistance to receive data with duplicate fields from separate tables will be highly appreciated.
Thanking you in advance.
Regards
Gary KhanHi
following are the error messages from dump
hrtText
There is already a line with the same key.
hat happened?
Error in ABAP application program.
The current ABAP program "SAPLCKMS" had to be terminated because one of the
statements could not be executed.
This is probably due to an error in the ABAP program.
rror analysis
You wanted to add an entry to table "\FUNCTION-POOL=CKMS\DATA=T_DYN_CKMLCR",
which you declared
with a UNIQUE KEY. However, there was already an entry with the
same key.
This may have been in an INSERT or MOVE statement, or within a
SELECT ... INTO statement.
In particular, you cannot insert more than one initial line into a
table with a unique key using the INSERT INITIAL LINE... statement.
rigger Location of Runtime Error
Program SAPLCKMS
Include LCKMSF01
Row 226
Module type (FORM)
Module Name DYNAMIC_PERIOD_CLOSING
Source code where dump ocured
222
223 APPEND ht_ckmlpp TO t_add_ckmlpp.
224 APPEND LINES OF ht_ckmlcr TO t_add_ckmlcr.
225 INSERT ht_ckmlpp INTO TABLE t_dyn_ckmlpp.
>>>> INSERT LINES OF ht_ckmlcr INTO TABLE t_dyn_ckmlcr.
227 ENDWHILE.
Also I guess there is problem with material ledger in R/3 side
I have never worked on material ledger before so dont hav idea of Tcode and tables in SAP R/3 for material ledger.
Thanks
Navneet -
Drop down in the selection for the field from the table
Hi.
i want to put the drop down for the field from the table fo which i dont know the number of entries for the field zregion1 of the table zbwcntry.
please tell me how to use the function module and what could be the line of codes.
the drop down is for the select option on the slection screen of the classical report.
please help .HI,
Check below code..it may help you.
REPORT Zbunu .
TYPES :BEGIN OF STR ,
MATNR TYPE MATNR ,
END OF STR .
DATA : ITAB TYPE TABLE OF STR WITH HEADER LINE,
VAR TYPE MARA-MATNR .
PARAMETERS : S_MATNR TYPE MATNR ,
P_MATNR TYPE MATNR.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR S_MATNR .
SELECT MATNR FROM MARA INTO
CORRESPONDING FIELDS OF TABLE ITAB UP TO 1000 ROWS.
CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
EXPORTING
DDIC_STRUCTURE = ' '
retfield = 'MATNR'
PVALKEY = ' '
DYNPPROG = SY-CPROG
DYNPNR = SY-DYNNR
DYNPROFIELD = 'S_MATNR'
STEPL = 0
WINDOW_TITLE =
VALUE = ' '
VALUE_ORG = 'S'
MULTIPLE_CHOICE = ' '
DISPLAY = 'X'
CALLBACK_PROGRAM = ' '
CALLBACK_FORM = ' '
tables
value_tab = ITAB
FIELD_TAB =
RETURN_TAB =
DYNPFLD_MAPPING =
EXCEPTIONS
PARAMETER_ERROR = 1
NO_VALUES_FOUND = 2
OTHERS = 3
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards
Ansumesh -
Read contents of changing fields from internal table
Hi Folks,
Please help me in my query below:
Consider there is a Z-table with two fields TABNAM and FIELD having values KNA1 and NAME1 respectively.
In my report I have fetched entries for customers from KNA1. Now based on the field from Z-table I want to populate a variable suppose V_FREE_VAR with the value from KNA1 table.
Here V_FREE_VAR is of CHAR200 so that it accomodate all types of values from KNA1.
The value of Z-table FIELD can change daily i.e next day the value may be PSTLZ.
So how can I read the particular field from internal table as the field to be read is dynamic.
Note: using case is not feasible.
Thanks in advance.
Regards,
Shardul@Hartmut P
As Rob said i want to get the value of the field from internal table. the code is something like this.
I_KNA1 contains records for customers.
Suppose values of Z-table are in internal table I_TEMP_TABLE.
Entries in I_TEMP_TABLE are as follows
TABNAME FIELDNAME
KNA1 NAME1
The value of FIELNAME in Z-table can be changed
Loop at I_TEMP_TABLE into WA_TEMP_TABLE.
Read I_KNA1 into WA_KNA1 with key KUNNR = '0001002234'.
IF SY-SUBRC EQ 0.
CASE WA_TEMP_TABLE-FIELDNAME.
WHEN 'NAME1'.
V_VAR = WA_KNA1-NAME1.
WHEN 'PSTLZ'
V_VAR = WA_KNA1-PSTLZ.
ENDIF.
But using case is not appropriate as KNA1 contains 176 fields. -
ALV for fields from multiple tables and make them editable
Hi,
I am working on a forecasting report. We have created few custom table e.g. store forcaset detail for whole year month wise. tables are say sales data, budget data, forcast data etc.
Now i need to make a report based on monthwise based on above mention table.
eg.o/p looks like:
column name type desc monthapr monthmay .......
table forcast Qty sales 100 150
table budget/sales amt amou 20.50 130.50
table sales vs forcast amt amount 3000 50000
-Now i don't know how to display data from multiple table in single ALV list that to with different field type.
-2nd issue is i need to make only perticuler row editable so that user can chage data.
-3rd when user change data and press calulate button - it should calculate data for future month - i got formula for that and disply the calulated data.
- 4th if user like the forcast data then when press save - change data should update dbtable.
Is this all possible with simple abap FM Or need to use ABAPOO.
I will appericiate all expert help.
Many thanks in advance.
KDE.
Edited by: kde_test on Jun 4, 2010 5:44 PMHi,
Solutions :
1. You can use FM REUSE_ALV_HIERSEQ_LIST_DISPLAY as guided by Ashutosh.
You can also check out this
[http://www.sap technical.com/Tutorials/ABAP/3DGraph/demo.htm] change link to saptechnical without space
2. [How to make certain rows in ALV grid editable...;
3 & 4. Use two importing paramaters 'PF_STATUS_SET' 'USER_COMMAND' of REUSE_ALV_GRID_DISPLAY.
create two function codes 'CALC and 'SAVE' in pf-status and provide your required functionality to these function codes using User-Command.
Sorry am unable to provide you with supporting code, but you can search for it and It can solve your problem
Regards,
Rohit -
How to instantiate class using GUID field from a table
Hi,
There is a class ' /MRSS/CL_SGD_COMPLEX_DEMAND ' and method /MRSS/IF_SGE_COMPLEX_DEMAND~ITEMS_GET.
Actual requirement is field called GUID from the table instantiate the class and i can use its methods to get the reference to assign object.If i understand the requirement correctly , you need to perform items_get based on the guid. Then create the constructor with a parameter for your GUID , then store this guid in a class member variable. And then you can use the same in the ITEMS_GET( ).
Regards
Kavindra -
How to find internal table fields from which table.
Hello Experts,
I have to use a dynamic select inner join query.
SELECT (lv_string)
FROM (from_tab)
INTO CORRESPONDING FIELDS OF TABLE <fs_itab1>
WHERE (where_tab).
ELSEIF table_1 NE ''.
SELECT *
FROM (table_1)
INTO CORRESPONDING FIELDS OF TABLE <fs_itab1>
WHERE (where_tab).
in that LV_string is dynamicaly select. from a structure which is a combination of say VBAK and VBAP
i have to
CONCATENATE 'VBAK~' wa_fields-fname INTO str_temp.
CONCATENATE lv_string str_temp INTO lv_string SEPARATED BY space
CONCATENATE 'VBAP~' wa_fields-fname INTO str_temp.
CONCATENATE lv_string str_temp INTO lv_string SEPARATED BY space.
with there identifire....how to find that...
Regards,
Ketan.Ketan,
I believe you CAN find this only when you are creating lv_string from your structure (or whatever it is).
So paste that code that what is your 'structure' type and on what conditions you want to Fill lv_string from it.
in that LV_string is dynamicaly select. from a structure which is a combination of say VBAK and VBAP
If you have a custom or standard Structure from which you need to fill lv_string, then you should have no worries to full VBAK~ or VBAP~ because fieldnames will be always unique in any Structure and hence ~ additions are not necessarily needed.
The issue can be in the case where you are picking few fields each from std tables VBAK and VBAP in your lv_string and
your "(from_tab)" is an inner join condition. I believe in that case you should be able to identify VBAK~ and VBAP~ while populating lv_string itself. Also you can use DB view MASSVBAP.
Regards,
Diwakar -
Get sales documetn of the invoice from VBFA table
In my user exit, i use to get the sales document from the table.
Hi Kranthi Kumar ,
If u want to know the sales document no of a invoice document from VBFA.
u have a fields VBELV (Preceding sales and distribution document) for this document if you want to know whether it is a
invoice or delivery or etc you can know using the field VBTYP_V (Document category of preceding SD document).
Similarly,
u have a fields VBELN (Subsequent sales and distribution document) for this document if you want to know whether it is a
invoice or delivery or etc you can know using the field VBTYP_N (Subsequent category of preceding SD document).
for ex if vbeln is a invoice docu then preceding document(VBELV) is a delivery.
check again the VBELV docu no in VBELN field
which is a delivery
check the preceeding docu for that delivery docu in VBELV which obviously would be a sales order.
*Else if you want to know directly the corresponding sales document go to VF02 enter that particular invoice number and then go to the document flow.(F5).
Hope its useful.
Revert back to me for any other queries on the same.
Reward points if useful.
Thanks ,
Surya Pydikondala. -
Dear all experts,
I am able to populate all fields data from database table, using dynamic table creation.
eg,
SELECT * FROM (w_tabname) INTO TABLE <t_itab>.
where w_tabname is the table name given by the user, and t_itab is field symbol.
but some requirement is like that i need to pick up only few fields, <b>which user will give at the runtime.</b>
<b>I can</b> take those fields from file into any internal table,
but the problem is that instead of <b>select *</b>, i need to put selected the fields given by user.
i have tried with field symbol, it is not working (as per my knowledge.)
do i need to create any structures dynamically ?
Can anybody please help in this regards ?
Your help will be surely rewarded with points.
Waiting for reply..
Regards
VinayHi Vinay ,
Adding to the below code , you can use some more fields in the select stmt as below:-
REPORT ychatest.
PARAMETERS : p_field1 LIKE dd03l-fieldname,
P_field2 LIKE dd03l-fieldname,
p_table LIKE dd03l-tabname.
FIELD-SYMBOLS : <fs> TYPE STANDARD TABLE.
SELECT (p_field1) (p_field2) ( FROM (p_table) INTO TABLE <fs>.
Now p_field1 & p_field2 belong to the same table since you have give the user to enter only one table name.
This should work fine.
please try & let me know .
Thanks & Regards,
Daniel
Maybe you are looking for
-
Passing data from a container to another
Hi, Let's say I have two containers (Container1=application , Container2). Container1 gets some data from user, perform some database lookup and displays Container2 with the results from database lookup. Container1 --(call and display)--> Container2
-
Skype shows "Connecting" and never comes back
Upgraded to v7 recently. Running a Win 8 desktop. Had no issues w/Skype for years. Now, after finally getting what I thought was a successful Installation, Skype just sits their in the desktop tray (pale icon) and says "connecting" and never comes
-
Shortcut list cheat sheet?
Is there a downloadable cheat sheet of all shortcuts instead of using menus?
-
Hi all, Please provide me with some guidance for below activity . How to add custom fields to ERDK table (print doc header ) by creating our own Z FM similar to the existing FM provided in R436 event . suppose the field is FIELD NAME u2013 FLAG TY
-
How to determin wich control has focus
I'm using arrow keys to drive an external device. I catch the main vi key events and act on it. On this vi is also a textinput. When I navigate true is input with arrow keys the main vi events are also fired. That of course should not happen. Is ther