2020 Nov 17 6:30 PM
Hi Expert
I merge the tables mar Marc and mark into a internal table
and Now I want to do for all entries for this internal table and t001w or t023t But it doesn't give me the Expected
results
Im Am Beginner Please Explain With Details .
TYPE-POOLS SLIS.
DATA : BEGIN OF I_MARA ,
MATNR LIKE MARA-MATNR,
MATKL LIKE MARA-MATKL,
MAKTX LIKE MAKT-MAKTX,
WERKS LIKE MARC-WERKS,
SPRAS LIKE MAKT-SPRAS,
END OF I_MARA .
DATA : IT_MARA LIKE STANDARD TABLE OF I_MARA .
DATA : BEGIN OF I_T023T ,
MATKL LIKE T023T-MATKL,
WGBEZ LIKE T023T-WGBEZ ,
SPRAS LIKE T023T-SPRAS,
END OF I_T023T.
DATA : IT_T023T LIKE STANDARD TABLE OF I_T023T .
DATA : BEGIN OF I_T001W ,
WERKS LIKE MARC-WERKS,
NAME1 LIKE T001W-NAME1,
SPRAS LIKE T001W-SPRAS,
END OF I_T001W.
DATA : IT_T001W LIKE STANDARD TABLE OF I_T001W .
DATA: BEGIN OF IT_MARAFINAL OCCURS 0,
MATNR LIKE MARA-MATNR,
MAKTX LIKE MAKT-MAKTX,
WERKS LIKE MARC-WERKS,
NAME1 LIKE T001W-NAME1,
MATKL LIKE MARA-MATKL,
WGBEZ LIKE T023T-WGBEZ,
END OF IT_MARAFINAL.
*DATA : IT_MARAFINAL LIKE STANDARD TABLE OF I_MARAFINAL .
DATA : IT_FCAT TYPE SLIS_T_FIELDCAT_ALV .
DATA : WA_FCAT TYPE SLIS_FIELDCAT_ALV.
SELECT-OPTIONS : S_MATNR FOR I_MARA-MATNR.
SELECT-OPTIONS : S_WERKS FOR I_MARA-WERKS.
SELECT-OPTIONS : S_MATKL FOR I_MARA-MATKL.
START-OF-SELECTION.
PERFORM GET_DATA.
PERFORM VALIDATE_FCAT.
END-OF-SELECTION.
PERFORM DISPLAY_ALV.
FORM GET_DATA.
CLEAR IT_MARAFINAL.
SELECT MARA~MATNR MARA~MATKL
MAKT~MAKTX MARC~WERKS
MAKT~SPRAS
INTO TABLE IT_MARA
FROM MARA
INNER JOIN MARC ON MARA~MATNR = MARC~MATNR
INNER JOIN MAKT ON MARA~MATNR = MAKT~MATNR
WHERE MARA~MATNR IN S_MATNR
AND MARA~MATKL IN S_MATKL
AND MARC~WERKS IN S_WERKS.
IF IT_MARA IS NOT INITIAL .
SELECT T001W~WERKS T001W~NAME1 T001W~SPRAS
INTO TABLE IT_T001W
FROM T001W
FOR ALL ENTRIES IN IT_MARA
WHERE WERKS = IT_MARA-WERKS AND SPRAS = IT_MARA-SPRAS .
SELECT T023T~MATKL T023T~WGBEZ
T023T~SPRAS
INTO TABLE IT_T023T
FROM T023T
FOR ALL ENTRIES IN IT_MARA
WHERE MATKL = IT_MARA-MATKL AND SPRAS = IT_MARA-SPRAS .
ENDIF.
SORT IT_MARA BY MATNR SPRAS .
LOOP AT IT_T023T INTO I_T023T .
LOOP AT IT_T001W INTO I_T001W .
READ TABLE IT_MARA INTO I_MARA WITH KEY MATKL = I_T023T-MATKL
* SPRAS = I_T023T-SPRAS
SPRAS = I_T001W-SPRAS
WERKS = I_T001W-WERKS
BINARY SEARCH.
IF sy-subrc = 0.
IT_MARAFINAL-MATNR = I_MARA-MATNR.
IT_MARAFINAL-MAKTX = I_MARA-MAKTX.
IT_MARAFINAL-WERKS = I_MARA-WERKS.
IT_MARAFINAL-NAME1 = I_T001W-NAME1.
IT_MARAFINAL-MATKL = I_MARA-MATKL.
IT_MARAFINAL-WGBEZ = I_T023T-WGBEZ.
APPEND IT_MARAFINAL ."TO IT_MARAFINAL.
ENDIF.
ENDLOOP.
ENDLOOP.
ENDFORM.
FORM DISPLAY_ALV.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
IT_FIELDCAT = IT_FCAT
TABLES
T_OUTTAB = IT_MARAFINAL.
ENDFORM.
FORM VALIDATE_FCAT.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
I_PROGRAM_NAME = SY-REPID
I_INTERNAL_TABNAME = 'IT_MARAFINAL'
I_INCLNAME = SY-REPID
* I_BYPASSING_BUFFER = 'X'
CHANGING
CT_FIELDCAT = IT_FCAT[].
ENDFORM.
2020 Nov 17 6:34 PM
Thank you for visiting SAP Community to get answers to your questions. Since you're new in asking questions here, I recommend that you familiarize yourself with https://community.sap.com/resources/questions-and-answers (if you haven't already), as it provides tips for preparing questions that draw responses from our members. For example, you can outline what steps you took to find answers (and why they weren't helpful), share screenshots of what you've seen/done, make sure you've applied the appropriate tags, and use a more descriptive subject line. The more details you provide, the more likely it is that members will be able to assist you. You should also make sure you're using all the appropriate tags, so the right experts can find your question.
Should you wish, you can revise your question now by selecting Actions, then Edit.
Finally, if you're hoping to connect with readers, please consider adding a picture to your profile. Here's how you do it: https://www.youtube.com/watch?v=F5JdUbyjfMA&list=PLpQebylHrdh5s3gwy-h6RtymfDpoz3vDS . By personalizing your profile with a photo of you, you encourage readers to respond.
Best regards
Jennifer
SAP Community moderator
2020 Nov 18 4:51 AM
Again, please the CODE button when you post some code. Thank you.
2020 Nov 18 4:51 AM
What result do you get?
What do you expect?
Please explain in details.
2020 Nov 18 6:22 AM
You will spend more time doing a FOR ALL ENTRIES on these two tables, than make a direct
SELECT * INTO TABLE @data(main_plants) FROM t001w ORDER BY werks.
2020 Nov 18 2:37 PM
sandra.rossi
When I do not enter any conditions(Select-option is null) Displays all records
, but now only 10 records