Application Development and Automation 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: 
Read only

Using FBL5N as SUBMIT in ABAP Program..

Former Member
0 Likes
3,415

Hi all,   

I have a scenario where i need closing balance of customer in my ABAP report, i have used FBL5N in my abap program, but i don't know how to get the closing balance field from memory or LIST, the code i am using is as under:

SUBMIT RFITEMAR
         WITH DD_BUKRS = p_bukrs  "will be vairable
         WITH DD_KUNNR = it-kunnr   "will depend upon data fetched
         WITH DD_STIDA = sy_datum   "will be vairable
*        WITH x_merk  = 'X'         
*        WITH x_park  = 'X'
*        WITH x_apar  = 'X'
         WITH X_OPSEL = 'X'          "i need open items data
         WITH X_NORM  = 'X'           "data regarding all normal items
         WITH x_shbv  = 'X'               "as well as special G/L transactions
         EXPORTING LIST TO MEMORY
         AND RETURN.


      Data it_pos like rfposxext occurs 1 with header line.   "my internal table to get data from memory list
      CLEAR: it_pos, it_pos[].
      FREE MEMORY ID 'it_pos'.
      IMPORT it_pos FROM MEMORY ID 'it_pos'.



seniors please guide..


Regards

Mohammad Jawad

Hi all,   

I have a scenario where i need closing balance of customer in my ABAP report, i have used FBL5N in my abap program, but i don't know how to get the closing balance field from memory or LIST, the code i am using is as under:

SUBMIT RFITEMAR
         WITH DD_BUKRS = p_bukrs  "will be vairable
         WITH DD_KUNNR = it-kunnr   "will depend upon data fetched
         WITH DD_STIDA = sy_datum   "will be vairable
*        WITH x_merk  = 'X'         
*        WITH x_park  = 'X'
*        WITH x_apar  = 'X'
         WITH X_OPSEL = 'X'          "i need open items data
         WITH X_NORM  = 'X'           "data regarding all normal items
         WITH x_shbv  = 'X'               "as well as special G/L transactions
         EXPORTING LIST TO MEMORY
         AND RETURN.


      Data it_pos like rfposxext occurs 1 with header line.   "my internal table to get data from memory list
      CLEAR: it_pos, it_pos[].
      FREE MEMORY ID 'it_pos'.
      IMPORT it_pos FROM MEMORY ID 'it_pos'.



seniors please guide..


Regards

Mohammad Jawad

1 REPLY 1
Read only

Former Member
0 Likes
1,636

Hi,

what you wanted to do is first free up the memory id "it_pos" and then read that memory ID. I doubt you know, what purpose it does have, so please try to search for its use (but you can't use the MEMORY ID statement still in this context).

Once you send the report output to the "List memory", then you should read the list from that memory again, for this purpose, you should use the FM LIST_FROM_MEMORY. However that list would be not readable for a human (as it is in binary form), then you have to use another FM to convert the binary form to (e.g.) ASCI form using FM LIST_TO_ASCI.

The whole code would look like this:

DATA: pt_list LIKE abaplist OCCURS 1 WITH HEADER LINE,

       pt_data TYPE STANDARD TABLE OF text255.

SUBMIT rfitemar

         WITH dd_bukrs = '1000'  "will be vairable

         EXPORTING LIST TO MEMORY

         AND RETURN.

CALL FUNCTION 'LIST_FROM_MEMORY'

  TABLES

    listobject = pt_list.

CALL FUNCTION 'LIST_TO_ASCI'

*   EXPORTING

*     LIST_INDEX               = -1

*     WITH_LINE_BREAK          = ' '

*   IMPORTING

*     LIST_STRING_ASCII        =

*     LIST_DYN_ASCII           =

TABLES

   listasci                 = pt_data

   listobject               = pt_list

EXCEPTIONS

   empty_list               = 1

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

However your requirement is to read a value that is generated from the report. In this way this would be ridiculous to read, because you will have the output in the pt_data table, but to find the correct value in the output via offsets and row / column positions would create you headaches.

This kind of reading would be ok to get the report output a send it immediately to the printing device or whatever, not to read values from it.

Better approach for you whould be finding another way to search for the value using direct table selects, FM-s used in the called (submited) report etc.