2013 Nov 18 8:48 AM
Dear All,
I am new to ABAP. I am working on SQ02 for creating queries. My question is:
I have created an infoset by directing reading table VBAK - Sales Order Header Data. Now I have added an additional field called Material no. I want to join VBAK with VBAP - Sales Order Item data thru query. I have tried on this, but it is fetching only one record while for the selected Sales order there are multiple item data.
Please help me how to do this thru query.
Regards
Rajesh
Dear All,
I am new to ABAP. I am working on SQ02 for creating queries. My question is:
I have created an infoset by directing reading table VBAK - Sales Order Header Data. Now I have added an additional field called Material no. I want to join VBAK with VBAP - Sales Order Item data thru query. I have tried on this, but it is fetching only one record while for the selected Sales order there are multiple item data.
Please help me how to do this thru query.
Regards
Rajesh
2013 Nov 18 9:12 AM
2013 Nov 18 9:22 AM
Hi Ramkumar,
I have not written any program. I am doing this thru SQ02. Where i have inserted table VBAK at the initial stage. Now I want Material numbers from VBAP table. I have added an additional field called material.
When I run query it is showing only one record which is the last material in that SO. There are two line items in the same order.
I have written code as per below:
RECORD PROCESSING
select matnr into mn from vbap where vbeln = vbak-vbeln.
endselect.
then in the field
fieldname = mn.
Regards,
Rajesh
2013 Nov 18 9:25 AM
hi,
you know that internal table and workarea declaration .
Regards
ram
2013 Nov 18 9:36 AM
Hi Ramkumar,
Thanks for your prompt reply. Sorry, I dont know about that. I appreciate if you can help me for programming for me a sample for my query.
Regards,
Rajesh
2013 Nov 18 9:42 AM
Please use table join option to join VBAK and VBAP instead of writing code.
Regards
2013 Nov 18 9:47 AM
REPORT ZRAM_RETRIEVING_VBAK_VBAP NO STANDARD PAGE HEADING.
TYPES : BEGIN OF ty_vbak,
vbeln TYPE vbeln_va,
END OF ty_vbak,
BEGIN OF ty_vbap,
vbeln TYPE vbeln_va,
matnr TYPE matnr,
END OF ty_vbap.
data : it_vbak TYPE TABLE OF ty_vbak,
it_vbap TYPE TABLE OF ty_vbap,
wa_vbak type ty_vbak,
wa_vbap TYPE ty_vbap.
PARAMETERS :vbeln1 TYPE VBAP-VBELN.
select vbeln from vbak
into TABLE it_vbak WHERE vbeln = vbeln1.
SELECT vbeln
matnr
FROM vbap
INTO TABLE it_vbap FOR ALL ENTRIES IN it_vbak
WHERE vbeln = it_vbak-vbeln .
LOOP AT it_vbap INTO wa_vbap.
WRITE :/ wa_vbap-matnr .
ENDLOOP.
2013 Nov 18 11:27 AM
Hi Ramkumar,
Thanks for coding. It has helped me for my output. But still i have not achieved my desire output. after adding the coding when I run query, output is as per below. this fields i have selected as output from SQ01.
After this output when i press back i get below output.
If i want to combine both in one what should I do.
Please help me on this.
Regards,
Rajesh
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |