01-29-2010 4:18 AM
Dear All,
in new alv report, i am displaying header note against purchase order selected in select-options, but my requirement is that i want all the purchase order(EBELN) (col -1) and its Header Note (col - 2) accorging to document date (EKKO-BEDAT) selected in select-options.
i am using READ_TEXT (FUNCTION MODULE) to bring Header Note in (Col - 2). and this is my main select statement. i.e.
SELECTION-SCREEN BEGIN OF BLOCK b11 WITH FRAME TITLE text-001 .
SELECT-OPTIONS : S_EBELN for EKKO-EBELN.
SELECT-OPTIONS : S_WERKS for EKPO-WERKS.
SELECT-OPTIONS : S_BEDAT for EKKO-BEDAT .
SELECTION-SCREEN END OF BLOCK b11.
START-OF-SELECTION.
PERFORM EKKO.
FORM EKKO.
SELECT * FROM EKKO WHERE EBELN IN S_EBELN
MOVE EKKO-EBELN TO TNAME.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'F02'
LANGUAGE = 'E'
NAME = TNAME
OBJECT = 'EKKO'
ARCHIVE_HANDLE = 0
"IMPORTING
" HEADER = HTEXT
TABLES
LINES = LTEXT
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
LOOP AT LTEXT.
IF LTEXT-TDLINE NE ''.
MOVE LTEXT-TDLINE TO IT_SO-TDLINE. " Header Note Selected.
MOVE EKKO-EBELN TO IT_SO-EBELN.
APPEND IT_SO.
endif.
ENDLOOP.
clear it_so.
ENDSELECT.
Also I want my all Pur. Ord. (EBELN) and Header Note According to Werks (Plant) selected in select option.
As i am begineer plz help.
01-29-2010 4:32 AM
Just modify your code like this.
SELECTION-SCREEN BEGIN OF BLOCK b11 WITH FRAME TITLE text-001 .
SELECT-OPTIONS : S_EBELN for EKKO-EBELN.
SELECT-OPTIONS : S_WERKS for EKPO-WERKS.
SELECT-OPTIONS : S_BEDAT for EKKO-BEDAT .
SELECTION-SCREEN END OF BLOCK b11.
START-OF-SELECTION.
PERFORM EKKO.
FORM EKKO.
Here Select the fields you required, bud should be followed by your table name i:e Do an inner join on header(EKKO) and details(EKPO)
SELECT ekko~ebeln
FROM EKKO
JOIN EKPO ON EKKO~EBELN = EKPO~EBELN
WHERE EBELN IN S_EBELN
AND BEDAT IN S_BEDAT
AND WERKS IN S_WERKS.
MOVE EKKO-EBELN TO TNAME.
CALL FUNCTION 'READ_TEXT'
EXPORTING
* CLIENT = SY-MANDT
ID = 'F02'
LANGUAGE = 'E'
NAME = TNAME
OBJECT = 'EKKO'
* ARCHIVE_HANDLE = 0
"IMPORTING
" HEADER = HTEXT
TABLES
LINES = LTEXT
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
LOOP AT LTEXT.
IF LTEXT-TDLINE NE ''.
MOVE LTEXT-TDLINE TO IT_SO-TDLINE. " Header Note Selected.
MOVE EKKO-EBELN TO IT_SO-EBELN.
APPEND IT_SO.
endif.
ENDLOOP.
clear it_so.
ENDSELECT.
01-29-2010 6:01 AM
This code is working but in my output i am not getting Header Note which is my requirement.
any other code or any other method. Reply...
01-29-2010 6:13 AM
What do you want to specify with the header note??
As per your code i can understand that you are trying to get the LD CLAUSE of header text of PO.
For this First Check Whether ld clause is maintained in that PO or not.
Regards
Abhinab Mishra
01-29-2010 6:58 AM
I had Done Like this All comments are as they are i.e. this code gives error (for endselect there is no select) so i commented the endselect statement.
read below code and plz do some improvement in it.
SELECT ekkoebeln ekkobedat ekpo~werks into CORRESPONDING FIELDS OF TABLE it_so FROM EKKO
INNER JOIN EKPO ON EKKOEBELN = EKPOEBELN
WHERE ekko~EBELN IN S_EBELN
AND BEDAT IN S_BEDAT
AND WERKS IN S_WERKS.
"SELECT hEBELN hMATNR hWERKS e FROM EKPO INTO CORRESPONDING FIELDS OF TABLE it_so
" WHERE EBELN IN S_EBELN
" AND WERKS IN S_WERKS.
MOVE EKKO-EBELN TO TNAME.
CALL FUNCTION 'READ_TEXT'
EXPORTING
CLIENT = SY-MANDT
ID = 'F02'
LANGUAGE = 'E'
NAME = TNAME
OBJECT = 'EKKO'
ARCHIVE_HANDLE = 0
"IMPORTING
" HEADER = HTEXT
TABLES
LINES = LTEXT
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7
OTHERS = 8.
LOOP AT LTEXT.
IF LTEXT-TDLINE NE ''.
MOVE LTEXT-TDLINE TO IT_SO-TDLINE. " Header Note Selected.
MOVE EKKO-EBELN TO IT_SO-EBELN.
APPEND IT_SO.
endif.
ENDLOOP.
clear it_so.
"ENDSELECT.
01-29-2010 7:23 AM
SELECT ekko~ebeln
ekko~bedat
ekpo~werks
into CORRESPONDING FIELDS OF TABLE it_so
FROM EKKO
JOIN EKPO ON EKKO~EBELN = EKPO~EBELN
WHERE ekko~EBELN IN S_EBELN
AND ekko~ BEDAT IN S_BEDAT
AND ekpo~WERKS IN S_WERKS.
Change your code this way.
Regards
Abhinab Mishra
If helpful do the needful.
01-29-2010 8:17 AM
Now my Question is that i am not getting any output.
if i am putting endselect statement, then it is giving an error.
PLz Help.
01-29-2010 8:26 AM
Now my Question is that i am not getting any output.
if i am putting endselect statement, then it is giving an error.
PLz Help.
01-29-2010 8:56 AM
Dear rockabap,
Don't get offended by this reply,
But you should walk before you run. Get a good book of ABAP or for a training course and get your basics clear.
Also in the rule book of SDN spoon feed is not allowed.
For your ENDSELECT queries.
ENDSELECT is not used with "INTO CORRESPONDING FIELDS OF TABLE"
Understand your requirements and then try with a cool mind.
Regards,
Abhinab Mishra
07-19-2010 12:53 PM
11-11-2010 10:40 AM