Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Regarding Data selection according to select options.

Former Member
0 Kudos

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.

10 REPLIES 10

former_member212002
Active Contributor
0 Kudos

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. 

0 Kudos

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...

0 Kudos

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

0 Kudos

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.

0 Kudos

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.

0 Kudos

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.

0 Kudos

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.

0 Kudos

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

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

good